File size: 1,469 Bytes
b3e3345
 
 
 
 
 
 
 
 
 
 
 
 
7785b43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c9c9b5d
 
7785b43
 
 
b3e3345
 
 
 
 
 
 
 
 
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
---
base_model: unsloth/gemma-2-2b-it-bnb-4bit
tags:
- text-generation-inference
- transformers
- unsloth
- gemma2
- trl
license: apache-2.0
language:
- en
---

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("hiieu/gemma-2-2b-it-lora-vi-en")
tokenizer = tokenizer = AutoTokenizer.from_pretrained("hiieu/gemma-2-2b-it-lora-vi-en")
conversations = [
    [{"role": "user", "content": "Good morning everybody"}],
    [{"role": "user", "content": "Xin chào mọi người"}]
]

batch_input_ids = tokenizer.apply_chat_template(
    conversations,
    add_generation_prompt=True,
    return_tensors="pt",
    padding=True,
    truncation=True
).to(model.device)

outputs = model.generate(
    batch_input_ids,
    max_new_tokens=256,
    do_sample=True,
    temperature=0.6,
    top_p=0.9,
)

responses = outputs[:, batch_input_ids.shape[-1]:]

for response in responses:
    print(tokenizer.decode(response, skip_special_tokens=True))

>>> Chào mọi người
>>> Hello everyone
```


# Uploaded  model

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

This gemma2 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)