from textgen import ChatGlmModel
model = ChatGlmModel("chatglm", "THUDM/chatglm-6b", peft_name="shibing624/chatglm-6b-belle-zh-lora")
r = model.predict(["介绍下北京\n答:"])
print(r) # ['北京是中国的首都,是中国的政治、文化和经济中心。...']
Usage (HuggingFace Transformers)
Without
textgen
, you can use the model like this:
First, you pass your input through the transformer model, then you get the generated sentence.
Install package:
pip install transformers
import sys
from peft import PeftModel
from transformers import AutoModel, AutoTokenizer
sys.path.append('..')
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True, device_map='auto')
model = PeftModel.from_pretrained(model, "shibing624/chatglm-6b-belle-zh-lora")
model = model.half().cuda() # fp16
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
sents = ['介绍下北京\n答:',]
for s in sents:
response = model.chat(tokenizer, s, max_length=128, eos_token_id=tokenizer.eos_token_id)
print(response)
@software{textgen,
author = {Xu Ming},
title = {textgen: Implementation of language model finetune},
year = {2021},
url = {https://github.com/shibing624/textgen},
}
Runs of shibing624 chatglm-6b-belle-zh-lora on huggingface.co
13
Total runs
0
24-hour runs
0
3-day runs
5
7-day runs
2
30-day runs
More Information About chatglm-6b-belle-zh-lora huggingface.co Model
chatglm-6b-belle-zh-lora huggingface.co is an AI model on huggingface.co that provides chatglm-6b-belle-zh-lora's model effect (), which can be used instantly with this shibing624 chatglm-6b-belle-zh-lora model. huggingface.co supports a free trial of the chatglm-6b-belle-zh-lora model, and also provides paid use of the chatglm-6b-belle-zh-lora. Support call chatglm-6b-belle-zh-lora model through api, including Node.js, Python, http.
chatglm-6b-belle-zh-lora huggingface.co is an online trial and call api platform, which integrates chatglm-6b-belle-zh-lora's modeling effects, including api services, and provides a free online trial of chatglm-6b-belle-zh-lora, you can try chatglm-6b-belle-zh-lora online for free by clicking the link below.
shibing624 chatglm-6b-belle-zh-lora online free url in huggingface.co:
chatglm-6b-belle-zh-lora is an open source model from GitHub that offers a free installation service, and any user can find chatglm-6b-belle-zh-lora on GitHub to install. At the same time, huggingface.co provides the effect of chatglm-6b-belle-zh-lora install, users can directly use chatglm-6b-belle-zh-lora installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
chatglm-6b-belle-zh-lora install url in huggingface.co: