Downloads · 30 days
0
gao-NLP/Llama3-8x8b-MoE-Instruct
Llama3-8x8b-MoE-Instruct is a machine learning model from gao-NLP. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
@Author: qiang gao [email protected] @Date: 2024-05-04 21:09:13 @LastEditors: qiang gao [email protected] @LastEditTime: 2024-05-05 08:43:45 @FilePath: \llama3\hf\Llama3-8x8b-MoE-Instruct\README.md @Description: --…
Downloads · 30 days
0
Access
Public
Updated Jun 18, 2024
Repo size
126 GB
Likes
0
Public
Click a slice to open those files.
.safetensors95 GB · 75%
From the Hugging Face model README
其中 router_warmboot表示使用chines-mixtral-Instruct版本中的router参数进行llama3-MoE——Instruct参数的初始化,router_random是router随机初始化的版本。
详情请见github仓库https://github.com/cooper12121/llama3-8x8b-MoE
generate
import sys
sys.path.append("/apdcephfs_qy3/share_301372554/share_info/qianggao/")
from modeling_file.llama3_moe.modeling_llama_moe import LlamaMoEForCausalLM
from modeling_file.llama3_moe.tokenization_llama_fast import LlamaTokenizerFast
model_ckpt = "/apdcephfs_qy3/share_301372554/share_info/qianggao/ckpt/llama3-8x8b-MoE-base"
tokenizer = LlamaTokenizerFast.from_pretrained(model_ckpt)
# print(tokenizer)
model = LlamaMoEForCausalLM.from_pretrained(model_ckpt,device_map="auto",use_cache=False)
text_list = ["hello,what is your name?","你好,你叫什么名字"]
tokenizer.pad_token = tokenizer.eos_token
tokenizer.pad_token_id = tokenizer.eos_token_id
inputs = tokenizer(text_list,return_tensors="pt", padding=True).to("cuda")
output = model.generate(**inputs,pad_token_id=tokenizer.eos_token_id,max_new_tokens=100)
print(tokenizer.batch_decode(output))
其中modeling_file文件可从github仓库获取