THUDM / GLM

GLM (General Language Model)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

如何通过huggingface加载的模型拿到last_hidden_states?

superhg opened this issue · comments

通过以下代码加载的huggingface glm_large_chinese模型,用来跑finetune的时候

output = model(**inputs)

这里只能拿到loss和logits。如何能拿到last_hidden_states??

model = AutoModelForSeq2SeqLM.from_pretrained(model_path, cache_dir=".", trust_remote_code=True)

例如modling_glm,py中下面的返回

return ModelOutput( last_hidden_states=last_hidden_states, logits=logits, mems=mems, )