messages listlengths 2 2 |
|---|
[
{
"role": "user",
"content": "Jurisdiction: CA\n\nTranscript:\nOFFICER: Good evening. License and registration please.\nUSER: Sure, one moment.\nOFFICER: Do you know why I pulled you over tonight?\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionab... |
[
{
"role": "user",
"content": "Jurisdiction: CA\n\nTranscript:\nOFFICER: License and registration.\nUSER: Here you go.\nOFFICER: I'd like to search your vehicle. Mind stepping out?\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
... |
[
{
"role": "user",
"content": "Jurisdiction: CA\n\nTranscript:\nOFFICER: Have you had anything to drink tonight?\nUSER: I had one beer with dinner.\nOFFICER: I smell alcohol. Step out for field sobriety tests.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and prov... |
[
{
"role": "user",
"content": "Jurisdiction: CA\n\nTranscript:\nOFFICER: You're under arrest for DUI.\nUSER: What? No.\nOFFICER: You need to submit to a breathalyzer right now.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
{
... |
[
{
"role": "user",
"content": "Jurisdiction: CA\n\nTranscript:\nOFFICER: Stay here while I run your plates.\nUSER: Am I being detained or am I free to go?\nOFFICER: I said stay put.\nUSER: Officer, am I legally being detained?\n\nPlease provide legal guidance for this police interaction. Classify the situati... |
[
{
"role": "user",
"content": "Jurisdiction: CA\n\nTranscript:\nOFFICER: I need ID from everyone in the vehicle.\nUSER: I'm the passenger.\nOFFICER: Doesn't matter. ID now.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
{
... |
[
{
"role": "user",
"content": "Jurisdiction: CA\n\nTranscript:\nOFFICER: Put that phone away. Stop recording me.\nUSER: I have the right to record in public.\nOFFICER: I'm telling you to put it away now.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide ac... |
[
{
"role": "user",
"content": "Jurisdiction: CA\n\nTranscript:\nOFFICER: GET OUT OF THE CAR. NOW.\nUSER: Okay, okay, I'm getting out.\nOFFICER: HANDS WHERE I CAN SEE THEM.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
{
"... |
[
{
"role": "user",
"content": "Jurisdiction: CA\n\nTranscript:\nOFFICER: You're under arrest. Hands behind your back.\nUSER: What am I being arrested for?\nOFFICER: You have the right to remain silent.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide acti... |
[
{
"role": "user",
"content": "Jurisdiction: CA\n\nTranscript:\nOFFICER: Blow into this preliminary breath test device.\nUSER: Do I have to?\nOFFICER: It's just a screening device.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
... |
[
{
"role": "user",
"content": "Jurisdiction: FL\n\nTranscript:\nOFFICER: License, registration, insurance.\nUSER: Here you go officer.\nOFFICER: Where are you headed tonight?\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
{
... |
[
{
"role": "user",
"content": "Jurisdiction: FL\n\nTranscript:\nOFFICER: Roll down your window all the way.\nUSER: I'd prefer not to fully lower it.\nOFFICER: Roll it all the way down or you're getting a ticket.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and pr... |
[
{
"role": "user",
"content": "Jurisdiction: FL\n\nTranscript:\nOFFICER: You've been drinking. Blow into this.\nUSER: Do I have to?\nOFFICER: Florida implied consent — refuse and lose your license.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionab... |
[
{
"role": "user",
"content": "Jurisdiction: FL\n\nTranscript:\nOFFICER: I'm going to need to search your vehicle.\nUSER: Why?\nOFFICER: Routine check. Pop the trunk.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
{
"role"... |
[
{
"role": "user",
"content": "Jurisdiction: FL\n\nTranscript:\nOFFICER: I see you've refused a breathalyzer before.\nUSER: I'm refusing again.\nOFFICER: That's an 18-month suspension for a second refusal.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide ... |
[
{
"role": "user",
"content": "Jurisdiction: TX\n\nTranscript:\nOFFICER: License, registration. State your name.\nUSER: Mark Gentry. Here's my license.\nOFFICER: Date of birth and address.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice... |
[
{
"role": "user",
"content": "Jurisdiction: TX\n\nTranscript:\nOFFICER: You're refusing the breathalyzer?\nUSER: Yes, I'm refusing.\nOFFICER: This is a no-refusal county. We'll get a warrant for a blood draw.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and prov... |
[
{
"role": "user",
"content": "Jurisdiction: TX\n\nTranscript:\nOFFICER: Reports of suspicious activity. Mind if I look in your car?\nUSER: Is that required?\nOFFICER: It would really help us out.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionabl... |
[
{
"role": "user",
"content": "Jurisdiction: TX\n\nTranscript:\nOFFICER: I need you to wait here with me.\nUSER: Am I free to go?\nOFFICER: No. Wait here.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
{
"role": "assistant... |
[
{
"role": "user",
"content": "Jurisdiction: TX\n\nTranscript:\nOFFICER: I'm tired of your attitude. Get out of the car.\nUSER: I haven't done anything wrong.\nOFFICER: OUT. NOW. Or I'm pulling you out.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide act... |
[
{
"role": "user",
"content": "Jurisdiction: NY\n\nTranscript:\nOFFICER: License and registration.\nUSER: Here you go.\nOFFICER: You know you were going 45 in a 30?\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
{
"role": ... |
[
{
"role": "user",
"content": "Jurisdiction: NY\n\nTranscript:\nOFFICER: Blow into this breathalyzer.\nUSER: I don't want to.\nOFFICER: Refusal means automatic license revocation in New York.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable adv... |
[
{
"role": "user",
"content": "Jurisdiction: NY\n\nTranscript:\nOFFICER: Can I take a look in your vehicle?\nUSER: Do I have to?\nOFFICER: I'd like your cooperation.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
{
"role":... |
[
{
"role": "user",
"content": "Jurisdiction: NY\n\nTranscript:\nOFFICER: Are you recording me?\nUSER: Yes.\nOFFICER: You need to stop that right now.\n\nPlease provide legal guidance for this police interaction. Classify the situation state and provide actionable advice."
},
{
"role": "assistant",
... |
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
MyGuardian Guidance AI — HF Spaces Deployment
Fine-tuned causal reasoning model for real-time police interaction legal guidance.
Project Structure
myguardian-hf-spaces/
├── app.py # Gradio app for inference
├── train_data.jsonl # Training examples (24)
├── eval_data.jsonl # Eval examples (7)
├── prepare_finetuning_dataset.py # Dataset generation
├── requirements.txt
└── README.md
Quick Start
1. Install Dependencies
pip install -r requirements.txt
2. Run Locally (with base model)
python3 app.py
Open http://localhost:7860 in your browser.
Fine-tuning
Option A: Use HF AutoTrain (Recommended for limited budget)
Upload training data to HF Hub:
huggingface-cli repo create myguardian-guidance --type dataset huggingface-cli upload huggingface_username/myguardian-guidance \ train_data.jsonl eval_data.jsonl .Create AutoTrain project:
- Go to https://huggingface.co/autotrain
- Create new project → "Language Model Fine-tuning"
- Select dataset:
huggingface_username/myguardian-guidance - Base model:
Qwen/Qwen2.5-7B - Training params:
- Learning rate: 1e-4
- Num epochs: 3
- Batch size: 4
- LoRA (for memory efficiency)
- Start training
Once complete, get the model URL from AutoTrain and update
app.py:MODEL_NAME = "huggingface_username/myguardian-guidance"
Option B: Local Fine-tuning (for testing)
from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, Trainer
from datasets import load_dataset
# Load data
dataset = load_dataset('json', data_files={
'train': 'train_data.jsonl',
'eval': 'eval_data.jsonl'
})
# Load model
model_name = "Qwen/Qwen2.5-7B"
model = AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Training arguments
args = TrainingArguments(
output_dir="./myguardian-guidance",
num_train_epochs=3,
learning_rate=1e-4,
per_device_train_batch_size=4,
per_device_eval_batch_size=4,
evaluation_strategy="epoch",
save_strategy="epoch",
logging_steps=10,
)
# Train
trainer = Trainer(
model=model,
args=args,
train_dataset=dataset['train'],
eval_dataset=dataset['eval'],
)
trainer.train()
Deployment to HF Spaces
1. Create HF Spaces Repo
huggingface-cli repo create myguardian-guidance --type space --space-sdk gradio
cd ~/my-spaces-clones/myguardian-guidance
2. Push Code
git add app.py requirements.txt
git commit -m "Initial commit"
git push
HF Spaces will automatically build and run the app.
3. Update Model Name
In app.py, change:
MODEL_NAME = "huggingface_username/myguardian-guidance"
The model will be downloaded on first load.
Cost Estimates
- Local fine-tuning: $0 (uses your machine)
- HF AutoTrain (8B model, 3 epochs): ~$30-50
- Inference on HF Spaces (free tier): Free (respects rate limits)
Total budget: $40-80 ✓
Test Harness
The 31 test scenarios achieve 87% accuracy with the original guardian_api.py (using GPT-4).
To evaluate the fine-tuned model, compare its output against test scenarios in:
~/Desktop/myguardian_demo/test_harness.py
Expected outputs should match:
- STATE: Correct situation classification
- SAY: Actionable, jurisdiction-specific advice
- AVOID: Common legal mistakes
- OPTIONS: Causal reasoning (if X, then Y)
Notes
- Model: Qwen2.5-7B (7B parameters, fast, good for mobile)
- Training data: 31 real police interaction scenarios
- Temperature: 0.3 (deterministic for safety)
- Max tokens: 500 (keeps responses concise)
- No hallucination penalties — focus on causal accuracy
Next Steps
- ✓ Prepare training data from test scenarios
- ⚠️ Fine-tune on HF or locally
- ⚠️ Evaluate against test harness
- ⚠️ Deploy to HF Spaces
- ⚠️ Share URL with CEO for feedback
License
Internal TunedAI Labs / MyGuardian. See licensing agreement.
- Downloads last month
- 30