Update README.md
Browse files
README.md
CHANGED
@@ -19,36 +19,68 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
19 |
- **Developed by:** HuyRemy
|
20 |
- **Funded by [optional]:** HuyRemy
|
21 |
- **Shared by [optional]:** HuyRemy
|
22 |
-
- **Model type:**
|
23 |
- **License:** [email protected]
|
24 |
|
25 |
|
26 |
### Model Sources [optional]
|
27 |
|
28 |
-
- **
|
29 |
- **Demo [optional]:** https://matilda.vn
|
30 |
|
31 |
## Uses
|
32 |
|
|
|
|
|
33 |
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
34 |
-
|
|
|
35 |
### Direct Use
|
36 |
``` Python
|
37 |
from unsloth import FastLanguageModel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
model, tokenizer = FastLanguageModel.from_pretrained(
|
39 |
-
model_name = "huyremy/aichat",
|
40 |
max_seq_length = max_seq_length,
|
41 |
dtype = dtype,
|
42 |
load_in_4bit = load_in_4bit,
|
43 |
)
|
44 |
-
FastLanguageModel.for_inference(model)
|
45 |
|
46 |
inputs = tokenizer(
|
47 |
[
|
48 |
alpaca_prompt.format(
|
49 |
-
"who is Nguyễn Phú Trọng?",
|
50 |
-
"",
|
51 |
-
"",
|
52 |
),
|
53 |
], return_tensors = "pt").to("cuda")
|
54 |
|
|
|
19 |
- **Developed by:** HuyRemy
|
20 |
- **Funded by [optional]:** HuyRemy
|
21 |
- **Shared by [optional]:** HuyRemy
|
22 |
+
- **Model type:** Mistral
|
23 |
- **License:** [email protected]
|
24 |
|
25 |
|
26 |
### Model Sources [optional]
|
27 |
|
28 |
+
- **
|
29 |
- **Demo [optional]:** https://matilda.vn
|
30 |
|
31 |
## Uses
|
32 |
|
33 |
+
USE T4 GPU
|
34 |
+
```Python
|
35 |
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
36 |
+
!pip install --no-deps xformers trl peft accelerate bitsandbytes
|
37 |
+
```
|
38 |
### Direct Use
|
39 |
``` Python
|
40 |
from unsloth import FastLanguageModel
|
41 |
+
import torch
|
42 |
+
max_seq_length = 2048
|
43 |
+
dtype = None
|
44 |
+
load_in_4bit = True
|
45 |
+
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
46 |
+
|
47 |
+
### Instruction:
|
48 |
+
{}
|
49 |
+
|
50 |
+
### Input:
|
51 |
+
{}
|
52 |
+
|
53 |
+
### Response:
|
54 |
+
{}"""
|
55 |
+
|
56 |
+
|
57 |
+
EOS_TOKEN = tokenizer.eos_token # Must add EOS_TOKEN
|
58 |
+
def formatting_prompts_func(examples):
|
59 |
+
instructions = examples["instruction"]
|
60 |
+
inputs = examples["input"]
|
61 |
+
outputs = examples["output"]
|
62 |
+
texts = []
|
63 |
+
for instruction, input, output in zip(instructions, inputs, outputs):
|
64 |
+
# Must add EOS_TOKEN, otherwise your generation will go on forever!
|
65 |
+
text = alpaca_prompt.format(instruction, input, output) + EOS_TOKEN
|
66 |
+
texts.append(text)
|
67 |
+
return { "text" : texts, }
|
68 |
+
pass
|
69 |
+
|
70 |
model, tokenizer = FastLanguageModel.from_pretrained(
|
71 |
+
model_name = "huyremy/aichat",
|
72 |
max_seq_length = max_seq_length,
|
73 |
dtype = dtype,
|
74 |
load_in_4bit = load_in_4bit,
|
75 |
)
|
76 |
+
FastLanguageModel.for_inference(model)
|
77 |
|
78 |
inputs = tokenizer(
|
79 |
[
|
80 |
alpaca_prompt.format(
|
81 |
+
"who is Nguyễn Phú Trọng?",
|
82 |
+
"",
|
83 |
+
"",
|
84 |
),
|
85 |
], return_tensors = "pt").to("cuda")
|
86 |
|