Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use weights_only=True when loading SockeyeModel parameters. #1112

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/push_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
python-version: [3.7, 3.8]
platform: [ubuntu-latest, macos-latest]
platform: [ubuntu-latest, macos-12]

runs-on: ${{ matrix.platform }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/torch_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
python-version: [3.7, 3.8]
platform: [ubuntu-latest, macos-latest]
platform: [ubuntu-latest, macos-12]

# The type of runner that the job will run on
runs-on: ${{ matrix.platform }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Note that Sockeye has checks in place to not translate with an old model that wa

Each version section may have subsections for: _Added_, _Changed_, _Removed_, _Deprecated_, and _Fixed_.

## [3.1.38]

### Fixed

- Set `weights_only=True` when loading `SockeyeModel` parameters.

## [3.1.37]

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion sockeye/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

__version__ = '3.1.37'
__version__ = '3.1.38'
2 changes: 1 addition & 1 deletion sockeye/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def load_parameters(self,
utils.check_condition(os.path.exists(filename), "No model parameter file found under %s. "
"This is either not a model directory or the first training "
"checkpoint has not happened yet." % filename)
state_dict = pt.load(filename, map_location=device)
state_dict = pt.load(filename, weights_only=True, map_location=device)
missing, unexpected = self.load_state_dict(state_dict, strict=False)
# Earlier versions of Sockeye may have saved parameters for traced
# modules. These parameters can be safely ignored.
Expand Down
Loading