Downloads · 30 days
22
0% of all-time downloads
derek33125/project-angel-chatglm4
project-angel-chatglm4 is a text generation model from derek33125. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as other.
The model is now following the update from GLM-4-9B-Chat and now requires transformers=4.44.0. Please update your dependencies accordingly. Also follow the dependencies it before using
Downloads · 30 days
22
0% of all-time downloads
All-time downloads
5.7K
Public
Parameters
9.4B
18.8 GB on disk
Likes
4
Public
Click a slice to open those files.
.safetensors18.8 GB · 100%
From the Hugging Face model README
The model is now following the update from GLM-4-9B-Chat and now requires transformers>=4.44.0. Please update your dependencies accordingly.
Also follow the dependencies it before using
This model is GLM-4-9B-Chat, fine-tuned with the Smile dataset to focus on mental health care.
Since it is fine-tuned with a Chinese dataset, please use it in Chinese, even though the base model supports English text.
Use the transformers backend for inference:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda"
tokenizer = AutoTokenizer.from_pretrained("derek33125/project-angel-chatglm4", trust_remote_code=True)
query = "我感到很悲伤"
inputs = tokenizer.apply_chat_template([{"role": "user", "content": query}],
add_generation_prompt=True,
tokenize=True,
return_tensors="pt",
return_dict=True
)
inputs = inputs.to(device)
model = AutoModelForCausalLM.from_pretrained(
"derek33125/project-angel-chatglm4",
torch_dtype=torch.bfloat16,
low_cpu_mem_usage=True,
trust_remote_code=True
).to(device).eval()
gen_kwargs = {"max_length": 2500, "do_sample": True, "top_k": 1}
with torch.no_grad():
outputs = model.generate(**inputs, **gen_kwargs)
outputs = outputs[:, inputs['input_ids'].shape[1]:]
print(tokenizer.decode(outputs[0], skip_special_tokens=True))