Create README.md
#2
by
MaziyarPanahi
- opened
README.md
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: meta-llama/Meta-Llama-3-70B-Instruct
|
3 |
+
library_name: transformers
|
4 |
+
tags:
|
5 |
+
- axolotl
|
6 |
+
- finetune
|
7 |
+
- dpo
|
8 |
+
- facebook
|
9 |
+
- meta
|
10 |
+
- pytorch
|
11 |
+
- llama
|
12 |
+
- llama-3
|
13 |
+
- chatml
|
14 |
+
language:
|
15 |
+
- en
|
16 |
+
pipeline_tag: text-generation
|
17 |
+
license: llama3
|
18 |
+
license_name: llama3
|
19 |
+
license_link: LICENSE
|
20 |
+
inference: false
|
21 |
+
model_creator: MaziyarPanahi
|
22 |
+
model_name: Llama-3-70B-Instruct-DPO-v0.4
|
23 |
+
quantized_by: MaziyarPanahi
|
24 |
+
datasets:
|
25 |
+
- Intel/orca_dpo_pairs
|
26 |
+
---
|
27 |
+
|
28 |
+
<img src="./llama-3-merges.webp" alt="Llama-3 DPO Logo" width="500" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
|
29 |
+
|
30 |
+
|
31 |
+
# MaziyarPanahi/Llama-3-70B-Instruct-DPO-v0.4
|
32 |
+
|
33 |
+
This model is a fine-tune (DPO) of `meta-llama/Meta-Llama-3-70B-Instruct` model.
|
34 |
+
|
35 |
+
# Quantized GGUF
|
36 |
+
|
37 |
+
All GGUF models are available here: [MaziyarPanahi/Llama-3-70B-Instruct-DPO-v0.4-GGUF](https://huggingface.co/MaziyarPanahi/Llama-3-70B-Instruct-DPO-v0.4-GGUF)
|
38 |
+
|
39 |
+
# Prompt Template
|
40 |
+
|
41 |
+
This model uses `ChatML` prompt template:
|
42 |
+
|
43 |
+
```
|
44 |
+
<|im_start|>system
|
45 |
+
{System}
|
46 |
+
<|im_end|>
|
47 |
+
<|im_start|>user
|
48 |
+
{User}
|
49 |
+
<|im_end|>
|
50 |
+
<|im_start|>assistant
|
51 |
+
{Assistant}
|
52 |
+
````
|
53 |
+
|
54 |
+
# How to use
|
55 |
+
|
56 |
+
You can use this model by using `MaziyarPanahi/Llama-3-70B-Instruct-DPO-v0.4` as the model name in Hugging Face's
|
57 |
+
transformers library.
|
58 |
+
|
59 |
+
```python
|
60 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
61 |
+
from transformers import pipeline
|
62 |
+
import torch
|
63 |
+
|
64 |
+
model_id = "MaziyarPanahi/Llama-3-70B-Instruct-DPO-v0.4"
|
65 |
+
|
66 |
+
model = AutoModelForCausalLM.from_pretrained(
|
67 |
+
model_id,
|
68 |
+
torch_dtype=torch.bfloat16,
|
69 |
+
device_map="auto",
|
70 |
+
trust_remote_code=True,
|
71 |
+
# attn_implementation="flash_attention_2"
|
72 |
+
)
|
73 |
+
|
74 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
75 |
+
model_id,
|
76 |
+
trust_remote_code=True
|
77 |
+
)
|
78 |
+
|
79 |
+
streamer = TextStreamer(tokenizer)
|
80 |
+
|
81 |
+
pipeline = pipeline(
|
82 |
+
"text-generation",
|
83 |
+
model=model,
|
84 |
+
tokenizer=tokenizer,
|
85 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
86 |
+
streamer=streamer
|
87 |
+
)
|
88 |
+
|
89 |
+
# Then you can use the pipeline to generate text.
|
90 |
+
|
91 |
+
messages = [
|
92 |
+
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
|
93 |
+
{"role": "user", "content": "Who are you?"},
|
94 |
+
]
|
95 |
+
|
96 |
+
prompt = tokenizer.apply_chat_template(
|
97 |
+
messages,
|
98 |
+
tokenize=False,
|
99 |
+
add_generation_prompt=True
|
100 |
+
)
|
101 |
+
|
102 |
+
terminators = [
|
103 |
+
tokenizer.eos_token_id,
|
104 |
+
tokenizer.convert_tokens_to_ids("<|im_end|>"),
|
105 |
+
tokenizer.convert_tokens_to_ids("<|eot_id|>") # safer to have this too
|
106 |
+
]
|
107 |
+
|
108 |
+
outputs = pipeline(
|
109 |
+
prompt,
|
110 |
+
max_new_tokens=2048,
|
111 |
+
eos_token_id=terminators,
|
112 |
+
do_sample=True,
|
113 |
+
temperature=0.6,
|
114 |
+
top_p=0.95,
|
115 |
+
)
|
116 |
+
print(outputs[0]["generated_text"][len(prompt):])
|
117 |
+
```
|
118 |
+
|
119 |
+
## Sample Response
|
120 |
+
|
121 |
+
```
|
122 |
+
<|im_start|>system
|
123 |
+
You are a helpful assistant.<|im_end|>
|
124 |
+
<|im_start|>user
|
125 |
+
describe about pros and cons of docker system.<|im_end|>
|
126 |
+
<|im_start|>assistant
|
127 |
+
```
|
128 |
+
|
129 |
+
```
|
130 |
+
Here are the pros and cons of the Docker system:
|
131 |
+
|
132 |
+
**Pros:**
|
133 |
+
|
134 |
+
1. **Lightweight**: Docker containers are lightweight and use fewer resources compared to traditional virtual machines.
|
135 |
+
2. **Isolation**: Docker provides a high level of isolation between containers, ensuring that each application runs independently without interfering with others.
|
136 |
+
3. **Portability**: Docker containers are highly portable and can run on any system that supports Docker, without requiring specific dependencies or configurations.
|
137 |
+
4. **Efficient Use of Resources**: Docker containers can share the same kernel and use fewer resources, making them more efficient than traditional virtual machines.
|
138 |
+
5. **Fast Deployment**: Docker containers can be spun up quickly, making it ideal for rapid deployment and scaling of applications.
|
139 |
+
6. **Easy Maintenance**: Docker provides a simple way to manage and update applications, with features like rolling updates and rollbacks.
|
140 |
+
7. **Security**: Docker provides a secure environment for applications, with features like network isolation and encryption.
|
141 |
+
8. **Large Ecosystem**: Docker has a large and active ecosystem, with a wide range of tools and plugins available for various tasks.
|
142 |
+
9. **Version Control**: Docker provides an easy way to manage different versions of an application, with features like version tagging and rollbacks.
|
143 |
+
10. **Cost-Effective**: Docker can help reduce costs by minimizing the need for virtual machines and reducing the overhead of resource allocation.
|
144 |
+
|
145 |
+
**Cons:**
|
146 |
+
|
147 |
+
1. **Steep Learning Curve**: Docker has a complex architecture and requires a good understanding of containerization, networking, and storage.
|
148 |
+
2. **Overhead**: While Docker containers are lightweight, they still require some overhead in terms of resources and management.
|
149 |
+
3. **Security Risks**: If not properly configured, Docker containers can introduce security risks, such as unauthorized access to the host system.
|
150 |
+
4. **Limited Support for GUI Applications**: Docker is primarily designed for running command-line applications, and running GUI applications can be challenging.
|
151 |
+
5. **Networking Complexity**: Docker's networking model can be complex, especially in large-scale deployments.
|
152 |
+
6. **Storage Complexity**: Docker's storage model can be complex, especially when dealing with persistent data.
|
153 |
+
7. **Limited Support for Legacy Applications**: Docker is designed for modern, cloud-native applications, and may not be suitable for legacy applications that rely on older technologies.
|
154 |
+
8. **Dependence on Docker Hub**: Docker relies heavily on Docker Hub, which can be a single point of failure if the hub is down or experiencing issues.
|
155 |
+
9. **Orchestration Complexity**: Docker provides a built-in orchestration tool, Docker Swarm, but it can be complex to set up and manage.
|
156 |
+
10. **Vendor Lock-in**: Docker is a proprietary technology, and while it has a large ecosystem, it can be difficult to switch to alternative containerization platforms.
|
157 |
+
|
158 |
+
Overall, Docker provides a powerful and flexible way to deploy and manage applications, but it requires careful planning, configuration, and management to ensure optimal performance and security.
|
159 |
+
```
|