- 我想使用 多语言代码搜索模型,但首先代码不起作用并输出以下错误,表明它不能仅加载权重:
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("ncoop57/multilingual-codesearch")
model = AutoModel.from_pretrained("ncoop57/multilingual-codesearch")
ValueError: Unrecognized model in ncoop57/multilingual-codesearch. Should have a `model_type` key in its config.json, or contain one of the following strings in its name: gpt_neo, big_bird, speech_to_text, vit, wav2vec2, m2m_100, convbert, led, blenderbot-small, retribert, ibert, mt5, t5, mobilebert, distilbert, albert, bert-generation, camembert, xlm-roberta, pegasus, marian, mbart, mpnet, bart, blenderbot, reformer, longformer, roberta, deberta-v2, deberta, flaubert, fsmt, squeezebert, bert, openai-gpt, gpt2, transfo-xl, xlnet, xlm-prophetnet, prophetnet, xlm, ctrl, electra, encoder-decoder, funnel, lxmert, dpr, layoutlm, rag, tapas
- 然后我下载了 pytorch bin 文件,但它只包含权重字典(这里提到的状态字典),这意味着如果我想使用模型,我必须初始化好的架构,然后加载权重。
但是我应该如何找到适合如此复杂模型重量的架构?我看到一些方法可以根据权重字典找到模型,但我没有设法让它们工作(我想在这里输入链接描述)。
如何找回权重字典的架构以使模型工作?甚至可能吗?