Instructions to use zai-org/chatglm-6b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/chatglm-6b with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("zai-org/chatglm-6b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
利用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
问题已解决,版本问题