Update README.md
Browse files
README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
base_model: unsloth/llama-3-8b-Instruct-bnb-4bit
|
3 |
language:
|
4 |
- en
|
|
|
5 |
license: apache-2.0
|
6 |
tags:
|
7 |
- text-generation-inference
|
@@ -10,14 +11,45 @@ tags:
|
|
10 |
- llama
|
11 |
- trl
|
12 |
- sft
|
|
|
|
|
|
|
13 |
---
|
14 |
|
15 |
-
#
|
16 |
|
17 |
- **Developed by:** date3k2
|
18 |
- **License:** apache-2.0
|
19 |
- **Finetuned from model :** unsloth/llama-3-8b-Instruct-bnb-4bit
|
20 |
|
21 |
-
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
22 |
-
|
23 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
base_model: unsloth/llama-3-8b-Instruct-bnb-4bit
|
3 |
language:
|
4 |
- en
|
5 |
+
- vi
|
6 |
license: apache-2.0
|
7 |
tags:
|
8 |
- text-generation-inference
|
|
|
11 |
- llama
|
12 |
- trl
|
13 |
- sft
|
14 |
+
datasets:
|
15 |
+
- bkai-foundation-models/vi-self-chat-sharegpt-format
|
16 |
+
pipeline_tag: text-generation
|
17 |
---
|
18 |
|
19 |
+
# Llama-8B-Instruct-ShareGPT
|
20 |
|
21 |
- **Developed by:** date3k2
|
22 |
- **License:** apache-2.0
|
23 |
- **Finetuned from model :** unsloth/llama-3-8b-Instruct-bnb-4bit
|
24 |
|
|
|
|
|
25 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
26 |
+
[<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="200" height="32"/>](https://wandb.ai/date3k2/unsloth-llama-3-8b-instruct)
|
27 |
+
## Usage
|
28 |
+
|
29 |
+
```python
|
30 |
+
# !pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
31 |
+
# !pip install --no-deps xformers "trl<0.9.0" peft accelerate bitsandbytes
|
32 |
+
from unsloth import FastLanguageModel
|
33 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
34 |
+
model_name = "date3k2/llama3-8b-instruct-sharegpt",
|
35 |
+
max_seq_length = 2048,
|
36 |
+
dtype = None,
|
37 |
+
load_in_4bit = True,
|
38 |
+
)
|
39 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
40 |
+
|
41 |
+
messages = [
|
42 |
+
{"from": "human", "value": "Hãy gợi ý một số địa điểm du lịch ở Hà Nội."},
|
43 |
+
]
|
44 |
+
inputs = tokenizer.apply_chat_template(
|
45 |
+
messages,
|
46 |
+
tokenize = True,
|
47 |
+
add_generation_prompt = True, # Must add for generation
|
48 |
+
return_tensors = "pt",
|
49 |
+
).to("cuda")
|
50 |
+
|
51 |
+
from transformers import TextStreamer
|
52 |
+
text_streamer = TextStreamer(tokenizer)
|
53 |
+
_ = model.generate(input_ids = inputs, streamer = text_streamer, max_new_tokens = 512, use_cache = True)
|
54 |
+
|
55 |
+
```
|