Instructions to use AnishJoshi/codellama2-finetuned-nl2bash-fin with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AnishJoshi/codellama2-finetuned-nl2bash-fin with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AnishJoshi/codellama2-finetuned-nl2bash-fin")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AnishJoshi/codellama2-finetuned-nl2bash-fin") model = AutoModelForCausalLM.from_pretrained("AnishJoshi/codellama2-finetuned-nl2bash-fin") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use AnishJoshi/codellama2-finetuned-nl2bash-fin with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AnishJoshi/codellama2-finetuned-nl2bash-fin" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AnishJoshi/codellama2-finetuned-nl2bash-fin", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AnishJoshi/codellama2-finetuned-nl2bash-fin
- SGLang
How to use AnishJoshi/codellama2-finetuned-nl2bash-fin 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 "AnishJoshi/codellama2-finetuned-nl2bash-fin" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AnishJoshi/codellama2-finetuned-nl2bash-fin", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "AnishJoshi/codellama2-finetuned-nl2bash-fin" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AnishJoshi/codellama2-finetuned-nl2bash-fin", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AnishJoshi/codellama2-finetuned-nl2bash-fin with Docker Model Runner:
docker model run hf.co/AnishJoshi/codellama2-finetuned-nl2bash-fin
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("AnishJoshi/codellama2-finetuned-nl2bash-fin")
model = AutoModelForCausalLM.from_pretrained("AnishJoshi/codellama2-finetuned-nl2bash-fin")YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
codellama2-finetuned-nl2bash-fin
Finetuned on the AnishJoshi/nl2bash-custom dataset for generating bash code based on natural language descriptions.
Model Details
- Model Name: CodeLlama2-Finetuned-NL2Bash
- Base Model: CodeLlama2
- Task: Natural Language to Bash Script Conversion
- Framework: PyTorch
- Fine-tuning Dataset: Custom dataset of natural language commands and corresponding Bash scripts, available here
Model Description
- Developed by: Anish Joshi
- Model type: CausalLM
- Finetuned from model: Codellama2
Files Included
adapter_config.json: Configuration file for the adapter layers.adapter_model.safetensors: Weights of the adapter layers in the Safetensors format.optimizer.pt: State of the optimizer used during training.rng_state.pth: State of the random number generator.scheduler.pt: State of the learning rate scheduler.special_tokens_map.json: Mapping for special tokens used by the tokenizer.tokenizer.json: Tokenizer model including the vocabulary.tokenizer_config.json: Configuration settings for the tokenizer.trainer_state.json: State of the trainer including training metrics.training_args.bin: Training arguments used for fine-tuning.- `README.md
Usage
Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("AnishJoshi/codellama2-finetuned-nl2bash-fin")
model = AutoModelForCausalLM.from_pretrained("AnishJoshi/codellama2-finetuned-nl2bash-fin")
Training Details
Training details available at Finetuning Notebook
Training Hyperparameters
Training arguments and configuration are set using TrainingArguments and LoraConfig. The model is fine-tuned using the following parameters:
output_dir: codellama2-finetuned-nl2bash- Directory to save the fine-tuned model.per_device_train_batch_size: 2 - Batch size per device.gradient_accumulation_steps: 16 - Number of gradient accumulation steps.optim: paged_adamw_32bit - Optimizer type.learning_rate: 2e-4 - Learning rate.lr_scheduler_type: cosine - Learning rate scheduler type.save_strategy: epoch - Strategy to save checkpoints.logging_steps: 10 - Number of steps between logging.num_train_epochs: 1 - Number of training epochs.max_steps: 100 - Maximum number of training steps.fp16: True - Use 16-bit floating-point precision.push_to_hub: False - Whether to push the model to Hugging Face Hub.report_to: none - Reporting destination.
Evaluation
Evaulation metrics and calculations available at Evaluation Notebook
- Downloads last month
- 2
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AnishJoshi/codellama2-finetuned-nl2bash-fin")