Text Generation
Transformers
Safetensors
English
llama
lora
docker
conversational
text-generation-inference
Instructions to use thefabdev/llama-3-docker-ft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thefabdev/llama-3-docker-ft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="thefabdev/llama-3-docker-ft") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("thefabdev/llama-3-docker-ft") model = AutoModelForCausalLM.from_pretrained("thefabdev/llama-3-docker-ft", 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 thefabdev/llama-3-docker-ft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thefabdev/llama-3-docker-ft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thefabdev/llama-3-docker-ft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/thefabdev/llama-3-docker-ft
- SGLang
How to use thefabdev/llama-3-docker-ft 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 "thefabdev/llama-3-docker-ft" \ --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": "thefabdev/llama-3-docker-ft", "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 "thefabdev/llama-3-docker-ft" \ --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": "thefabdev/llama-3-docker-ft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use thefabdev/llama-3-docker-ft with Docker Model Runner:
docker model run hf.co/thefabdev/llama-3-docker-ft
File size: 3,346 Bytes
08bb08b 20c36a5 08bb08b 20c36a5 08bb08b 20c36a5 08bb08b 20c36a5 08bb08b 20c36a5 08bb08b 20c36a5 08bb08b 20c36a5 08bb08b 20c36a5 08bb08b 20c36a5 08bb08b 20c36a5 08bb08b 20c36a5 08bb08b 20c36a5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | ---
library_name: transformers
base_model: meta-llama/Meta-Llama-3-8B-Instruct
license: llama3
datasets:
- MattCoddity/dockerNLcommands
language:
- en
tags:
- lora
- docker
- text-generation
pipeline_tag: text-generation
---
# llama-3-docker-ft
LoRA fine-tune of `meta-llama/Meta-Llama-3-8B-Instruct` that translates natural-language
requests into Docker CLI commands. Merged adapter weights (base + LoRA), not an
adapter-only checkpoint.
This is a learning-lab artifact ([source notebook and writeup](https://github.com/Fakorede/llm-alignment-lab/tree/main/01_lora_sft)),
not a production model. Treat it as a first fine-tuning exercise, not a benchmarked release.
## Model Details
- **Base model:** `meta-llama/Meta-Llama-3-8B-Instruct`, loaded in 8-bit (`BitsAndBytesConfig(load_in_8bit=True)`)
- **Fine-tuning method:** LoRA (`peft`), `r=16`, `lora_alpha=32`, dropout `0.05`,
targeting `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj`
(41.9M trainable params, 0.52% of 8.07B total)
- **Merged:** LoRA adapter merged into the base weights before push (`merge_and_unload()`)
- **License:** inherits the [Llama 3 Community License](https://llama.meta.com/llama3/license/) from the base model
## Training Data
[`MattCoddity/dockerNLcommands`](https://huggingface.co/datasets/MattCoddity/dockerNLcommands),
an instruction/input/output dataset pairing natural-language requests with the
corresponding Docker CLI command. Split 80/20 train/validation (seed 42).
## Training Procedure
`transformers.Trainer` + `TrainingArguments`: batch size 2, gradient accumulation 4
(effective batch size 8), `paged_adamw_8bit`, learning rate `2e-4`, 2 epochs (484 steps),
fp16, warmup steps 5, weight decay 0.01.
### Results
| Metric | Value |
|---|---|
| Train loss (last logged step) | 0.307 |
| Train loss (run average) | 0.461 |
| Eval loss | 0.341 |
| Train runtime | ~2738s (single A100 80GB) |
## Uses
**Intended use:** translating short, single-turn natural-language instructions about
containers/images into a Docker CLI command. Example:
\`\`\`python
import transformers
import torch
pipeline = transformers.pipeline(
"text-generation",
model="thefabdev/llama-3-docker-ft",
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
messages = [
{"role": "system", "content": "You are a helpful assistant. Translate this sentence in docker command"},
{"role": "user", "content": "Display the information of the last 4 containers."},
]
result = pipeline(messages, max_new_tokens=256, temperature=0.25, top_p=1, repetition_penalty=1.2)
print(result[0]["generated_text"][-1]["content"])
# docker ps --last 4
\`\`\`
**Out of scope:** general-purpose assistant use, multi-turn conversation, any
command generation where correctness/safety of the resulting shell command isn't
independently verified before execution. Generated commands are not validated for
safety and should not be run against production systems without review.
## Limitations
- Fine-tuned on a single small, narrow dataset (Docker CLI only), will not generalize
to other CLIs or general instruction-following.
- Trained for 2 epochs on ~800 examples; not evaluated against a held-out benchmark
beyond the validation split loss above.
- No safety/red-teaming evaluation has been performed on this model. |