Views
No views yet

| Model | Download |
|---|---|
| Meta-Llama-3-8B | 🤗 HuggingFace 🤖 ModelScope |
| Llama3-Chinese-Lora | 🤗 HuggingFace 🤖 ModelScope |
| Llama3-Chinese (merged model) | 🤗 HuggingFace 🤖 ModelScope |
git clone https://www.modelscope.cn/LLM-Research/Meta-Llama-3-8B.git1git lfs install
2git clone https://www.modelscope.cn/seanzhang/Llama3-Chinese-Lora.git1git lfs install
2git clone https://huggingface.co/zhichen/Llama3-Chinese-Lora1python merge_lora.py \
2 --base_model path/to/Meta-Llama-3-8B \
3 --lora_model path/to/lora/Llama3-Chinese-Lora \
4 --output_dir ./Llama3-Chinese1git lfs install
2git clone https://www.modelscope.cn/seanzhang/Llama3-Chinese.git1git lfs install
2git clone https://huggingface.co/zhichen/Llama3-Chinese1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3model_id = "zhichen/Llama3-Chinese"
4
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")
7
8messages = [
9 {"role": "system", "content": "You are a helpful assistant."},
10 {"role": "user", "content": "你好"},
11]
12
13input_ids = tokenizer.apply_chat_template(
14 messages, add_generation_prompt=True, return_tensors="pt"
15).to(model.device)
16
17outputs = model.generate(
18 input_ids,
19 max_new_tokens=2048,
20 do_sample=True,
21 temperature=0.7,
22 top_p=0.95,
23)
24response = outputs[0][input_ids.shape[-1]:]
25print(tokenizer.decode(response, skip_special_tokens=True))python cli_demo.py --model_path zhichen/Llama3-Chinesepython web_demo.py --model_path zhichen/Llama3-Chinesepython -m vllm.entrypoints.openai.api_server --served-model-name Llama3-Chinese --model ./Llama3-Chinese(Replace it with your own merged model path)python vllm_web_demo.py --model Llama3-Chinese1@misc{Llama3-Chinese,
2 title={Llama3-Chinese},
3 author={Zhichen Zhang, Xin LU, Long Chen},
4 year={2024},
5 howpublished={\url{https://github.com/seanzhang-zhichen/llama3-chinese}},
6}