File size: 1,450 Bytes
6a9a664
c028d26
 
 
 
 
 
 
 
 
 
 
 
 
6a9a664
 
c028d26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88b87ed
c028d26
 
 
 
 
 
 
 
88b87ed
 
 
 
 
 
c028d26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
language:
- ja
license: apache-2.0
tags:
- text-generation-inference
- transformers
- unsloth
- trl
- mistral
datasets:
- kunishou/amenokaku-code-instruct
license_name: mistral
base_model: tokyotech-llm/Swallow-MS-7b-v0.1
---

# Uploaded  model

- **Developed by:** taoki
- **License:** apache-2.0
- **Finetuned from model :** tokyotech-llm/Swallow-MS-7b-v0.1


# Usage

```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained(
  "taoki/Swallow-MS-7b-v0.1-qlora-amenokaku-code"
)
model = AutoModelForCausalLM.from_pretrained(
  "taoki/Swallow-MS-7b-v0.1-qlora-amenokaku-code"
)

if torch.cuda.is_available():
  model = model.to("cuda")

prompt="""### Instruction:
光の三原色は?
### Response:
"""

input_ids = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
  **input_ids,
  max_new_tokens=512,
  do_sample=True,
  top_p=0.95,
  temperature=0.1,
  repetition_penalty=1.0,
)
print(tokenizer.decode(outputs[0]))
```

# Output
````
<s>### Instruction:
光の三原色は?
### Response:
 ```python
print('赤')
print('緑')
print('青')
```</s>
````

This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.

[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)