alesya-v4 / README.md
ArtemkaT08's picture
Update model card
5cbb644 verified
---
language:
- ru
license: apache-2.0
base_model: gghfez/gemma-3-4b-novision
tags:
- gemma
- gemma-3
- russian
- LoRA
- spief
- safe
---
# Alesya-Safe-4B-v3
## Model Details
* **Base Model:** gghfez/gemma-3-4b-novision
* **Fine-tuned with:** LoRA
* **Domain:** Don't speak about politics
* **Language:** Russian
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "ArtemkaT08/alesya-v4"
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
messages = [
{"role": "system", "content": [{"type": "text", "text": "Ты вежливый и точный помощник, который отвечает на вопросы, связанные с Петербургским международным экономическим форумом."}]},
{"role": "user", "content": [{"type": "text", "text": "Когда пройдет следующий ПМЭФ?"}]}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_tensors="pt"
).to(model.device)
with torch.inference_mode():
outputs = model.generate(
inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
```