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

Fix training_params deprecation #1542

Merged
merged 4 commits into from
Oct 17, 2023

Conversation

Louis-Dupont
Copy link
Contributor

@Louis-Dupont Louis-Dupont commented Oct 17, 2023

Reproduce

from omegaconf import OmegaConf
from hydra.utils import instantiate

from super_gradients import Trainer
from super_gradients.training import models
from super_gradients.common.object_names import Models
from super_gradients.common.environment.cfg_utils import load_recipe
from super_gradients.training.dataloaders import coco2017_train, coco2017_val

train_loader = coco2017_train(dataset_params={"max_num_samples": 400})
val_loader = coco2017_val(dataset_params={"max_num_samples": 400})

yolonas_recipe = load_recipe(config_name="coco2017_yolo_nas_s", overrides=[f"arch_params.num_classes=80", "training_hyperparams.max_epochs=1", "training_hyperparams.mixed_precision=False"])
yolonas_recipe = OmegaConf.to_container(instantiate(yolonas_recipe))
training_params = yolonas_recipe['training_hyperparams']

trainer = Trainer(experiment_name="yolonas_training_with_adapter", ckpt_root_dir="./")
model = models.get(model_name=Models.YOLO_NAS_S, num_classes=80, pretrained_weights="coco")

trainer.train(model=model, training_params=training_params, train_loader=train_loader, valid_loader=val_loader)

Explanation

It looks like criterion_params still exists with this code, but is empty. this may be due to default in yamls.
Instead of checking if criterion_params exists, I changed the code to check if criterion_params is empty

Copy link
Collaborator

@BloodAxe BloodAxe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Louis-Dupont Louis-Dupont merged commit 39cae16 into master Oct 17, 2023
6 checks passed
@Louis-Dupont Louis-Dupont deleted the hotfix/SG-000-fix_deprecated_training_param branch October 17, 2023 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants