How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="keeeeesz/gemma-civil-code-pl")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
            {"type": "text", "text": "What animal is on the candy?"}
        ]
    },
]
pipe(text=messages)
# Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM

processor = AutoProcessor.from_pretrained("keeeeesz/gemma-civil-code-pl")
model = AutoModelForMultimodalLM.from_pretrained("keeeeesz/gemma-civil-code-pl", device_map="auto")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
            {"type": "text", "text": "What animal is on the candy?"}
        ]
    },
]
inputs = processor.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=40)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

gemma-civil-code-pl

Model Gemma 3 (4B) dostrojony do wiedzy z Kodeksu Cywilnego, odpowiadający na pytania prawne

Opis modelu

Model bazuje na Gemma 3 (4B) i został dostrojony do odpowiadania na pytania dotyczące Kodeksu Cywilnego. Wykorzystano dane z artykułów Kodeksu Cywilnego wraz z interpretacjami i przykładami zastosowania.

Przykładowe użycie

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

# Załaduj model i tokenizer
model_name = "keeeeesz/gemma-civil-code-pl"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.float16,
    device_map="auto",
)

# Formatuj pytanie w formacie chatowym
def format_prompt(pytanie):
    return f"<start_of_turn>user\n{pytanie}<end_of_turn>"

# Generuj odpowiedź
pytanie = "Co stanowi artykuł 5 Kodeksu cywilnego?"
prompt = format_prompt(pytanie)

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
    **inputs,
    max_new_tokens=512,
    do_sample=True,
    temperature=0.7,
    top_p=0.9,
)

# Wyodrębnij odpowiedź
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Downloads last month
12
Safetensors
Model size
4B params
Tensor type
F16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for keeeeesz/gemma-civil-code-pl

Finetuned
(747)
this model