Instructions to use derogab/Sherlock-4B-QLoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use derogab/Sherlock-4B-QLoRA with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B-Instruct-2507") model = PeftModel.from_pretrained(base_model, "derogab/Sherlock-4B-QLoRA") - Transformers
How to use derogab/Sherlock-4B-QLoRA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="derogab/Sherlock-4B-QLoRA")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("derogab/Sherlock-4B-QLoRA", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use derogab/Sherlock-4B-QLoRA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "derogab/Sherlock-4B-QLoRA" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "derogab/Sherlock-4B-QLoRA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/derogab/Sherlock-4B-QLoRA
- SGLang
How to use derogab/Sherlock-4B-QLoRA 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 "derogab/Sherlock-4B-QLoRA" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "derogab/Sherlock-4B-QLoRA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "derogab/Sherlock-4B-QLoRA" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "derogab/Sherlock-4B-QLoRA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use derogab/Sherlock-4B-QLoRA with Docker Model Runner:
docker model run hf.co/derogab/Sherlock-4B-QLoRA
Sherlock-4B-QLoRA
Work in progress: This adapter is still under active development.
QLoRA adapter for structured information extraction: (JSON schema + text) โ JSON.
Missing fields become null; unrelated text is ignored.
- Base model:
Qwen/Qwen3-4B-Instruct-2507 - Training dataset:
derogab/Sherlock-Case-Files - Method: NF4 QLoRA (rank 16, alpha 32, dropout 0.05)
- Task: text-generation
Usage
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B-Instruct-2507")
model = PeftModel.from_pretrained(base, "derogab/Sherlock-4B-QLoRA")
tokenizer = AutoTokenizer.from_pretrained("derogab/Sherlock-4B-QLoRA")
Benchmark
Sherlock is evaluated against the base model on structured extraction quality. Rates are percentages; ฮ is in percentage points (higher is better). The 95% CI of ฮ is a Newcombe score interval from the aggregate counts.
| Metric | Base | Sherlock | ฮ (Sherlock โ Base) |
|---|---|---|---|
| Valid JSON | 100.0% | 100.0% | +0.0 pp |
| Schema conformance | 100.0% | 100.0% | +0.0 pp |
| Field accuracy | 95.2% | 99.1% | +3.9 pp |
| Exact match | 78.0% | 94.0% | +16.0 pp |
- Downloads last month
- 42
Model tree for derogab/Sherlock-4B-QLoRA
Base model
Qwen/Qwen3-4B-Instruct-2507