Text Generation
Transformers
Safetensors
mistral
legal
french
fine-tuned
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use delimi/Mistral_Legal with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use delimi/Mistral_Legal with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="delimi/Mistral_Legal") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("delimi/Mistral_Legal") model = AutoModelForMultimodalLM.from_pretrained("delimi/Mistral_Legal") 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 Settings
- vLLM
How to use delimi/Mistral_Legal with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "delimi/Mistral_Legal" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "delimi/Mistral_Legal", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/delimi/Mistral_Legal
- SGLang
How to use delimi/Mistral_Legal 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 "delimi/Mistral_Legal" \ --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": "delimi/Mistral_Legal", "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 "delimi/Mistral_Legal" \ --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": "delimi/Mistral_Legal", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use delimi/Mistral_Legal with Docker Model Runner:
docker model run hf.co/delimi/Mistral_Legal
Mistral Legal - French Legal Document Generator
A specialized French legal document generation model based on Mistral-7B-Instruct-v0.3.
Quick Start
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model
model = AutoModelForCausalLM.from_pretrained(
"delimi/Mistral_Legal",
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("delimi/Mistral_Legal")
# Generate legal document
prompt = \"\"\"Génère une mise en demeure pour:
**Situation**: Loyer impayé
**Montant**: 1,500 euros
**Locataire**: M. Martin
**Délai**: 15 jours
Mise en demeure:\"\"\"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_new_tokens=400,
temperature=0.7,
do_sample=True,
top_p=0.9
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Capabilities
- Mise en demeure (formal demands)
- Contracts (sales, rental, service agreements)
- Legal clauses (confidentiality, liability, etc.)
- Legal correspondence
- Template generation
Performance
- Training Loss: 1.142
- Validation Loss: 1.082
- Dataset: 541 French legal examples
- Method: LoRA fine-tuning + merge
Legal Disclaimer
This model is for assistance purposes only. All generated content should be reviewed by qualified legal professionals before use.
Technical Details
- Base: mistralai/Mistral-7B-Instruct-v0.3
- Parameters: 7B
- Language: French
- Domain: Legal documents
- License: Apache 2.0
Usage Examples
Mise en demeure
Génère une mise en demeure pour un loyer impayé de 2,400 euros depuis 3 mois.
Contract Generation
Rédige un contrat de vente pour une voiture Peugeot 208 au prix de 15,000 euros.
Legal Clauses
Crée une clause de confidentialité pour un accord commercial d'une durée de 2 ans.
Model created by AIAJ team - {datetime.now().strftime('%B %Y')}
- Downloads last month
- 4
Model tree for delimi/Mistral_Legal
Base model
mistralai/Mistral-7B-v0.3 Finetuned
mistralai/Mistral-7B-Instruct-v0.3Evaluation results
- ROUGE-1self-reported0.350