Skip to content

Exporters automatic task detection#445

Merged
michaelbenayoun merged 4 commits into
huggingface:mainfrom
michaelbenayoun:exporters_automatic_task_detection
Nov 3, 2022
Merged

Exporters automatic task detection#445
michaelbenayoun merged 4 commits into
huggingface:mainfrom
michaelbenayoun:exporters_automatic_task_detection

Conversation

@michaelbenayoun

@michaelbenayoun michaelbenayoun commented Nov 3, 2022

Copy link
Copy Markdown
Member

What does this PR do?

This PR enables automatic task detection for optimum.exporters.

  • Task detection for local directories
  • Task detection for model repos on the Hub

@michaelbenayoun michaelbenayoun mentioned this pull request Nov 3, 2022
8 tasks
@HuggingFaceDocBuilderDev

HuggingFaceDocBuilderDev commented Nov 3, 2022

Copy link
Copy Markdown

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

@julien-c
julien-c self-requested a review November 3, 2022 14:07
Comment thread optimum/exporters/tasks.py Outdated
Comment on lines +678 to +679
# TODO: implement this.
raise NotImplementedError("Cannot infer the task from a local directory yet.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not sure we even want to support this, in a first version at least

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Alright, changed the message and the exception to something that does not open the door for future support (even though it might come someday).

@julien-c julien-c left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks food from quick glance!

Comment thread optimum/exporters/tasks.py Outdated
transformers_info = model_info.transformersInfo
if transformers_info is None or transformers_info.get("auto_model") is None:
raise RuntimeError(f"Could not infer the task from the model repo {model_name_or_path}")
auto_model_class_name = f"{class_name_prefix}{transformers_info['auto_model']}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i think auto_model can start with TF already in some cases so you just only prepend it if it's not already there

Comment thread optimum/exporters/onnx/__main__.py Outdated
@julien-c

julien-c commented Nov 3, 2022

Copy link
Copy Markdown
Member

BTW context for anyone reading this PR: the Hub determines AutoModel-type from models' config.json using:

@julien-c

julien-c commented Nov 3, 2022

Copy link
Copy Markdown
Member

This will pave the way to build a really cool "official" Space under the official ONNX org, WDYT @fxmarty?

e.g. under https://huggingface.co/spaces/onnx/convert (for consistency with other converters)

@fxmarty

fxmarty commented Nov 3, 2022

Copy link
Copy Markdown
Contributor

LGTM, hopefully we put out a space tonight or tomorrow!

@michaelbenayoun
michaelbenayoun merged commit 4e646c0 into huggingface:main Nov 3, 2022
@michaelbenayoun
michaelbenayoun deleted the exporters_automatic_task_detection branch November 3, 2022 15:15
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.

4 participants