roberthsu2003/for_llama3_Instruct
Viewer • Updated • 52k • 13
How to use roberthsu2003/llama3.2_3B_Instruct with Transformers:
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("roberthsu2003/llama3.2_3B_Instruct", device_map="auto")This model is a fine-tuned version of unsloth/llama-3.2-3b-instruct-unsloth-bnb-4bit. It has been trained using TRL.
from transformers import pipeline
question = "請問光的3原色?"
generator = pipeline("text-generation", model="roberthsu2003/llama3.2_3B_Instruct",device_map="auto", trust_remote_code=True)
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
print(output["generated_text"])
#======output==========
光的三原色是紅、藍和綠色。
output = generator([{"role": "user", "content": "請介紹一下台灣這個國家"}], max_new_tokens=128, return_full_text=False)[0]
print(output["generated_text"])
#==========output==========
台灣是位於東亞的島國,擁有人口超過3.5億。它是一個繁榮的經濟體系,擁有世界上最好的科技、教育和醫療系統。台灣是世界上最多種語言的國家,主要語言包括繁體中文、台語、 Hoklo、 Hakka 和 Min Nan。它是世界上最多種宗教的國家,主要宗教包括佛教、天主教、基督教、伊斯蘭教和無神論
This model was trained with SFT.
Cite TRL as:
@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallouédec},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("roberthsu2003/llama3.2_3B_Instruct", device_map="auto")