Downloads · 30 days
12
36% of all-time downloads
abandonedmonk/TinyLlama-1.1B-NL2SH-Alpaca-v1
TinyLlama-1.1B-NL2SH-Alpaca-v1 is a text generation model from abandonedmonk. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
This model is a fine-tuned version of unsloth/tinyllama-chat. It has been fine-tuned on the NL2SH-Alpaca dataset for converting natural language instructions into bash commands.
Downloads · 30 days
12
36% of all-time downloads
All-time downloads
33
Public
Repo size
2 GB
Likes
0
Public
Click a slice to open those files.
.safetensors50.5 MB · 92%
From the Hugging Face model README
This model is a fine-tuned version of unsloth/tinyllama-chat.
It has been fine-tuned on the NL2SH-Alpaca dataset for converting natural language instructions into bash commands.
The model outputs one bash command per instruction, even if multiple alternatives exist in the training dataset.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load the model and tokenizer
model_name = "abandonedmonk/TinyLlama-1.1B-NL2SH-Alpaca"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name).to("cuda")
# Inference helper
def generate_command(model, tokenizer, instruction, inp=""):
# build prompt in Alpaca-style
prompt = f"""Instruction: {instruction}
Input: {inp}
Response:
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=100,
do_sample=False, # greedy decoding
temperature=0.0,
num_return_sequences=1
)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
# Extract the first line (command) after "Response:"
# If you want to keep all the commands, just simply return 'generated_text' instead of 'response'
response = generated_text.strip().split("Response:")[-1].strip().split('\n')[0]
return response
# Example usage
instruction = "Rename all files with .andnav extension to .tile"
bash_cmd = generate_command(model, tokenizer, instruction)
print("Generated bash command:", bash_cmd)
This model was fine-tuned using Supervised Fine-Tuning (SFT) on the NL2SH-Alpaca dataset, which contains natural language instructions paired with shell commands.
unsloth/tinyllama-chatabandonedmonk/NL2SH-ALPACA@misc{vonwerra2022trl,
title = {{TRL: Transformer Reinforcement Learning}},
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
year = 2020,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/huggingface/trl}}
}
This model is released under the MIT License
seed (3407) during fine-tuning.