Any-to-Any
Transformers
Safetensors
Indonesian
English
gemma4
image-text-to-text
legal
indonesian
conversational
Instructions to use Legal-verse/InaVerdict-gemma-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Legal-verse/InaVerdict-gemma-v2 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Legal-verse/InaVerdict-gemma-v2") model = AutoModelForMultimodalLM.from_pretrained("Legal-verse/InaVerdict-gemma-v2", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
InaVerdict Gemma v2
InaVerdict Gemma v2 is a fine-tuned Gemma 4 E2B instruction model for Indonesian legal research and judgment analysis.
Usage
Use a recent version of Transformers with Gemma 4 support.
import torch
from transformers import AutoModelForMultimodalLM, AutoProcessor
model_id = "Legal-verse/InaVerdict-gemma-v2"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForMultimodalLM.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Jelaskan perbedaan ratio decidendi dan obiter dictum.",
}
],
}
]
inputs = processor.apply_chat_template(
messages,
tokenize=True,
return_dict=True,
return_tensors="pt",
add_generation_prompt=True,
).to(model.device)
input_length = inputs["input_ids"].shape[-1]
with torch.inference_mode():
output_ids = model.generate(**inputs, max_new_tokens=256)
print(
processor.tokenizer.decode(
output_ids[0, input_length:],
skip_special_tokens=True,
)
)
Hosted demo and API
A ZeroGPU playground and Gradio API are available at Haeryz/inaverdict-gemma-v2-api.
Intended use
This model is intended to assist with Indonesian legal research, document analysis, and drafting. Its output is not legal advice. Verify citations, quotations, and conclusions against primary legal sources.
- Downloads last month
- 94
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support