Skip to content

Conversation

@michaelbenayoun
Copy link
Member

What does this PR do?

This allows to choose which framework to use between PyTorch and TensorFlow for the ONNX export.

Fixes #15990

@michaelbenayoun michaelbenayoun requested a review from lewtun March 9, 2022 15:02
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Mar 9, 2022

The documentation is not available anymore as the PR was closed or merged.

@michaelbenayoun michaelbenayoun requested a review from sgugger March 9, 2022 15:15
Copy link
Member

@lewtun lewtun left a comment

Choose a reason for hiding this comment

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

Thanks a lot for fixing this @michaelbenayoun - the change looks great! I left some nits about docstrings and a question about running in a pure tensorflow env.

Copy link
Member

Choose a reason for hiding this comment

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

What happens here if only tensorflow is installed?

If I understand correctly, since _TASKS_TO_AUTOMODELS is an empty dict by default here, this error won't show the possible values for a pure tensorflow env because we should be accessing _TASKS_TO_TF_AUTOMODELS in that case

Copy link
Member Author

Choose a reason for hiding this comment

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

So I added a method called _validate_framework_choice that should take care of that.

Copy link
Member

Choose a reason for hiding this comment

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

Nice!

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@lewtun lewtun left a comment

Choose a reason for hiding this comment

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

Thanks for iterating on this - LGTM!

Copy link
Member

Choose a reason for hiding this comment

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

Nice!

@michaelbenayoun michaelbenayoun merged commit 37a9fc4 into huggingface:master Mar 14, 2022
@michaelbenayoun michaelbenayoun deleted the onnx_framework_choice branch March 14, 2022 15:47
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.

FeaturesManager assumes only one of Torch or TensorFlow is installed

4 participants