Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +59 -0
- llama3-chinese-8b-instruct.Q4_0.gguf +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
llama3-chinese-8b-instruct.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- llama3
|
5 |
+
- chinese
|
6 |
+
---
|
7 |
+
|
8 |
+
# Llama3-Chinese-8B-Instruct
|
9 |
+
|
10 |
+
Llama3-Chinese-8B-Instruct基于Llama3-8B中文微调对话模型,由Llama中文社区和AtomEcho(原子回声)联合研发,我们会持续提供更新的模型参数,模型训练过程见 [https://llama.family](https://llama.family)。
|
11 |
+
|
12 |
+
模型的部署、训练、微调等方法详见Llama中文社区GitHub仓库:[https://github.com/LlamaFamily/Llama-Chinese](https://github.com/LlamaFamily/Llama-Chinese)
|
13 |
+
|
14 |
+
## 如何使用
|
15 |
+
|
16 |
+
```
|
17 |
+
import transformers
|
18 |
+
import torch
|
19 |
+
|
20 |
+
|
21 |
+
model_id = "FlagAlpha/Llama3-Chinese-8B-Instruct"
|
22 |
+
|
23 |
+
pipeline = transformers.pipeline(
|
24 |
+
"text-generation",
|
25 |
+
model=model_id,
|
26 |
+
model_kwargs={"torch_dtype": torch.float16},
|
27 |
+
device="cuda",
|
28 |
+
)
|
29 |
+
|
30 |
+
|
31 |
+
messages = [{"role": "system", "content": ""}]
|
32 |
+
|
33 |
+
messages.append(
|
34 |
+
{"role": "user", "content": "介绍一下机器学习"}
|
35 |
+
)
|
36 |
+
|
37 |
+
prompt = pipeline.tokenizer.apply_chat_template(
|
38 |
+
messages,
|
39 |
+
tokenize=False,
|
40 |
+
add_generation_prompt=True
|
41 |
+
)
|
42 |
+
|
43 |
+
terminators = [
|
44 |
+
pipeline.tokenizer.eos_token_id,
|
45 |
+
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
46 |
+
]
|
47 |
+
outputs = pipeline(
|
48 |
+
prompt,
|
49 |
+
max_new_tokens=512,
|
50 |
+
eos_token_id=terminators,
|
51 |
+
do_sample=True,
|
52 |
+
temperature=0.6,
|
53 |
+
top_p=0.9
|
54 |
+
)
|
55 |
+
|
56 |
+
content = outputs[0]["generated_text"][len(prompt):]
|
57 |
+
|
58 |
+
print(content)
|
59 |
+
```
|
llama3-chinese-8b-instruct.Q4_0.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4afbd238742ff71088e05fae80b4c8834f7e996b7fcc55d7a593eb110625bb60
|
3 |
+
size 4661211648
|