Skip to content

Conversation

datumbox
Copy link
Contributor

Previously we've added in the reference scripts a --weights argument which operates as a feature switch for the prototype area (None vs fully weights name). When this was first introduced, we just wanted to confirm that the new model builders yielded the same results as the old ones for pre-trained models. Thus we only focused on inference.

Unfortunately the old approach of checking if weights was None won't work if we have models that haven't been graduated from the prototype area and need training. In this PR, we add the explicit feature switch --prototype which allows us to access the prototype model builders.

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jan 21, 2022

💊 CI failures summary and remediations

As of commit 7a83575 (more details on the Dr. CI page):


None of the CI failures appear to be your fault 💚



🚧 2 ongoing upstream failures:

These were probably caused by upstream breakages that are not fixed yet.


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

weights = PM.get_weight(args.weights)
transform_test = weights.transforms()
else:
transform_test = PT.Kinect400Eval(crop_size=(112, 112), resize_size=(128, 171))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I confirm that the arguments in the two classes take the parameters in different order. We are going to remove the old presets anyway and stick with the second one.

@yiwen-song
Copy link
Contributor

yiwen-song commented Jan 21, 2022

Overall LGTM, can you launch 2 jobs to verify it loads prototype models properly?
1 for --prototype and --weights=None
1 for --prototype and --weights=ImageNet1K.xxx

@datumbox
Copy link
Contributor Author

@sallysyw I've checked, see below. Please stamp to unblock.

torchrun --nproc_per_node=1 train.py --test-only --weights ConvNeXt_Tiny_Weights.ImageNet1K_V1 --model convnext_tiny 
ValueError: The weights parameter works only in prototype mode. Please pass the --prototype argument.
torchrun --nproc_per_node=1 train.py --test-only --prototype --weights ConvNeXt_Tiny_Weights.ImageNet1K_V1 --model convnext_tiny 
Test:  Acc@1 82.522 Acc@5 96.146
torchrun --nproc_per_node=1 train.py --test-only --prototype --model convnext_tiny 
Test:  Acc@1 0.092 Acc@5 0.444
torchrun --nproc_per_node=2 train.py --prototype --model convnext_tiny --batch-size 128 --opt adamw --lr 1e-3 --lr-scheduler cosineannealinglr --lr-warmup-epochs 5 --lr-warmup-method linear --auto-augment ta_wide --epochs 600 --random-erase 0.1 --label-smoothing 0.1 --mixup-alpha 0.2 --cutmix-alpha 1.0 --weight-decay 0.05 --norm-weight-decay 0.0 --train-crop-size 176 --model-ema --val-resize-size 232 --ra-sampler --ra-reps 4

Works as expected, output omitted.

@datumbox
Copy link
Contributor Author

@sallysyw Thanks for the careful reviews, checked again everything and looks OK.

@datumbox datumbox merged commit 4bf6c6e into pytorch:main Jan 21, 2022
@datumbox datumbox deleted the references/train_proto_models branch January 21, 2022 18:16
facebook-github-bot pushed a commit that referenced this pull request Jan 26, 2022
Summary:
* Adding prototype flag on reference scripts.

* Import prototype instead of models/transforms.

* Correcting exception type.

* fixing none referencing

Reviewed By: jdsgomes, prabhat00155

Differential Revision: D33739376

fbshipit-source-id: 18751cf5174ff27a5d99e120eaa9e47a02d5fec7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants