Text Generation
Transformers
Safetensors
Polish
gemma3
image-text-to-text
polish
law
civil-code
gemma
fine-tuned
conversational
text-generation-inference
Instructions to use keeeeesz/gemma-civil-code-pl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use keeeeesz/gemma-civil-code-pl with Transformers:
# 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("keeeeesz/gemma-civil-code-pl") model = AutoModelForImageTextToText.from_pretrained("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?"} ] }, ] 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use keeeeesz/gemma-civil-code-pl with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "keeeeesz/gemma-civil-code-pl" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "keeeeesz/gemma-civil-code-pl", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/keeeeesz/gemma-civil-code-pl
- SGLang
How to use keeeeesz/gemma-civil-code-pl with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "keeeeesz/gemma-civil-code-pl" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "keeeeesz/gemma-civil-code-pl", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "keeeeesz/gemma-civil-code-pl" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "keeeeesz/gemma-civil-code-pl", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use keeeeesz/gemma-civil-code-pl with Docker Model Runner:
docker model run hf.co/keeeeesz/gemma-civil-code-pl
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
- 4