Instructions to use Azzindani/Deepseek_ID_Legal_Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Azzindani/Deepseek_ID_Legal_Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Azzindani/Deepseek_ID_Legal_Preview") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Azzindani/Deepseek_ID_Legal_Preview") model = AutoModelForCausalLM.from_pretrained("Azzindani/Deepseek_ID_Legal_Preview") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Azzindani/Deepseek_ID_Legal_Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Azzindani/Deepseek_ID_Legal_Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Azzindani/Deepseek_ID_Legal_Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Azzindani/Deepseek_ID_Legal_Preview
- SGLang
How to use Azzindani/Deepseek_ID_Legal_Preview 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 "Azzindani/Deepseek_ID_Legal_Preview" \ --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": "Azzindani/Deepseek_ID_Legal_Preview", "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 "Azzindani/Deepseek_ID_Legal_Preview" \ --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": "Azzindani/Deepseek_ID_Legal_Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use Azzindani/Deepseek_ID_Legal_Preview with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Azzindani/Deepseek_ID_Legal_Preview to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Azzindani/Deepseek_ID_Legal_Preview to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Azzindani/Deepseek_ID_Legal_Preview to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Azzindani/Deepseek_ID_Legal_Preview", max_seq_length=2048, ) - Docker Model Runner
How to use Azzindani/Deepseek_ID_Legal_Preview with Docker Model Runner:
docker model run hf.co/Azzindani/Deepseek_ID_Legal_Preview
🧠 DeepSeek-R1-0528-Qwen3-8B Instruct Fine-Tuned with GRPO on Indonesian Legal QA Dataset
Welcome! This repository hosts a fine-tuned version of DeepSeek-R1-0528-Qwen3-8B using Group Relative Policy Optimization (GRPO), trained on a custom Indonesian Legal Q&A Dataset. The goal is to enhance the model's reasoning and structured thinking capabilities for legal question-answering tasks. You can try the demo here
🚀 Model Summary
- Purpose: Research and Development
- Base Model: DeepSeek-R1-0528-Qwen3-8B
- Language: Bahasa Indonesia 🇮🇩
- Domain: Legal / Law (Q&A format)
- Purpose: Boost performance in structured, legal reasoning under Indonesian legal context
🏋️ Training Summary
- Fine-tuning Method: Group Relative Policy Optimization (GRPO) combined with Knowledge Distillation
- Pipeline: Cloud to Cloud training
- Dataset: Indonesian Legal Questions and Answers pertanyaan hukum
- Compute: Nvidia RTX6000 Ada
- Provider: vast.ai
- Training Steps: 2000
- Number of Generation: 16
- Cost: 50 USD
- Distilled Knowledge: DeepSeek_0528_8B_Legal_Distill
🧩 What is GRPO?
Group Relative Policy Optimization (GRPO) is an advanced reinforcement learning fine-tuning technique that:
- Groups samples by difficulty or topic (e.g., legal concepts)
- Encourages policies (model outputs) to optimize within their group context
- Promotes structured and relative improvements, not just raw accuracy
This method leads to:
- Better structured answers
- Improved logical flow
- Greater consistency in domain-specific reasoning (e.g., answering legal queries with relevant laws and regulations)
🧠 Structured Thinking Enabled
The fine-tuned model is trained to think in steps using GRPO:
- Understand the legal context
- Identify the relevant law
- Apply reasoning with facts
- Summarize the legal conclusion clearly
This mimics how law students or practitioners approach legal cases, making the model suitable for:
- Law education
- Legal chatbot assistants
- Indonesian legal exam prep
💻 How to Use
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
# Load the tokenizer and model
model_name = 'Azzindani/Deepseek_ID_Legal_Preview'
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map = 'auto', torch_dtype = torch.float16)
SYSTEM_PROMPT = '''
Anda adalah asisten AI yang ahli di bidang hukum Indonesia. Anda dapat membantu konsultasi hukum, menjawab pertanyaan, dan memberikan analisis berdasarkan peraturan perundang-undangan yang relevan.
Untuk setiap respons, Anda harus berfikir dan menjawab dengan Bahasa Indonesia, serta gunakan format:
<think>
...
</think>
Tuliskan jawaban akhir secara jelas, ringkas, profesional, dan berempati jika diperlukan. Gunakan bahasa hukum yang mudah dipahami. Sertakan referensi hukum Indonesia yang relevan. Selalu rekomendasikan konsultasi dengan ahli hukum untuk keputusan final.
'''
prompt = '''
Adakah hukumnya yang mengatur pembagian persentase/laba dalam mendirikan suatu perusahaan?
Dan berapa persenkah yang didapat oleh si pemilik ide untuk mendirikan perusahaan,
jika dia tidak menyetor modal sedikit pun atau hanya menjalankan saja?
'''
conversation = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "Apa dasar hukum pemecatan PNS di Indonesia?"}
]
input_ids = tokenizer.apply_chat_template([
{'role' : 'system', 'content' : SYSTEM_PROMPT},
{'role' : 'user', 'content' : prompt}],
tokenize = True,
add_generation_prompt = True,
return_tensors = 'pt'
).to(model.device)
streamer = TextStreamer(tokenizer, skip_prompt = True, skip_special_tokens = True)
result = model.generate(
input_ids,
streamer = streamer,
max_new_tokens = 2048,
do_sample = True,
temperature = 0.7,
min_p = 0.1,
top_p = 1.0,
top_k = 20
)
🤝 Acknowledgements
- Downloads last month
- 1