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

Update checkpoint_utils.py to match new web urls in pretrained_models.py #2061

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ defaults:

depth_mult: 1.0
width_mult: 1.0

backbone:
pretrained_weights: https://deci-pretrained-models.s3.amazonaws.com/ppyolo_e/CSPResNetb_l_pretrained.pth
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ defaults:

depth_mult: 0.67
width_mult: 0.75

backbone:
pretrained_weights: https://deci-pretrained-models.s3.amazonaws.com/ppyolo_e/CSPResNetb_m_pretrained.pth
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ defaults:
- _self_

depth_mult: 0.33
width_mult: 0.50

backbone:
pretrained_weights: https://deci-pretrained-models.s3.amazonaws.com/ppyolo_e/CSPResNetb_s_pretrained.pth
width_mult: 0.50
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ defaults:

depth_mult: 1.33
width_mult: 1.25

backbone:
pretrained_weights: https://deci-pretrained-models.s3.amazonaws.com/ppyolo_e/CSPResNetb_x_pretrained.pth
2 changes: 1 addition & 1 deletion src/super_gradients/training/utils/checkpoint_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ def load_pretrained_weights(model: torch.nn.Module, architecture: str, pretraine
if url.startswith("file://") or os.path.exists(url):
pretrained_state_dict = torch.load(url.replace("file://", ""), map_location="cpu")
else:
unique_filename = url.split("https://sghub.deci.ai/models/")[1].replace("/", "_").replace(" ", "_")
unique_filename = url.split("https://sg-hub-nv.s3.amazonaws.com/models/")[1].replace("/", "_").replace(" ", "_")
map_location = torch.device("cpu")
with wait_for_the_master(get_local_rank()):
pretrained_state_dict = load_state_dict_from_url(url=url, map_location=map_location, file_name=unique_filename)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/load_checkpoint_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self):
self.assertTrue((foo.fc2.weight == bar.fc2.weight).all())

def test_checkpoint_path_url(self):
m1 = models.get(Models.YOLO_NAS_S, num_classes=80, checkpoint_path="https://sghub.deci.ai/models/yolo_nas_s_coco.pth")
m1 = models.get(Models.YOLO_NAS_S, num_classes=80, checkpoint_path="https://sg-hub-nv.s3.amazonaws.com/models/yolo_nas_s_coco.pth")
m2 = models.get(Models.YOLO_NAS_S, pretrained_weights="coco")
m1_state = m1.state_dict()
m2_state = m2.state_dict()
Expand Down
1 change: 0 additions & 1 deletion tests/unit_tests/test_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def setUp(self) -> None:
self.images = [
os.path.join(rootdir, "documentation", "source", "images", "examples", "countryside.jpg"),
os.path.join(rootdir, "documentation", "source", "images", "examples", "street_busy.jpg"),
"https://deci-datasets-research.s3.amazonaws.com/image_samples/beatles-abbeyroad.jpg",
]
self._set_images_with_targets()

Expand Down