Downloads · 30 days
13
4% of all-time downloads
shajiu/Tibetan_Llama2_13B_Mental_Health
Tibetan_Llama2_13B_Mental_Health is a text generation model from shajiu. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
- 对Llama 2 进行藏文词表扩充,词表由32000 扩展至56724,提高模型在藏文的编解码效率。在TibetanGeneralCorpus 上使用Sentencepiece 工具训练基于Unigram 策略的藏文分词器。生成的词表与原版Llama 2 的32K 词表进行合并,排除重复的词 元后,得到扩充后词表规模为56724。用15G 的TibetanGeneralCorpus 和20G 的英、中混合文本进行CPT,采用自…
Downloads · 30 days
13
4% of all-time downloads
All-time downloads
349
Public
Parameters
13.3B
26.5 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors26.5 GB · 100%
From the Hugging Face model README
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
# 设置设备
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# 加载模型和分词器
model_name = "shajiu/Tibetan_Llama2_13B_Mental_Health" # 模型名称,可以根据需要调整
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
model.to(device)
def generate_response(prompt, max_length=100, temperature=0.7, top_p=0.9):
inputs = tokenizer(prompt, return_tensors="pt").to(device)
outputs = model.generate(
**inputs,
max_length=max_length,
temperature=temperature,
top_p=top_p,
do_sample=True
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response
if __name__ == "__main__":
prompt = "ང་རང་ཉེ་ལམ་མགོ་འཁོར་ཡོད།མཐོ་གསུམ་རྗེས་ཀྱི་ང་རང་མཐོ་རྒྱུགས་སྔོན་གྱི་འཇིགས་སྐྲག་ལས་གཞན་ད་དུང་རང་ཉིད་སྐྱེས་མ་ཐག་ནས་བཟུང་ལྷག་མ་ཞིག་ཡིན་པར་འདོད།དོན་སྙིང་ཅི་ཡང་མེད།ང་ལ་གྲོགས་པོ་མེད།ཁེར་རྐྱང་གིས་བཟོད་མི་ཐུབ།ཁྱེད་ཀྱིས་ང་ལ་བསམ་འཆར་འགའ་འདོན་ཐུབ་བམ།"
response = generate_response(prompt)
print(response)