adeocybersecurity/DockerCommand
Viewer • Updated • 2.42k • 31 • 2
How to use junelegend/llama-3-docker-command-lora with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="junelegend/llama-3-docker-command-lora") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("junelegend/llama-3-docker-command-lora", dtype="auto")How to use junelegend/llama-3-docker-command-lora with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "junelegend/llama-3-docker-command-lora"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "junelegend/llama-3-docker-command-lora",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/junelegend/llama-3-docker-command-lora
How to use junelegend/llama-3-docker-command-lora with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "junelegend/llama-3-docker-command-lora" \
--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": "junelegend/llama-3-docker-command-lora",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "junelegend/llama-3-docker-command-lora" \
--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": "junelegend/llama-3-docker-command-lora",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use junelegend/llama-3-docker-command-lora with Unsloth Studio:
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 junelegend/llama-3-docker-command-lora to start chatting
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 junelegend/llama-3-docker-command-lora to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for junelegend/llama-3-docker-command-lora to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="junelegend/llama-3-docker-command-lora",
max_seq_length=2048,
)How to use junelegend/llama-3-docker-command-lora with Docker Model Runner:
docker model run hf.co/junelegend/llama-3-docker-command-lora
This model is finetuned on adeocybersecurity/DockerCommand dataset using the base unsloth/llama-3-8b-bnb-4bit model. These are only the lora adapaters of the model, the base model is automatically downloaded.
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "llama-3-docker-command-lora",
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
)
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
inputs = tokenizer(
[
alpaca_prompt.format(
"translate this sentence in docker command.", # instruction
"Give me a list of all containers, indicating their status as well.", # input
"", # output - leave this blank for generation!
)
], return_tensors = "pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
tokenizer.batch_decode(outputs)
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
Base model
meta-llama/Meta-Llama-3-8B