Skip to content

Commit

Permalink
fixed mistakes caused by select all paste
Browse files Browse the repository at this point in the history
  • Loading branch information
BernardZach committed Dec 6, 2024
1 parent fc8324a commit 0ed1114
Show file tree
Hide file tree
Showing 8 changed files with 1,312 additions and 433 deletions.
463 changes: 383 additions & 80 deletions src/transformers/__init__.py

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/transformers/commands/add_new_model_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ def retrieve_info_for_model(model_type, frameworks: Optional[List[str]] = None):
image_processor_class = image_processor_classes[0] # we take the slow image processor class.
else:
image_processor_class = image_processor_classes

feature_extractor_class = auto_module.feature_extraction_auto.FEATURE_EXTRACTOR_MAPPING_NAMES.get(model_type, None)
processor_class = auto_module.processing_auto.PROCESSOR_MAPPING_NAMES.get(model_type, None)

Expand Down Expand Up @@ -1714,4 +1715,4 @@ def get_user_input():
)
frameworks = list(set(frameworks.split(" ")))

return (old_model_type, model_patterns, add_copied_from, frameworks, old_checkpoint)
return (old_model_type, model_patterns, add_copied_from, frameworks, old_checkpoint)
20 changes: 19 additions & 1 deletion src/transformers/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
albert,
align,
altclip,
aria,
audio_spectrogram_transformer,
auto,
autoformer,
Expand Down Expand Up @@ -98,6 +99,7 @@
gemma,
gemma2,
git,
glm,
glpn,
gpt2,
gpt_bigcode,
Expand All @@ -106,6 +108,8 @@
gpt_neox_japanese,
gpt_sw3,
gptj,
granite,
granitemoe,
grounding_dino,
groupvit,
herbert,
Expand All @@ -114,6 +118,8 @@
ibert,
idefics,
idefics2,
idefics3,
ijepa,
imagegpt,
informer,
instructblip,
Expand All @@ -132,6 +138,7 @@
llava,
llava_next,
llava_next_video,
llava_onevision,
longformer,
longt5,
luke,
Expand All @@ -148,27 +155,34 @@
megatron_bert,
megatron_gpt2,
mgp_str,
mimi,
mistral,
mixtral,
mllama,
mluke,
mobilebert,
mobilenet_v1,
mobilenet_v2,
mobilevit,
mobilevitv2,
moshi,
mpnet,
mpt,
mra,
mt5,
musicgen,
musicgen_melody,
mvp,
myt5,
nemotron,
nllb,
nllb_moe,
nougat,
nystromformer,
olmo,
olmo2,
olmoe,
omdet_turbo,
oneformer,
openai,
opt,
Expand All @@ -183,8 +197,10 @@
persimmon,
phi,
phi3,
phimoe,
phobert,
pix2struct,
pixtral,
plbart,
poolformer,
pop2piano,
Expand All @@ -194,6 +210,7 @@
qwen2,
qwen2_audio,
qwen2_moe,
qwen2_vl,
rag,
recurrent_gemma,
reformer,
Expand Down Expand Up @@ -271,5 +288,6 @@
xmod,
yolos,
yoso,
zamba,
zoedepth,
)
)
46 changes: 45 additions & 1 deletion src/transformers/models/auto/configuration_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
("albert", "AlbertConfig"),
("align", "AlignConfig"),
("altclip", "AltCLIPConfig"),
("aria", "AriaConfig"),
("aria_text", "AriaTextConfig"),
("audio-spectrogram-transformer", "ASTConfig"),
("autoformer", "AutoformerConfig"),
("bark", "BarkConfig"),
Expand All @@ -60,6 +62,7 @@
("chinese_clip_vision_model", "ChineseCLIPVisionConfig"),
("clap", "ClapConfig"),
("clip", "CLIPConfig"),
("clip_text_model", "CLIPTextConfig"),
("clip_vision_model", "CLIPVisionConfig"),
("clipseg", "CLIPSegConfig"),
("clvp", "ClvpConfig"),
Expand Down Expand Up @@ -114,6 +117,7 @@
("gemma", "GemmaConfig"),
("gemma2", "Gemma2Config"),
("git", "GitConfig"),
("glm", "GlmConfig"),
("glpn", "GLPNConfig"),
("gpt-sw3", "GPT2Config"),
("gpt2", "GPT2Config"),
Expand All @@ -123,6 +127,8 @@
("gpt_neox_japanese", "GPTNeoXJapaneseConfig"),
("gptj", "GPTJConfig"),
("gptsan-japanese", "GPTSanJapaneseConfig"),
("granite", "GraniteConfig"),
("granitemoe", "GraniteMoeConfig"),
("graphormer", "GraphormerConfig"),
("grounding-dino", "GroundingDinoConfig"),
("groupvit", "GroupViTConfig"),
Expand All @@ -131,6 +137,9 @@
("ibert", "IBertConfig"),
("idefics", "IdeficsConfig"),
("idefics2", "Idefics2Config"),
("idefics3", "Idefics3Config"),
("idefics3_vision", "Idefics3VisionConfig"),
("ijepa", "IJepaConfig"),
("imagegpt", "ImageGPTConfig"),
("informer", "InformerConfig"),
("instructblip", "InstructBlipConfig"),
Expand All @@ -149,6 +158,7 @@
("llava", "LlavaConfig"),
("llava_next", "LlavaNextConfig"),
("llava_next_video", "LlavaNextVideoConfig"),
("llava_onevision", "LlavaOnevisionConfig"),
("longformer", "LongformerConfig"),
("longt5", "LongT5Config"),
("luke", "LukeConfig"),
Expand All @@ -166,13 +176,16 @@
("mega", "MegaConfig"),
("megatron-bert", "MegatronBertConfig"),
("mgp-str", "MgpstrConfig"),
("mimi", "MimiConfig"),
("mistral", "MistralConfig"),
("mixtral", "MixtralConfig"),
("mllama", "MllamaConfig"),
("mobilebert", "MobileBertConfig"),
("mobilenet_v1", "MobileNetV1Config"),
("mobilenet_v2", "MobileNetV2Config"),
("mobilevit", "MobileViTConfig"),
("mobilevitv2", "MobileViTV2Config"),
("moshi", "MoshiConfig"),
("mpnet", "MPNetConfig"),
("mpt", "MptConfig"),
("mra", "MraConfig"),
Expand All @@ -187,6 +200,9 @@
("nougat", "VisionEncoderDecoderConfig"),
("nystromformer", "NystromformerConfig"),
("olmo", "OlmoConfig"),
("olmo2", "Olmo2Config"),
("olmoe", "OlmoeConfig"),
("omdet-turbo", "OmDetTurboConfig"),
("oneformer", "OneFormerConfig"),
("open-llama", "OpenLlamaConfig"),
("openai-gpt", "OpenAIGPTConfig"),
Expand All @@ -202,7 +218,9 @@
("persimmon", "PersimmonConfig"),
("phi", "PhiConfig"),
("phi3", "Phi3Config"),
("phimoe", "PhimoeConfig"),
("pix2struct", "Pix2StructConfig"),
("pixtral", "PixtralVisionConfig"),
("plbart", "PLBartConfig"),
("poolformer", "PoolFormerConfig"),
("pop2piano", "Pop2PianoConfig"),
Expand All @@ -214,6 +232,7 @@
("qwen2_audio", "Qwen2AudioConfig"),
("qwen2_audio_encoder", "Qwen2AudioEncoderConfig"),
("qwen2_moe", "Qwen2MoeConfig"),
("qwen2_vl", "Qwen2VLConfig"),
("rag", "RagConfig"),
("realm", "RealmConfig"),
("recurrent_gemma", "RecurrentGemmaConfig"),
Expand Down Expand Up @@ -300,6 +319,7 @@
("xmod", "XmodConfig"),
("yolos", "YolosConfig"),
("yoso", "YosoConfig"),
("zamba", "ZambaConfig"),
("zoedepth", "ZoeDepthConfig"),
]
)
Expand All @@ -311,6 +331,8 @@
("albert", "ALBERT"),
("align", "ALIGN"),
("altclip", "AltCLIP"),
("aria", "Aria"),
("aria_text", "AriaText"),
("audio-spectrogram-transformer", "Audio Spectrogram Transformer"),
("autoformer", "Autoformer"),
("bark", "Bark"),
Expand Down Expand Up @@ -342,6 +364,7 @@
("chinese_clip_vision_model", "ChineseCLIPVisionModel"),
("clap", "CLAP"),
("clip", "CLIP"),
("clip_text_model", "CLIPTextModel"),
("clip_vision_model", "CLIPVisionModel"),
("clipseg", "CLIPSeg"),
("clvp", "CLVP"),
Expand Down Expand Up @@ -403,6 +426,7 @@
("gemma", "Gemma"),
("gemma2", "Gemma2"),
("git", "GIT"),
("glm", "GLM"),
("glpn", "GLPN"),
("gpt-sw3", "GPT-Sw3"),
("gpt2", "OpenAI GPT-2"),
Expand All @@ -412,6 +436,8 @@
("gpt_neox_japanese", "GPT NeoX Japanese"),
("gptj", "GPT-J"),
("gptsan-japanese", "GPTSAN-japanese"),
("granite", "Granite"),
("granitemoe", "GraniteMoeMoe"),
("graphormer", "Graphormer"),
("grounding-dino", "Grounding DINO"),
("groupvit", "GroupViT"),
Expand All @@ -421,6 +447,9 @@
("ibert", "I-BERT"),
("idefics", "IDEFICS"),
("idefics2", "Idefics2"),
("idefics3", "Idefics3"),
("idefics3_vision", "Idefics3VisionTransformer"),
("ijepa", "I-JEPA"),
("imagegpt", "ImageGPT"),
("informer", "Informer"),
("instructblip", "InstructBLIP"),
Expand All @@ -442,6 +471,7 @@
("llava", "LLaVa"),
("llava_next", "LLaVA-NeXT"),
("llava_next_video", "LLaVa-NeXT-Video"),
("llava_onevision", "LLaVA-Onevision"),
("longformer", "Longformer"),
("longt5", "LongT5"),
("luke", "LUKE"),
Expand All @@ -463,22 +493,26 @@
("megatron-bert", "Megatron-BERT"),
("megatron_gpt2", "Megatron-GPT2"),
("mgp-str", "MGP-STR"),
("mimi", "Mimi"),
("mistral", "Mistral"),
("mixtral", "Mixtral"),
("mllama", "Mllama"),
("mluke", "mLUKE"),
("mms", "MMS"),
("mobilebert", "MobileBERT"),
("mobilenet_v1", "MobileNetV1"),
("mobilenet_v2", "MobileNetV2"),
("mobilevit", "MobileViT"),
("mobilevitv2", "MobileViTV2"),
("moshi", "Moshi"),
("mpnet", "MPNet"),
("mpt", "MPT"),
("mra", "MRA"),
("mt5", "MT5"),
("musicgen", "MusicGen"),
("musicgen_melody", "MusicGen Melody"),
("mvp", "MVP"),
("myt5", "myt5"),
("nat", "NAT"),
("nemotron", "Nemotron"),
("nezha", "Nezha"),
Expand All @@ -487,6 +521,9 @@
("nougat", "Nougat"),
("nystromformer", "Nyströmformer"),
("olmo", "OLMo"),
("olmo2", "OLMo2"),
("olmoe", "OLMoE"),
("omdet-turbo", "OmDet-Turbo"),
("oneformer", "OneFormer"),
("open-llama", "OpenLlama"),
("openai-gpt", "OpenAI GPT"),
Expand All @@ -502,8 +539,10 @@
("persimmon", "Persimmon"),
("phi", "Phi"),
("phi3", "Phi3"),
("phimoe", "Phimoe"),
("phobert", "PhoBERT"),
("pix2struct", "Pix2Struct"),
("pixtral", "Pixtral"),
("plbart", "PLBart"),
("poolformer", "PoolFormer"),
("pop2piano", "Pop2Piano"),
Expand All @@ -515,6 +554,7 @@
("qwen2_audio", "Qwen2Audio"),
("qwen2_audio_encoder", "Qwen2AudioEncoder"),
("qwen2_moe", "Qwen2MoE"),
("qwen2_vl", "Qwen2VL"),
("rag", "RAG"),
("realm", "REALM"),
("recurrent_gemma", "RecurrentGemma"),
Expand Down Expand Up @@ -608,6 +648,7 @@
("xmod", "X-MOD"),
("yolos", "YOLOS"),
("yoso", "YOSO"),
("zamba", "Zamba"),
("zoedepth", "ZoeDepth"),
]
)
Expand Down Expand Up @@ -653,6 +694,9 @@
("xclip", "x_clip"),
("clip_vision_model", "clip"),
("qwen2_audio_encoder", "qwen2_audio"),
("clip_text_model", "clip"),
("aria_text", "aria"),
("idefics3_vision", "idefics3"),
("siglip_vision_model", "siglip"),
("chinese_clip_vision_model", "chinese_clip"),
("rt_detr_resnet", "rt_detr"),
Expand Down Expand Up @@ -1037,4 +1081,4 @@ def register(model_type, config, exist_ok=False):
f"you passed (config has {config.model_type} and you passed {model_type}. Fix one of those so they "
"match!"
)
CONFIG_MAPPING.register(model_type, config, exist_ok=exist_ok)
CONFIG_MAPPING.register(model_type, config, exist_ok=exist_ok)
Loading

0 comments on commit 0ed1114

Please sign in to comment.