Update README.md
Browse files
README.md
CHANGED
@@ -15,6 +15,46 @@ datasets:
|
|
15 |
- jpacifico/French-Alpaca-dataset-Instruct-110K
|
16 |
---
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
# Uploaded model
|
19 |
|
20 |
- **Developed by:** AdrienB134
|
|
|
15 |
- jpacifico/French-Alpaca-dataset-Instruct-110K
|
16 |
---
|
17 |
|
18 |
+
# How to use:
|
19 |
+
|
20 |
+
```python
|
21 |
+
from transformers import TextStreamer
|
22 |
+
from unsloth import FastLanguageModel
|
23 |
+
import torch
|
24 |
+
|
25 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
26 |
+
model_name = "AdrienB134/French-Alpaca-Croissant-1.3B-Instruct",
|
27 |
+
max_seq_length = 4096,
|
28 |
+
dtype = None,
|
29 |
+
load_in_4bit = True,
|
30 |
+
fix_tokenizer = False,
|
31 |
+
)
|
32 |
+
|
33 |
+
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.
|
34 |
+
|
35 |
+
### Instruction:
|
36 |
+
{}
|
37 |
+
|
38 |
+
### Input:
|
39 |
+
{}
|
40 |
+
|
41 |
+
### Response:
|
42 |
+
{}"""
|
43 |
+
|
44 |
+
FastLanguageModel.for_inference(model)
|
45 |
+
|
46 |
+
inputs = tokenizer(
|
47 |
+
[
|
48 |
+
alpaca_prompt.format(
|
49 |
+
"Continue la suite de Fibonnaci", # instruction
|
50 |
+
"1, 1, 2, 3, 5, 8", # input
|
51 |
+
"", # output - leave this blank for generation!
|
52 |
+
)
|
53 |
+
], return_tensors = "pt").to("cuda")
|
54 |
+
|
55 |
+
text_streamer = TextStreamer(tokenizer)
|
56 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)
|
57 |
+
```
|
58 |
# Uploaded model
|
59 |
|
60 |
- **Developed by:** AdrienB134
|