Downloads · 30 days
0
Rootpye/Kolaw-1.5
Kolaw-1.5 is a text generation model from Rootpye. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
This model is a fine-tuned version of google/gemma-2-2b specifically trained on Korean legal documents and statutes. It has been optimized to understand and generate responses related to Korean law, legal terminology,…
Downloads · 30 days
0
Access
Public
Updated Sep 17, 2025
Repo size
98.7 MB
Likes
1
Public
Click a slice to open those files.
.safetensors41.6 MB · 42%
From the Hugging Face model README
This model is a fine-tuned version of google/gemma-2-2b specifically trained on Korean legal documents and statutes. It has been optimized to understand and generate responses related to Korean law, legal terminology, and judicial concepts.
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
# Load base model and tokenizer
model_name = "your-username/gemma-2-2b-korean-law"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto",
attn_implementation='eager'
)
def generate_legal_response(prompt, max_length=256):
# Format the prompt
formatted_prompt = f"### 질문: {prompt}\n\n### 답변:"
# Tokenize
inputs = tokenizer.encode(formatted_prompt, return_tensors='pt')
# Generate
with torch.no_grad():
outputs = model.generate(
inputs,
max_length=len(inputs[0]) + max_length,
num_return_sequences=1,
temperature=0.7,
do_sample=True,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id
)
# Decode and return
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response.split("### 답변:")[-1].strip()
# Example usage
question = "민법에서 계약의 성립 요건에 대해 설명해주세요."
answer = generate_legal_response(question)
print(answer)
The model works best with the following prompt format:
### 질문: [Your legal question in Korean]
### 답변: [Model's response will be generated here]
The model has been trained to:
Note: This model is for educational and informational purposes only. It should not be used as a substitute for professional legal advice.
If you use this model in your research or applications, please cite:
@model{Kolaw-1.5,
title={Kolaw-1.5},
author={[Rootpye]},
year={2025},
publisher={Rootpye},
url={https://huggingface.co/Rootpye/Kolaw-1.5}
}
For questions, issues, or collaborations, please:
Disclaimer: This model is provided "as is" without warranties. Users are responsible for ensuring compliance with applicable laws and regulations when using this model.