Downloads · 30 days
13
14% of all-time downloads
alpecevit/turkish-gemma-2-9b-it
turkish-gemma-2-9b-it is a text generation model from alpecevit. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as gemma.
You can use the following code snippet to use the model:
Downloads · 30 days
13
14% of all-time downloads
All-time downloads
92
Public
Parameters
9.2B
18.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors18.5 GB · 100%
From the Hugging Face model README
You can use the following code snippet to use the model:
import transformers
import torch
model_id = "alpecevit/turkish-gemma-2-9b-it"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"dtype": torch.bfloat16},
device_map="auto",
)
pipeline.model.eval()
instruction = "Python'da sırt çantası (knapsack) problemi nasıl çözülür?"
messages = [
{"role": "user", "content": instruction}
]
prompt = pipeline.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
terminators = [
pipeline.tokenizer.eos_token_id,
pipeline.tokenizer.convert_tokens_to_ids("<end_of_turn>")
]
outputs = pipeline(
prompt,
max_new_tokens=512,
eos_token_id=terminators,
do_sample=True,
temperature=0.9,
)
print(outputs[0]["generated_text"][len(prompt):])