File size: 1,989 Bytes
804aa17 a48371b 804aa17 c68a055 d560b41 c68a055 d560b41 c68a055 d560b41 c68a055 d560b41 c68a055 d560b41 c68a055 a8ba9c2 d560b41 b956096 c68a055 b956096 d560b41 a8ba9c2 d560b41 c68a055 b956096 a8ba9c2 |
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 |
---
license: mit
tags:
- unsloth
- phi-3
- command-line
- cli
- lora
- fine-tuned
base_model:
- unsloth/Phi-3-mini-4k-instruct-bnb-4bit
fine-tuned with:
- https://github.com/unslothai/unsloth
LoRA config:
- r=8, alpha=128, dropout=0
---
# π οΈ Finetuned Phi-3 CLI Assistant
This model is a fine-tuned version of [unsloth/Phi-3-mini-4k-instruct-bnb-4bit](https://huggingface.co/unsloth/Phi-3-mini-4k-instruct-bnb-4bit), trained on a command-line Q&A dataset for Linux/Git/tar/curl/grep/etc.
## π Use Cases
- Terminal helpbots
- CLI Q&A agents
- Developer assistants
## π§ How to Use
```python
from unsloth import FastLanguageModel
from transformers import AutoTokenizer
import torch
import gradio as gr
# π Load model and tokenizer from Hugging Face
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="sreebhargav/finetuned-phi3-cli", # Your HF model path
max_seq_length=2048,
load_in_4bit=True,
device_map="auto"
)
FastLanguageModel.for_inference(model)
# π CLI Assistant function
def cli_assistant(prompt):
messages = [{"role": "user", "content": prompt}]
inputs = tokenizer.apply_chat_template(
messages,
return_tensors="pt",
tokenize=True,
add_generation_prompt=True
).to(model.device)
outputs = model.generate(
input_ids=inputs,
max_new_tokens=256,
temperature=0.7,
top_p=0.9,
do_sample=True,
eos_token_id=tokenizer.eos_token_id
)
decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
return decoded.split("### Output:\n")[-1].strip()
# π Launch Gradio demo
gr.Interface(
fn=cli_assistant,
inputs=gr.Textbox(lines=2, placeholder="Ask about a Linux/Git/Bash command..."),
outputs=gr.Textbox(label="π§ AI Response"),
title="π§ CLI Assistant - Phi-3 Mini + Unsloth",
description="Ask your command-line questions. This model was fine-tuned with QLoRA using Unsloth."
).launch(share=True) |