|
--- |
|
license: apache-2.0 |
|
--- |
|
# Gemma 2b fine-tuned for programming & data science. |
|
|
|
![](https://raw.githubusercontent.com/kukedlc87/imagenes/main/DALL%C2%B7E%202023-12-31%2003.39.25%20-%20An%20image%20of%20a%20robot%20copywriter%20working%20in%20a%20modern%20office%20setting.%20The%20robot%20has%20a%20sleek%2C%20humanoid%20design%20with%20metallic%20surfaces%20and%20digital%20eyes%2C%20sit.png) |
|
|
|
Dataset: MagiCoder |
|
|
|
|
|
## 💻 Usage |
|
|
|
```python |
|
!pip install -qU transformers accelerate |
|
|
|
from transformers import AutoTokenizer |
|
import transformers |
|
import torch |
|
|
|
model = "Kukedlc/Gemma-2b-it-FT-Code" |
|
messages = [{"role": "user", "content": "What is a large language model?"}] |
|
|
|
tokenizer = AutoTokenizer.from_pretrained(model) |
|
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) |
|
pipeline = transformers.pipeline( |
|
"text-generation", |
|
model=model, |
|
torch_dtype=torch.float16, |
|
device_map="auto", |
|
) |
|
|
|
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95) |
|
print(outputs[0]["generated_text"]) |
|
``` |