Deprecate low use models (#30781)
* Deprecate models - graphormer - time_series_transformer - xlm_prophetnet - qdqbert - nat - ernie_m - tvlt - nezha - mega - jukebox - vit_hybrid - x_clip - deta - speech_to_text_2 - efficientformer - realm - gptsan_japanese * Fix up * Fix speech2text2 imports * Make sure message isn't indented * Fix docstrings * Correctly map for deprecated models from model_type * Uncomment out * Add back time series transformer and x-clip * Import fix and fix-up * Fix up with updated ruff
This commit is contained in:
@@ -45,14 +45,14 @@ def get_last_stable_minor_release():
|
||||
def build_tip_message(last_stable_release):
|
||||
return (
|
||||
"""
|
||||
<Tip warning={true}>
|
||||
<Tip warning={true}>
|
||||
|
||||
This model is in maintenance mode only, we don't accept any new PRs changing its code.
|
||||
"""
|
||||
This model is in maintenance mode only, we don't accept any new PRs changing its code.
|
||||
"""
|
||||
+ f"""If you run into any issues running this model, please reinstall the last version that supported this model: v{last_stable_release}.
|
||||
You can do so by running the following command: `pip install -U transformers=={last_stable_release}`.
|
||||
You can do so by running the following command: `pip install -U transformers=={last_stable_release}`.
|
||||
|
||||
</Tip>"""
|
||||
</Tip>"""
|
||||
)
|
||||
|
||||
|
||||
@@ -164,7 +164,8 @@ def update_main_init_file(models):
|
||||
|
||||
# 1. For each model, find all the instances of model.model_name and replace with model.deprecated.model_name
|
||||
for model in models:
|
||||
init_file = init_file.replace(f"models.{model}", f"models.deprecated.{model}")
|
||||
init_file = init_file.replace(f'models.{model}"', f'models.deprecated.{model}"')
|
||||
init_file = init_file.replace(f"models.{model} import", f"models.deprecated.{model} import")
|
||||
|
||||
with open(filename, "w") as f:
|
||||
f.write(init_file)
|
||||
@@ -265,14 +266,14 @@ def add_models_to_deprecated_models_in_config_auto(models):
|
||||
elif in_deprecated_models and line.strip() == "]":
|
||||
in_deprecated_models = False
|
||||
# Add the new models to deprecated models list
|
||||
deprecated_models_list.extend([f'"{model},"' for model in models])
|
||||
deprecated_models_list.extend([f' "{model}", ' for model in models])
|
||||
# Sort so they're in alphabetical order in the file
|
||||
deprecated_models_list = sorted(deprecated_models_list)
|
||||
new_file_lines.extend(deprecated_models_list)
|
||||
# Make sure we still have the closing bracket
|
||||
new_file_lines.append(line)
|
||||
elif in_deprecated_models:
|
||||
deprecated_models_list.append(line.strip())
|
||||
deprecated_models_list.append(line)
|
||||
else:
|
||||
new_file_lines.append(line)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user