Skip to content

Commit

Permalink
Use weights_only=True when loading SockeyeModel parameters. (#1112)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjdenkowski authored May 22, 2024
1 parent 98b4946 commit b0a2cfc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
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

0 comments on commit b0a2cfc

Please sign in to comment.