File size: 1,830 Bytes
dff7dc3 66772bf dff7dc3 66772bf dff7dc3 66772bf dff7dc3 66772bf dff7dc3 |
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 |
---
library_name: transformers
license: gemma
language:
- tr
base_model:
- google/gemma-2-9b-it
pipeline_tag: text-generation
---
# Gemma-2-9b-tr
Gemma-2-9b-tr is a finetuned version of [google/gemma-2-9b-it](https://huggingface.co./google/gemma-2-9b-it) on a carefully curated and manually filtered dataset of 55k question answering and conversational samples in Turkish.
## Training Details
**Base model:** [google/gemma-2-9b-it](https://huggingface.co./google/gemma-2-9b-it)
**Training data:** A filtered version of [metedb/turkish_llm_datasets](https://huggingface.co./datasets/metedb/turkish_llm_datasets/) and a small private dataset of 8k conversational samples on various topics.
**Training setup:** We performed supervised fine tuning with LoRA with `rank=128` and `lora_alpha`=64. Training took 4 days on a single RTX 6000 Ada.
Compared to the base model, we find Gemma-2-9b-tr has superior conversational and reasoning skills.
## Usage
You can load and use `Gemma-2-9b-tr`as follows.
```py
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"neuralwork/gemma-2-9b-tr",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("neuralwork/gemma-2-9b-tr")
messages = [
{"role": "user", "content": "Python'da bir öğenin bir listede geçip geçmediğini nasıl kontrol edebilirim?"},
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
outputs = model.generate(
tokenizer(prompt, return_tensors="pt").input_ids.to(model.device),
max_new_tokens=1024,
do_sample=True,
temperature=0.7,
top_p=0.9
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)[len(prompt):]
print(response)
```
|