Run this model with HF Jobs
Run Canstralian/text2shellcommands on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Canstralian/text2shellcommands. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Canstralian/text2shellcommands on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Canstralian/text2shellcommands with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Canstralian/text2shellcommands with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Canstralian/text2shellcommands", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Create train.py
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849from transformers import Trainer, TrainingArguments, AutoModelForSequenceClassification, AutoTokenizerfrom datasets import load_datasetimport torch
# Load datasetsdef load_train_data(): # Example dataset train_dataset = load_dataset('csv', data_files={"train": "datasets/Canstralian/ShellCommands.csv"}) return train_dataset
# Load model and tokenizerdef load_model_and_tokenizer(model_name): model = AutoModelForSequenceClassification.from_pretrained(model_name, num_labels=2) # Adjust labels tokenizer = AutoTokenizer.from_pretrained(model_name) return model, tokenizer
# Preprocessing functiondef preprocess_function(examples, tokenizer): return tokenizer(examples['text'], padding=True, truncation=True)
# Fine-tuning functiondef fine_tune(model_name="WhiteRabbitNeo/WhiteRabbitNeo-13B-v1"): train_data = load_train_data() model, tokenizer = load_model_and_tokenizer(model_name)
# Tokenize the dataset train_data = train_data.map(lambda x: preprocess_function(x, tokenizer), batched=True) train_data.set_format(type="torch", columns=["input_ids", "attention_mask", "labels"])
# Training arguments training_args = TrainingArguments( output_dir='./results', evaluation_strategy="epoch", learning_rate=2e-5, per_device_train_batch_size=16, num_train_epochs=3, weight_decay=0.01, )
trainer = Trainer( model=model, args=training_args, train_dataset=train_data['train'], )
trainer.train()
# Call fine-tuningfine_tune()train.pyAdded+49