Downloads · 30 days
27
18% of all-time downloads
pranay-j/mistral-7b-nl2bash-agent
mistral-7b-nl2bash-agent is a machine learning model from pranay-j. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
27
18% of all-time downloads
All-time downloads
152
Public
Repo size
219 MB
Likes
2
Public
Click a slice to open those files.
.safetensors109 MB · 98%
From the Hugging Face model README
This model is a fine-tuned version of mistralai/Mistral-7B-Instruct-v0.2 on the nl2bash dataset. It achieves the following results on the evaluation set:
Mistral 7B NL2BASH Agent is a fine-tuned model that converts natural language queries into Linux commands. It serves as an intelligent agent capable of generating Linux commands based on user input in the form of natural language queries.
pip install transformers accelerate torch bitsandbytes peft
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
import torch
from peft import PeftModel, PeftConfig
read_token="YOUR HUGGINGFACE TOKEN"
nf4_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16
)
model = AutoModelForCausalLM.from_pretrained(
"mistralai/Mistral-7B-Instruct-v0.2",
device_map='auto',
quantization_config=nf4_config,
use_cache=False,
token=read_token
)
model = PeftModel.from_pretrained(model, "pranay-j/mistral-7b-nl2bash-agent",device_map='auto',token=read_token)
tokenizer=AutoTokenizer.from_pretrained("pranay-j/mistral-7b-nl2bash-agent",add_eos_token=False)
nl='Add "execute" to the permissions of all directories in the home directory tree'
prompt= f"[INST] {nl} [/INST]"
inputs=tokenizer(prompt,return_tensors="pt")
input_ids=inputs["input_ids"].to("cuda")
with torch.no_grad():
out=model.generate(input_ids,top_p=0.5, temperature=0.7, max_new_tokens=30)
tokenizer.decode(out[0][input_ids.shape[-1]:])
# Output: find ~ -type d -exec chmod +x {} </s>
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 1.6136 | 1.0 | 202 | 1.6451 |
| 1.5448 | 2.0 | 404 | 1.5952 |