File size: 1,777 Bytes
2e7c1b7
1226e9d
 
 
 
 
 
 
 
 
 
 
 
 
2e7c1b7
 
1226e9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
72
73
74
75
76
77
78
79
80
81
82
---
language:
- ja
license: other
tags:
- text-generation-inference
- transformers
- unsloth
- trl
- gemma
datasets:
- kunishou/amenokaku-code-instruct
license_name: gemma
base_model: unsloth/gemma-2b-it-bnb-4bit
---

# Uploaded  model

- **Developed by:** taoki
- **License:** gemma
- **Finetuned from model :** unsloth/gemma-2b-it-bnb-4bit


# Usage

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

tokenizer = AutoTokenizer.from_pretrained(
  "taoki/gemma-2b-it-qlora-amenokaku-code"
)
model = AutoModelForCausalLM.from_pretrained(
  "taoki/gemma-2b-it-qlora-amenokaku-code"
)

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

prompt="""<start_of_turn>user
紫式部と清少納言の作風をjsonで出力してください。
<end_of_turn>
<start_of_turn>model
"""

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

````
<bos><start_of_turn>user
紫式部と清少納言の作風をjsonで出力してください。<end_of_turn>
<start_of_turn>model
 ```json
{
  "紫式部": {
    "style": "紫式部",
    "name": "紫式部",
    "description": "紫式部の作風"
  },
  "清少納言": {
    "style": "清少納言",
    "name": "清少納言",
    "description": "清少納言の作風"
  }
}
```<eos>
````

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)