Instructions to use ayertiam/phi3-nl2bash-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ayertiam/phi3-nl2bash-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("microsoft/phi-3-mini-128k-instruct") model = PeftModel.from_pretrained(base_model, "ayertiam/phi3-nl2bash-lora") - Transformers
How to use ayertiam/phi3-nl2bash-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ayertiam/phi3-nl2bash-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ayertiam/phi3-nl2bash-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ayertiam/phi3-nl2bash-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ayertiam/phi3-nl2bash-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ayertiam/phi3-nl2bash-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ayertiam/phi3-nl2bash-lora
- SGLang
How to use ayertiam/phi3-nl2bash-lora 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 "ayertiam/phi3-nl2bash-lora" \ --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": "ayertiam/phi3-nl2bash-lora", "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 "ayertiam/phi3-nl2bash-lora" \ --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": "ayertiam/phi3-nl2bash-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ayertiam/phi3-nl2bash-lora with Docker Model Runner:
docker model run hf.co/ayertiam/phi3-nl2bash-lora
phi3-nl2bash-lora
This repository contains LoRA adapter weights fine-tuned on the
jiacheng-ye/nl2bash
dataset to convert natural language instructions into Linux bash commands.
⚠️ This repository contains LoRA adapters only, not the base model.
You must load these adapters on top ofmicrosoft/phi-3-mini-128k-instruct.
Intended use
The model is trained to output only valid bash commands, with no explanations.
Example
Input:
List all .txt files recursively and count lines
Output:
find . -name "*.txt" | xargs wc
Training summary
- Base model: microsoft/phi-3-mini-128k-instruct
- Fine-tuning method: LoRA (PEFT)
- Trainer: TRL SFTTrainer
- Dataset: jiacheng-ye/nl2bash
- Output format: Bash commands only
Loading example
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base_model = "microsoft/phi-3-mini-128k-instruct"
lora_model = "ayertiam/phi3-nl2bash-lora"
tokenizer = AutoTokenizer.from_pretrained(base_model, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
base_model,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
model = PeftModel.from_pretrained(model, lora_model)
model.eval()
Notes
- These adapters are model-specific and only compatible with
microsoft/phi-3-mini-128k-instruct. - For Ollama or GGUF usage, the LoRA must be merged into the base model and converted before inference as done here https://huggingface.co/ayertiam/phi3-nl2bash-gguf
- Downloads last month
- 4