XavierSpycy commited on
Commit
fe339a9
·
1 Parent(s): 254d57a

Update model card

Browse files
Files changed (1) hide show
  1. README.md +38 -13
README.md CHANGED
@@ -9,9 +9,9 @@ This model, `Meta-Llama-3-8B-Instruct-zh-10k`, was fine-tuned from the original
9
 
10
  由于原模型[Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)在中文中表现欠佳,该模型`Meta-Llama-3-8B-Instruct-zh-10k`微调自此。在[LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory)工具下,利用LoRa 技术,通过`alpaca_zh`、`alpaca_gpt4_zh`和`oaast_sft_zh`三个语料库上经过三个训练轮次,该模型被调整得更好地掌握了中文。三个语料库共计约10,000个样本的,这也是其名字中的`10k`的由来。
11
 
12
- For efficient inference, the model was converted to the gguf format using [llama.cpp](https://github.com/ggerganov/llama.cpp) and underwent quantization, resulting in a compact model size of about 3.0 GB, suitable for distribution across various devices.
13
 
14
- 为了更高效的推理,该模型转化为了gguf格式并量化,从而得到了一个压缩到约 3.0 GB 大小的模型,以适应分发在各类设备上。
15
 
16
  ### LoRa Hardware / LoRa 硬件
17
  - RTX 4090D x 1
@@ -19,6 +19,8 @@ For efficient inference, the model was converted to the gguf format using [llama
19
  > [!NOTE]
20
  > The complete fine-tuning process took approximately 12 hours. 完整微调过程花费约12小时。
21
 
 
 
22
  ### Model Developer / 模型开发者
23
  - **Pretraining**: Meta
24
  - **Fine-tuning**: XavierSpycy [GitHub](https://github.com/XavierSpycy) | [Huggingface](https://huggingface.co/XavierSpycy)
@@ -35,8 +37,34 @@ This model can be utilized like the original Meta-Llama3 but offers enhanced per
35
  ```python
36
  from transformers import AutoTokenizer, AutoModelForCausalLM
37
 
38
- tokenizer = AutoTokenizer.from_pretrained("XavierSpycy/Meta-Llama-3-8B-Instruct-zh-10k")
39
- model = AutoModelForCausalLM.from_pretrained("XavierSpycy/Meta-Llama-3-8B-Instruct-zh-10k")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  ```
41
 
42
  Further details about the deployment are available in the GitHub repository [Llama3Ops: From LoRa to Deployment with Llama3](https://github.com/XavierSpycy/llama-ops).
@@ -44,9 +72,9 @@ Further details about the deployment are available in the GitHub repository [Lla
44
  更多关于部署的细节可以在我的个人仓库 [Llama3Ops: From LoRa to Deployment with Llama3](https://github.com/XavierSpycy/llama-ops) 获得。
45
 
46
  ## Ethical Considerations, Safety & Risks / 伦理考量、安全性和危险
47
- Please refer to [Meta Llama 3's Ethical Considerations](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct#ethical-considerations-and-limitations) for more information.
48
 
49
- 请参考 [Meta Llama 3's Ethical Considerations](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct#ethical-considerations-and-limitations),以获取更多细节。
50
 
51
  ## Limitations / 局限性
52
  The comprehensive abilities of the model have not been fully tested. While it performs smoothly in Chinese conversations, further benchmarks are required to evaluate its full capabilities. The quality and quantity of the Chinese corpora used may also limit model outputs. Additionally, catastrophic forgetting in the fine-tuned model has not been evaluated.
@@ -54,9 +82,9 @@ The comprehensive abilities of the model have not been fully tested. While it pe
54
  该模型的全面的能力尚未测试。尽管它在中文对话中表现流利,但需要更多的测评以评估其完整的能力。中文语料库的质量和数量或许对模型输出有所限制。另外,微调模型中的灾难性遗忘尚未评估。
55
 
56
  ## Acknowledgements / 致谢
57
- We thank Meta for their open-source contributions, which have greatly benefited the developer community, and acknowledge the collaborative efforts of developers in enhancing this community. Key points include bias monitoring, responsible usage guidelines, and transparency in model limitations.
58
 
59
- 我们感谢 Meta 的开源贡献,其极大地帮助了开发者社区,同时,也感谢致力于提升该社区的开发者们的努力。关键点包括偏见监控、负责任的使用指南和模型限制的透明度。
60
 
61
  ## References / 参考资料
62
 
@@ -65,9 +93,7 @@ We thank Meta for their open-source contributions, which have greatly benefited
65
  title={Llama 3 Model Card},
66
  author={AI@Meta},
67
  year={2024},
68
- url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md}
69
-
70
- }
71
 
72
  @inproceedings{zheng2024llamafactory,
73
  title={LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models},
@@ -76,6 +102,5 @@ url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md}
76
  address={Bangkok, Thailand},
77
  publisher={Association for Computational Linguistics},
78
  year={2024},
79
- url={http://arxiv.org/abs/2403.13372}
80
- }
81
  ```
 
9
 
10
  由于原模型[Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)在中文中表现欠佳,该模型`Meta-Llama-3-8B-Instruct-zh-10k`微调自此。在[LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory)工具下,利用LoRa 技术,通过`alpaca_zh`、`alpaca_gpt4_zh`和`oaast_sft_zh`三个语料库上经过三个训练轮次,该模型被调整得更好地掌握了中文。三个语料库共计约10,000个样本的,这也是其名字中的`10k`的由来。
11
 
12
+ For efficient inference, the model was converted to the gguf format using [llama.cpp](https://github.com/ggerganov/llama.cpp) and underwent quantization, resulting in a compact model size of about 3.18 GB, suitable for distribution across various devices.
13
 
14
+ 为了更高效的推理,使用 [llama.cpp](https://github.com/ggerganov/llama.cpp) 该模型转化为了gguf格式并量化,从而得到了一个压缩到约 3.18 GB 大小的模型,以适应分发在各类设备上。
15
 
16
  ### LoRa Hardware / LoRa 硬件
17
  - RTX 4090D x 1
 
19
  > [!NOTE]
20
  > The complete fine-tuning process took approximately 12 hours. 完整微调过程花费约12小时。
21
 
22
+ 更多训练细节可以在在我的个人仓库 [Hands-On LoRa](https://github.com/XavierSpycy/hands-on-lora) 或 [Llama3Ops](https://github.com/XavierSpycy/llama-ops) 获得。
23
+
24
  ### Model Developer / 模型开发者
25
  - **Pretraining**: Meta
26
  - **Fine-tuning**: XavierSpycy [GitHub](https://github.com/XavierSpycy) | [Huggingface](https://huggingface.co/XavierSpycy)
 
37
  ```python
38
  from transformers import AutoTokenizer, AutoModelForCausalLM
39
 
40
+ model_id = "XavierSpycy/Meta-Llama-3-8B-Instruct-zh-10k"
41
+
42
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
43
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
44
+
45
+ prompt = "你好,你是谁?"
46
+
47
+ messages = [
48
+ {"role": "system", "content": "你是一个乐于助人的助手。"},
49
+ {"role": "user", "content": prompt}]
50
+
51
+ input_ids = tokenizer.apply_chat_template(
52
+ messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
53
+
54
+ terminators = [tokenizer.eos_token_id, tokenizer.convert_tokens_to_ids("<|eot_id|>")]
55
+
56
+ outputs = model.generate(
57
+ input_ids,
58
+ max_new_tokens=256,
59
+ eos_token_id=terminators,
60
+ do_sample=True,
61
+ temperature=0.6,
62
+ top_p=0.9)
63
+
64
+ response = outputs[0][input_ids.shape[-1]:]
65
+
66
+ print(tokenizer.decode(response, skip_special_tokens=True))
67
+ # 我是一个人工智能助手,旨在帮助用户解决问题和完成任务。我是一个虚拟的人工智能助手,能够通过自然语言处理技术理解用户的需求并为用户提供帮助。
68
  ```
69
 
70
  Further details about the deployment are available in the GitHub repository [Llama3Ops: From LoRa to Deployment with Llama3](https://github.com/XavierSpycy/llama-ops).
 
72
  更多关于部署的细节可以在我的个人仓库 [Llama3Ops: From LoRa to Deployment with Llama3](https://github.com/XavierSpycy/llama-ops) 获得。
73
 
74
  ## Ethical Considerations, Safety & Risks / 伦理考量、安全性和危险
75
+ Please refer to [Meta Llama 3's Ethical Considerations](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct#ethical-considerations-and-limitations) for more information. Key points include bias monitoring, responsible usage guidelines, and transparency in model limitations.
76
 
77
+ 请参考 [Meta Llama 3's Ethical Considerations](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct#ethical-considerations-and-limitations),以获取更多细节。关键点包括偏见监控、负责任的使用指南和模型限制的透明度。
78
 
79
  ## Limitations / 局限性
80
  The comprehensive abilities of the model have not been fully tested. While it performs smoothly in Chinese conversations, further benchmarks are required to evaluate its full capabilities. The quality and quantity of the Chinese corpora used may also limit model outputs. Additionally, catastrophic forgetting in the fine-tuned model has not been evaluated.
 
82
  该模型的全面的能力尚未测试。尽管它在中文对话中表现流利,但需要更多的测评以评估其完整的能力。中文语料库的质量和数量或许对模型输出有所限制。另外,微调模型中的灾难性遗忘尚未评估。
83
 
84
  ## Acknowledgements / 致谢
85
+ We thank Meta for their open-source contributions, which have greatly benefited the developer community, and acknowledge the collaborative efforts of developers in enhancing this community.
86
 
87
+ 我们感谢 Meta 的开源贡献,其极大地帮助了开发者社区,同时,也感谢致力于提升该社区的开发者们的努力。
88
 
89
  ## References / 参考资料
90
 
 
93
  title={Llama 3 Model Card},
94
  author={AI@Meta},
95
  year={2024},
96
+ url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md}}
 
 
97
 
98
  @inproceedings{zheng2024llamafactory,
99
  title={LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models},
 
102
  address={Bangkok, Thailand},
103
  publisher={Association for Computational Linguistics},
104
  year={2024},
105
+ url={http://arxiv.org/abs/2403.13372}}
 
106
  ```