Skip to content

Commit 845f614

Browse files
author
Roman Donchenko
committed
regnetx-3.2gf: don't download anything at conversion time
The pycls.models.model_zoo.regnetx function downloads the config file, which is bad, because: a) all downloading is supposed to be done by the downloader, and b) there's no integrity checking on the downloaded file (and in fact, the file can change, because the link points to the master branch of the repository), which endangers the security and reproducibility of the conversion process. Add the config file to the list of the model's files and change the model creation code to avoid the unwanted download.
1 parent 44d1e5d commit 845f614

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

models/public/regnetx-3.2gf/model.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
import pycls.core.checkpoint
1616
import pycls.models.model_zoo
1717

18-
def regnetx_32gf(weights_path):
19-
model = pycls.models.model_zoo.regnetx("RegNetX-3.2GF")
18+
def regnet(config_path, weights_path):
19+
pycls.core.config.cfg.merge_from_file(config_path)
20+
model = pycls.models.model_zoo.RegNet()
2021
pycls.core.checkpoint.load_checkpoint(weights_path, model)
2122
return model

models/public/regnetx-3.2gf/model.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ description: >-
2121
Codebase for Image Classification Research <https://github.com/facebookresearch/pycls>.
2222
task_type: classification
2323
files:
24+
- name: configs/dds_baselines/regnetx/RegNetX-3.2GF_dds_8gpu.yaml
25+
size: 362
26+
sha256: 166491e53c668ecc181692dde27221b4358f1b889e7726396690c24547e53f5f
27+
source: https://raw.githubusercontent.com/facebookresearch/pycls/ca89a79161e437deca8f39f31ceaef3b05873f30/configs/dds_baselines/regnetx/RegNetX-3.2GF_dds_8gpu.yaml
2428
- name: pycls/__init__.py
2529
size: 0
2630
sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
@@ -89,8 +93,9 @@ postprocessing:
8993
conversion_to_onnx_args:
9094
- --model-path=$config_dir
9195
- --model-path=$dl_dir
92-
- --model-name=regnetx_32gf
96+
- --model-name=regnet
9397
- --import-module=model
98+
- --model-param=config_path=r"$dl_dir/configs/dds_baselines/regnetx/RegNetX-3.2GF_dds_8gpu.yaml"
9499
- --model-param=weights_path=r"$dl_dir/ckpt/regnetx-3.2gf.pyth"
95100
- --input-shape=1,3,224,224
96101
- --input-names=data

0 commit comments

Comments
 (0)