Downloads · 30 days
10
3% of all-time downloads
manaladan6/glm-edge-1.5b-chat
glm-edge-1.5b-chat is a text generation model from manaladan6. Use it when you need the model to write or continue text. The card lists the license as other.
Downloads · 30 days
10
3% of all-time downloads
All-time downloads
312
Public
Parameters
1.6B
3.2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors3.2 GB · 100%
From the Hugging Face model README
中文阅读, 点击这里
Install the transformers library from the source code:
pip install git+https://github.com/huggingface/transformers.git
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_PATH = "THUDM/glm-edge-1.5b-chat"
tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)
model = AutoModelForCausalLM.from_pretrained(MODEL_PATH, device_map="auto")
message = [{"role": "user", "content": "hello!"}]
inputs = tokenizer.apply_chat_template(
message,
return_tensors="pt",
add_generation_prompt=True,
return_dict=True,
).to(model.device)
generate_kwargs = {
"input_ids": inputs["input_ids"],
"attention_mask": inputs["attention_mask"],
"max_new_tokens": 128,
"do_sample": False,
}
out = model.generate(**generate_kwargs)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
The usage of this model’s weights is subject to the terms outlined in the LICENSE.