-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add init fill-config-transformer
CLI command
#16
Add init fill-config-transformer
CLI command
#16
Conversation
This command reads the Hugging Face model name and revision from the `initialize.components.transformer.encoder_loader` config section, fetches its config and fills in the entry point parameters for the same.
This reverts commit 59b78d9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, feel free to merge if @adrianeboyd is also ok with it.
I could run the CLI command for the prefilled config snippets, but there's still no way for users to get to an initial config:
or
both fail with:
|
Co-authored-by: Adriane Boyd <[email protected]>
Fixed in #20. |
Can you tell the user based on the downloaded model which kind of architecture they probably need? (Like, I was even confused by the naming of something that looks like bert but wasn't.) |
I've expanded the error message to display either the expected HF model type for the given curated transformers architecture (in case the type of the HF model is not supported) or the correct curated transformers architecture (if the HF model type is supported). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(still reviewing - first few comments)
I was actually thinking the same earlier. What about |
Co-authored-by: Sofie Van Landeghem <[email protected]>
…spacy-curated-transformers into feature/config-fill-cli-command
I'd still keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
* Add `init fill-config-transformer` CLI command This command reads the Hugging Face model name and revision from the `initialize.components.transformer.encoder_loader` config section, fetches its config and fills in the entry point parameters for the same. * Feature-gate tests * Lazy import `huggingface_hub` * Rethrow exception when `CliRunner` fails * Fix type * Revert slow marker * Print error when HF tokenizer loading fails * Tick `transformers` version * Install `sentencepiece` in CI * Install `sentencepiece` as a `transformers` extra dependency * Temporarily rethrow exception to debug CI * Revert "Temporarily rethrow exception to debug CI" This reverts commit 59b78d9. * Fix website link in docstring * Set default output path to `stdout` * Update command arg helpstring * Replace `IntEnum` with `Enum` * Apply suggestions from code review Co-authored-by: Adriane Boyd <[email protected]> * Fix typo * Set `model_max_length` to `sys.maxsize` * Automatically fill in piece encoder loader * Assert expected outputs in unit tests * Add args to pass model name/revision via CLI This overrides the name/revision in the config (if present). * Apply suggestions from code review Co-authored-by: Adriane Boyd <[email protected]> * Use `main` as the default CLI revision arg * Mention the model name/revision CLI args in error message * Use `int32.max` as the sentinel value for `model_max_length` * Add back `model_max_length` to unit tests * Add clarification to the mismatching architectures error message * Rename command to `fill-curated-transformer` * Update tests * Clarify the mismatching model type/architecture error message further * `isort` * Shorten docstring for display in CLI * Sneaky readMe fix * Apply suggestions from code review Co-authored-by: Sofie Van Landeghem <[email protected]> * Shorten docstring further * Remove duplicate key * Pretty-print errors when fetching model config from HF Hub * Restructure error handling when validating model type/arch * Add example model names for supported architectures * Sort fetchd parameter list --------- Co-authored-by: Adriane Boyd <[email protected]> Co-authored-by: Sofie Van Landeghem <[email protected]>
* Add `init fill-config-transformer` CLI command This command reads the Hugging Face model name and revision from the `initialize.components.transformer.encoder_loader` config section, fetches its config and fills in the entry point parameters for the same. * Feature-gate tests * Lazy import `huggingface_hub` * Rethrow exception when `CliRunner` fails * Fix type * Revert slow marker * Print error when HF tokenizer loading fails * Tick `transformers` version * Install `sentencepiece` in CI * Install `sentencepiece` as a `transformers` extra dependency * Temporarily rethrow exception to debug CI * Revert "Temporarily rethrow exception to debug CI" This reverts commit 59b78d9. * Fix website link in docstring * Set default output path to `stdout` * Update command arg helpstring * Replace `IntEnum` with `Enum` * Apply suggestions from code review Co-authored-by: Adriane Boyd <[email protected]> * Fix typo * Set `model_max_length` to `sys.maxsize` * Automatically fill in piece encoder loader * Assert expected outputs in unit tests * Add args to pass model name/revision via CLI This overrides the name/revision in the config (if present). * Apply suggestions from code review Co-authored-by: Adriane Boyd <[email protected]> * Use `main` as the default CLI revision arg * Mention the model name/revision CLI args in error message * Use `int32.max` as the sentinel value for `model_max_length` * Add back `model_max_length` to unit tests * Add clarification to the mismatching architectures error message * Rename command to `fill-curated-transformer` * Update tests * Clarify the mismatching model type/architecture error message further * `isort` * Shorten docstring for display in CLI * Sneaky readMe fix * Apply suggestions from code review Co-authored-by: Sofie Van Landeghem <[email protected]> * Shorten docstring further * Remove duplicate key * Pretty-print errors when fetching model config from HF Hub * Restructure error handling when validating model type/arch * Add example model names for supported architectures * Sort fetchd parameter list --------- Co-authored-by: Adriane Boyd <[email protected]> Co-authored-by: Sofie Van Landeghem <[email protected]>
Description
This command reads the Hugging Face model name and revision from the
initialize.components.transformer.encoder_loader
config section, fetches its config from the HF Model Hub and fills in the entry point parameters for the same.Types of change
New feature
Checklist