利用chatglm6b进行embedding提取,输入input_ids提取出来的embedding全为0

#63
by XiaoHangjia - opened

使用方法:

tokenizer = ChatGLMTokenizer.from_pretrained(path, trust_remote_code=True)
glm_model = ChatGLMForConditionalGeneration.from_pretrained(path, trust_remote_code=True).half()

input_ids = tokenizer([prompt], return_tensors='pt', padding=True).input_ids
emb = glm_model.transformer.word_embeddings(input_ids.to("cuda"))

emb的值为0

问题已解决,版本问题

Sign up or log in to comment