ludwig 无法使用auto_transformer的分词器,

s1ag04yj  于 2个月前  发布在  其他
关注(0)|答案(4)|浏览(28)

我想使用 this model 作为编码器。从描述中可以看出,模型可以像这样上传:

model = AutoModel.from_pretrained("ibm/MoLFormer-XL-both-10pct", deterministic_eval=True, trust_remote_code=True) 
tokenizer = AutoTokenizer.from_pretrained("ibm/MoLFormer-XL-both-10pct", trust_remote_code=True)

我尝试使用

encoder: auto_transformer
   pretrained_model_name_or_path: ibm/MoLFormer-XL-both-10pct

加载它,结果是 RuntimeError: Caught exception during model preprocessing: Tokenizer class MolformerTokenizer does not exist or is not currently imported. 。这并不令人惊讶,因为这个模型没有使用特定的 MolformerTokenizer ,而是使用了 AutoTokenizer
然而,文档中说的是 "If a text feature's encoder specifies a huggingface model, then the tokenizer for that model will be used automatically." 。我该如何为这个模型加载分词器?

vc9ivgsu

vc9ivgsu1#

我发现问题出在trust_remote_code上,它也是加载分词器的强制性要求。
另请参阅#3632

slwdgvem

slwdgvem2#

你好,@sergsb,
感谢你分享你的经验。
Ludwig团队专注于为HF上原生支持的模型提供一流的支持。据我了解,支持需要trust_remote_code=True的模型是可行的,但也存在其他风险需要仔细考虑。
CC:@arnavgarg1

weylhg0b

weylhg0b3#

你好,@justinxzhao,
感谢你的回答。或许可以考虑引入一个全局配置参数trust_remote_code,并将其设置为HF模型和分词器?

2eafrhcq

2eafrhcq4#

@sergsb,这对我来说似乎是合理的。我认为这是@arnavgarg1在#3632中,特别是在这里所要表达的意思。

相关问题