Update README.md
Browse files
README.md
CHANGED
|
@@ -15,53 +15,53 @@ language:
|
|
| 15 |
# Model Trained By Meforgers
|
| 16 |
*This model was trained by Meforgers for the futuristic projects.*
|
| 17 |
|
| 18 |
-
# *Firstly*
|
| 19 |
-
- Need to install packages
|
| 20 |
|
| 21 |
|
| 22 |
-
# *Usage*
|
| 23 |
|
| 24 |
-
```python
|
| 25 |
-
from unsloth import FastLanguageModel
|
| 26 |
-
import torch
|
| 27 |
-
|
| 28 |
-
# Variable side
|
| 29 |
-
max_seq_length = 512
|
| 30 |
-
dtype = torch.float16
|
| 31 |
-
load_in_4bit = True
|
| 32 |
-
|
| 33 |
-
# Alpaca prompt
|
| 34 |
-
alpaca_prompt = """### Instruction:
|
| 35 |
-
{0}
|
| 36 |
-
|
| 37 |
-
### Input:
|
| 38 |
-
{1}
|
| 39 |
-
|
| 40 |
-
### Response:
|
| 41 |
-
{2}
|
| 42 |
-
"""
|
| 43 |
-
|
| 44 |
-
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
)
|
| 50 |
-
|
| 51 |
-
FastLanguageModel.for_inference(model)
|
| 52 |
-
|
| 53 |
-
inputs = tokenizer(
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
).to("cuda")
|
| 63 |
-
|
| 64 |
-
outputs = model.generate(**inputs, max_new_tokens=128, use_cache=True)
|
| 65 |
-
print(tokenizer.batch_decode(outputs))
|
| 66 |
-
|
| 67 |
-
```
|
|
|
|
| 15 |
# Model Trained By Meforgers
|
| 16 |
*This model was trained by Meforgers for the futuristic projects.*
|
| 17 |
|
| 18 |
+
- # *Firstly*
|
| 19 |
+
- Need to install packages
|
| 20 |
|
| 21 |
|
| 22 |
+
- # *Usage*
|
| 23 |
|
| 24 |
+
```python
|
| 25 |
+
from unsloth import FastLanguageModel
|
| 26 |
+
import torch
|
| 27 |
+
|
| 28 |
+
# Variable side
|
| 29 |
+
max_seq_length = 512
|
| 30 |
+
dtype = torch.float16
|
| 31 |
+
load_in_4bit = True
|
| 32 |
+
|
| 33 |
+
# Alpaca prompt
|
| 34 |
+
alpaca_prompt = """### Instruction:
|
| 35 |
+
{0}
|
| 36 |
+
|
| 37 |
+
### Input:
|
| 38 |
+
{1}
|
| 39 |
+
|
| 40 |
+
### Response:
|
| 41 |
+
{2}
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 45 |
+
model_name="Meforgers/Aixr",
|
| 46 |
+
max_seq_length=max_seq_length,
|
| 47 |
+
dtype=dtype,
|
| 48 |
+
load_in_4bit=load_in_4bit,
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
FastLanguageModel.for_inference(model)
|
| 52 |
+
|
| 53 |
+
inputs = tokenizer(
|
| 54 |
+
[
|
| 55 |
+
alpaca_prompt.format(
|
| 56 |
+
"Can u text me basic python code?", # instruction side (You need to change that side)
|
| 57 |
+
"", # input
|
| 58 |
+
"", # output - leave this blank for generation!
|
| 59 |
+
)
|
| 60 |
+
],
|
| 61 |
+
return_tensors="pt"
|
| 62 |
+
).to("cuda")
|
| 63 |
+
|
| 64 |
+
outputs = model.generate(**inputs, max_new_tokens=128, use_cache=True)
|
| 65 |
+
print(tokenizer.batch_decode(outputs))
|
| 66 |
+
|
| 67 |
+
```
|