Skip to content

Commit 905b765

Browse files
author
Lucas Einig
committed
Fix deprecation warning for torch.load
1 parent e36cc99 commit 905b765

File tree

6 files changed

+57
-3
lines changed

6 files changed

+57
-3
lines changed

.github/workflows/publish.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish package to PyPI when a new version tag is pushed
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
pypi-publish:
10+
name: Publish release to PyPI
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
url: https://pypi.org/p/nnbma>
15+
permissions:
16+
id-token: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.x"
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -q build
27+
- name: Build package
28+
run: |
29+
python -m build
30+
- name: Publish package distributions to PyPI
31+
uses: pypa/gh-action-pypi-publish@release/v1

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ It enables to evaluate any neural network, its gradient, and its Hessian matrix
2929

3030
If you do not have a Python environment compatible with the above dependencies, we advise you to create a specific conda environment to use this code (<https://conda.io/projects/conda/en/latest/user-guide/>).
3131

32-
## Reference
32+
## References
3333

3434
\[1\] Palud, P. & Einig, L. & Le Petit, F. & Bron, E. & Chainais, P. & Chanussot, J. & Pety, J. & Thouvenin, P.-A. & Languignon, D. & Beslić, I. & G. Santa-Maria, M. & Orkisz, J.H. & Ségal, L. & Zakardjian, A. & Bardeau, S. & Gerin, M. & Goicoechea, J.R. & Gratier, P. & Guzman, V. (2023). Neural network-based emulation of interstellar medium models. Astronomy & Astrophysics. 10.1051/0004-6361/202347074.

coverage.svg

+21
Loading

nnbma/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
__version__ = "1.0.2"
2+
13
from .dataset import *
24
from .layers import *
35
from .learning import *

nnbma/networks/neural_network.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ def _recursive_load(path: str) -> "NeuralNetwork":
728728
module: nn.Module = type_module(**d)
729729

730730
sd = module.state_dict()
731-
sd.update(torch.load(template.format("state_dict.pth")))
731+
sd.update(torch.load(template.format("state_dict.pth"), weights_only=True))
732732
module.load_state_dict(sd)
733733

734734
return module

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "nnbma"
7-
version = "1.0.1"
7+
version = ["version"]
88
authors = [
99
"Lucas Einig", "Pierre Palud",
1010
]

0 commit comments

Comments
 (0)