Downloads · 30 days
0
itcen-entec/gemma-3-4b-tax-law-lora
gemma-3-4b-tax-law-lora is a text generation model from itcen-entec. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
🇰🇷 Korean tax-law Q/A specialized LoRA fine-tuned model based on Gemma 3 4B.
Downloads · 30 days
0
Access
Public
Updated Aug 13, 2025
Repo size
1.5 GB
Likes
0
Public
Click a slice to open those files.
.pt954 MB · 63%
From the Hugging Face model README
🇰🇷 Korean tax-law Q/A specialized LoRA fine-tuned model based on Gemma 3 4B.
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Load model and tokenizer
repo = "hongjoong-entec/gemma-3-4b-tax-law-lora"
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
tokenizer.pad_token = tokenizer.eos_token
model = AutoModelForCausalLM.from_pretrained(
repo,
torch_dtype=torch.float16,
trust_remote_code=True
)
# Prompt template for best results
prompt_style = """Below is an instruction that describes a task, paired with an input that provides further context.
Write a response that appropriately completes the request.
Respond in Korean and provide only the final answer without chain-of-thought, analysis, section headers, or disclaimers.
If needed, include a brief basis in one concise sentence.
### Question:
{}
### Response:
{}"""
# Example usage
question = "접대비 한도는 어떻게 계산하나요?"
input_text = prompt_style.format(question, "")
inputs = tokenizer([input_text], return_tensors="pt")
# Filter unwanted outputs
bad_words = ["Disclaimer:", "Chain of Thought:", "### Chain of Thought:", "### Reasoning:", "### Analysis:"]
bad_words_ids = tokenizer(bad_words, add_special_tokens=False).input_ids
# Generate response
outputs = model.generate(
input_ids=inputs.input_ids,
attention_mask=inputs.attention_mask,
max_new_tokens=1024,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id,
bad_words_ids=bad_words_ids,
temperature=0.01,
use_cache=True,
)
# Decode only generated part
gen_only = outputs[0, inputs.input_ids.shape[-1]:]
answer = tokenizer.decode(gen_only, skip_special_tokens=True).strip()
print(answer)
⚠️ Important Disclaimers:
The model demonstrates good performance on Korean tax-related queries but should be used as a starting point for research rather than definitive answers.