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

Question: what is MODEL.WEIGHTS in d2go.exporter options? #514

Open
soid opened this issue Mar 28, 2023 · 2 comments
Open

Question: what is MODEL.WEIGHTS in d2go.exporter options? #514

soid opened this issue Mar 28, 2023 · 2 comments

Comments

@soid
Copy link
Contributor

soid commented Mar 28, 2023

I'm running d2go.exporter as specified in the docs, and I'm getting the error that MODEL.WEIGHTS is not recognized as an export method:

KeyError: "No object named 'MODEL.WEIGHTS' found in 'ModelExportMethod' registry! Available names: ['torchscript_mobile_int8@tracing', 'torchscript_mobile-vulkan@tracing', 'torchscript_mobile-metal@tracing', 'torchscript_mobile@tracing', 'torchscript_int8@tracing', 'torchscript@tracing', 'torchscript_mobile_int8@scripting', 'torchscript_mobile-vulkan@scripting', 'torchscript_mobile-metal@scripting', 'torchscript_mobile@scripting', 'torchscript_int8@scripting', 'torchscript@scripting', 'torchscript_mobile_int8', 'torchscript_mobile-vulkan', 'torchscript_mobile-metal', 'torchscript_mobile', 'torchscript_int8', 'torchscript']"

The way I run the script:

d2go.exporter --config-file configs/faster_rcnn_fbnetv3a_C4.yaml \
--output-dir ./ --predictor-type torchscript_int8 \
MODEL.WEIGHTS https://mobile-cv.s3-us-west-2.amazonaws.com/d2go/models/246823121/model_0479999.pth

I was looking into the exporter code and can't figure out what's the meaning of this MODEL.WEIGHTS https://...pth options? It seems is part of --predictor-type parameter, which is parsed one by one as exporting types. But doesn't make much sense. What does it actually do?

@soid soid changed the title Question: what is MODEL.WEIGHTS in d2go.exporter options Question: what is MODEL.WEIGHTS in d2go.exporter options? Mar 28, 2023
@soid
Copy link
Contributor Author

soid commented Mar 28, 2023

Ok, I figured that --output-dir should follow --predictor-type, not the other way, as in the example with torchscript. I created a PR to correct the doc.
I'm still curious of the meaning of MODEL.WEIGHTS http:/... argument.

@wat3rBro
Copy link
Contributor

@soid The weird problem is because a conflict of nargs when using argparse: in d2go.exporter the --predictor-type is set with nargs="+" (https://github.com/facebookresearch/d2go/blob/main/tools/exporter.py#L123) while there's another opts argument is set with nargs=argparse.REMAINDER (https://github.com/facebookresearch/d2go/blob/main/d2go/setup.py#L111). Therefore --predictor-type can't be used as the last argument, for example putting --output-dir behind it would work. The opt argument is for overwriting the config file, MODEL.WEIGHTS http:/... overwrites the model weights in the config file configs/faster_rcnn_fbnetv3a_C4.yaml with a trained one.

facebook-github-bot pushed a commit that referenced this issue Apr 3, 2023
Summary:
Correction in docs.
Related issue: #514

Pull Request resolved: #515

Reviewed By: crassirostris

Differential Revision: D44546569

fbshipit-source-id: fec3797bad15b55833d9278c19978ff9c312d963
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

No branches or pull requests

2 participants