Instructions to use David33706/Llama-3.1-8B-Osuda-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use David33706/Llama-3.1-8B-Osuda-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="David33706/Llama-3.1-8B-Osuda-v1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("David33706/Llama-3.1-8B-Osuda-v1") model = AutoModelForCausalLM.from_pretrained("David33706/Llama-3.1-8B-Osuda-v1", device_map="auto") 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 David33706/Llama-3.1-8B-Osuda-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "David33706/Llama-3.1-8B-Osuda-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "David33706/Llama-3.1-8B-Osuda-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/David33706/Llama-3.1-8B-Osuda-v1
- SGLang
How to use David33706/Llama-3.1-8B-Osuda-v1 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 "David33706/Llama-3.1-8B-Osuda-v1" \ --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": "David33706/Llama-3.1-8B-Osuda-v1", "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 "David33706/Llama-3.1-8B-Osuda-v1" \ --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": "David33706/Llama-3.1-8B-Osuda-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use David33706/Llama-3.1-8B-Osuda-v1 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 David33706/Llama-3.1-8B-Osuda-v1 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 David33706/Llama-3.1-8B-Osuda-v1 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for David33706/Llama-3.1-8B-Osuda-v1 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="David33706/Llama-3.1-8B-Osuda-v1", max_seq_length=2048, ) - Docker Model Runner
How to use David33706/Llama-3.1-8B-Osuda-v1 with Docker Model Runner:
docker model run hf.co/David33706/Llama-3.1-8B-Osuda-v1
Osuda — a length-calibrated psychology assistant
Built with Llama
A QLoRA fine-tune of Llama 3.1 8B Instruct that answers like a counselor — short, warm, and directive — instead of producing a numbered listicle.
The headline result is not accuracy. It is style control: the base model answered a 44-word reference with 193 words. After fine-tuning, 42.
- Developed by: David33706
- Finetuned from:
unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit - Training data:
samhog/psychology-10k - Code, evaluation pipeline and full write-up: https://github.com/David33706/osuda
Results
Held-out sample of 100 examples (random_state=42). Both models decoded identically
(max_new_tokens=256, temperature=1.0, min_p=0.1, do_sample=True) with no system prompt.
| Metric | Base Llama 3.1 8B | Osuda | Change |
|---|---|---|---|
| ROUGE-1 | 0.2316 | 0.4385 | +89% |
| ROUGE-2 | 0.0679 | 0.1820 | +168% |
| ROUGE-L | 0.1443 | 0.3133 | +117% |
| BERTScore F1 | 0.8587 | 0.9139 | +0.055 |
| Avg length (words) | 193.2 | 42.3 | reference: 43.6 |
Training configuration
| Setting | Value |
|---|---|
| Method | QLoRA (4-bit NF4) via Unsloth |
Rank r |
16 |
lora_alpha |
16 |
lora_dropout |
0 |
use_rslora |
true |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Max sequence length | 2048 |
Note use_rslora=true scales updates by alpha/√r rather than alpha/r — with
alpha=16, r=16 that is an effective factor of 4.0, not 1.0.
Limitations
Read these before citing the numbers.
- ROUGE rewards length matching. The base model wrote ~4.5× the reference length, which depresses its precision regardless of content quality. A large share of the ROUGE gain is length calibration, not new knowledge. BERTScore (+0.055) is the less length-sensitive signal and its gain is far more modest.
- The baseline is unprompted. Neither model received a system prompt, so this measures fine-tuning against a zero-shot default rather than a prompt-engineered baseline. A base model told "answer in 2–3 sentences as a counselor" would close much of this gap. That control has not been run.
- Base responses are truncated at
max_new_tokens=256, so 193.2 words is a floor and the 4.5× ratio is a lower bound. - n = 100, single run, no confidence intervals, stochastic decoding with no generation seed. Treat differences as directional.
- Not a clinical tool. No safety, crisis-handling, or clinician evaluation was performed. Do not deploy to people in distress.
License
This model is a derivative of Meta's Llama 3.1 and is licensed under the
Llama 3.1 Community License,
included in this repository as LICENSE.
Llama 3.1 is licensed under the Llama 3.1 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.
Use is additionally subject to the Llama 3.1 Acceptable Use Policy.
- Downloads last month
- 6