Instructions to use KasparZ/llama-2-7b-hitl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KasparZ/llama-2-7b-hitl with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KasparZ/llama-2-7b-hitl")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("KasparZ/llama-2-7b-hitl") model = AutoModelForCausalLM.from_pretrained("KasparZ/llama-2-7b-hitl", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use KasparZ/llama-2-7b-hitl with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf KasparZ/llama-2-7b-hitl # Run inference directly in the terminal: llama cli -hf KasparZ/llama-2-7b-hitl
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf KasparZ/llama-2-7b-hitl # Run inference directly in the terminal: llama cli -hf KasparZ/llama-2-7b-hitl
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf KasparZ/llama-2-7b-hitl # Run inference directly in the terminal: ./llama-cli -hf KasparZ/llama-2-7b-hitl
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf KasparZ/llama-2-7b-hitl # Run inference directly in the terminal: ./build/bin/llama-cli -hf KasparZ/llama-2-7b-hitl
Use Docker
docker model run hf.co/KasparZ/llama-2-7b-hitl
- LM Studio
- Jan
- vLLM
How to use KasparZ/llama-2-7b-hitl with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KasparZ/llama-2-7b-hitl" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KasparZ/llama-2-7b-hitl", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/KasparZ/llama-2-7b-hitl
- SGLang
How to use KasparZ/llama-2-7b-hitl 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 "KasparZ/llama-2-7b-hitl" \ --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": "KasparZ/llama-2-7b-hitl", "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 "KasparZ/llama-2-7b-hitl" \ --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": "KasparZ/llama-2-7b-hitl", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use KasparZ/llama-2-7b-hitl with Ollama:
ollama run hf.co/KasparZ/llama-2-7b-hitl
- Unsloth Studio
How to use KasparZ/llama-2-7b-hitl with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for KasparZ/llama-2-7b-hitl to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for KasparZ/llama-2-7b-hitl to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for KasparZ/llama-2-7b-hitl to start chatting
- Docker Model Runner
How to use KasparZ/llama-2-7b-hitl with Docker Model Runner:
docker model run hf.co/KasparZ/llama-2-7b-hitl
- Lemonade
How to use KasparZ/llama-2-7b-hitl with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull KasparZ/llama-2-7b-hitl
Run and chat with the model
lemonade run user.llama-2-7b-hitl-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama serve -hf KasparZ/llama-2-7b-hitl# Run inference directly in the terminal:
llama cli -hf KasparZ/llama-2-7b-hitlUse pre-built binary
# Download pre-built binary from:
# https://github.com/ggerganov/llama.cpp/releases# Start a local OpenAI-compatible server with a web UI:
./llama-server -hf KasparZ/llama-2-7b-hitl# Run inference directly in the terminal:
./llama-cli -hf KasparZ/llama-2-7b-hitlBuild from source code
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama-server -hf KasparZ/llama-2-7b-hitl# Run inference directly in the terminal:
./build/bin/llama-cli -hf KasparZ/llama-2-7b-hitlUse Docker
docker model run hf.co/KasparZ/llama-2-7b-hitl- Base Model
- The instruction dataset to use
- QLoRA parameters
- LoRA attention dimension
- Alpha parameter for LoRA scaling
- Dropout probability for LoRA layers
- bitsandbytes parameters
- Activate 4-bit precision base model loading
- Compute dtype for 4-bit base models
- Quantization type (fp4 or nf4)
- Activate nested quantization for 4-bit base models (double quantization)
- TrainingArguments parameters
- Output directory where the model predictions and checkpoints will be stored
- Number of training epochs
- Enable fp16/bf16 training (set bf16 to True with an A100)
- Batch size per GPU for training
- Batch size per GPU for evaluation
- Number of update steps to accumulate the gradients for
- Enable gradient checkpointing
- Maximum gradient normal (gradient clipping)
- Initial learning rate (AdamW optimizer)
- Weight decay to apply to all layers except bias/LayerNorm weights
- Optimizer to use
- Learning rate schedule
- Number of training steps (overrides num_train_epochs)
- Ratio of steps for a linear warmup (from 0 to learning rate)
- Group sequences into batches with same length
- Saves memory and speeds up training considerably
- Save checkpoint every X updates steps
- Log every X updates steps
- SFT parameters
- Maximum sequence length to use
- Pack multiple short examples in the same input sequence to increase efficiency
- Load the entire model on the GPU 0
Base Model
model_name = "mistralai/Mistral-7B-v0.1"
The instruction dataset to use
dataset_name = "KasparZ/HITL-2"
################################################################################
QLoRA parameters
################################################################################
LoRA attention dimension
lora_r = 64
Alpha parameter for LoRA scaling
lora_alpha = 16
Dropout probability for LoRA layers
lora_dropout = 0.05 #0.1
################################################################################
bitsandbytes parameters
################################################################################
Activate 4-bit precision base model loading
use_4bit = True
Compute dtype for 4-bit base models
bnb_4bit_compute_dtype = "float16"
Quantization type (fp4 or nf4)
bnb_4bit_quant_type = "nf4"
Activate nested quantization for 4-bit base models (double quantization)
use_nested_quant = False
################################################################################
TrainingArguments parameters
################################################################################
Output directory where the model predictions and checkpoints will be stored
output_dir = "./results"
Number of training epochs
#num_train_epochs = 1 num_train_epochs = 4
Enable fp16/bf16 training (set bf16 to True with an A100)
fp16 = False bf16 = False
Batch size per GPU for training
per_device_train_batch_size = 4
Batch size per GPU for evaluation
per_device_eval_batch_size = 4
Number of update steps to accumulate the gradients for
gradient_accumulation_steps = 4 #1
Enable gradient checkpointing
gradient_checkpointing = True
Maximum gradient normal (gradient clipping)
max_grad_norm = 0.3
Initial learning rate (AdamW optimizer)
learning_rate = 2e-4
Weight decay to apply to all layers except bias/LayerNorm weights
weight_decay = 0.001
Optimizer to use
optim = "paged_adamw_32bit"
Learning rate schedule
lr_scheduler_type = "cosine"
Number of training steps (overrides num_train_epochs)
max_steps = -1
Ratio of steps for a linear warmup (from 0 to learning rate)
warmup_ratio = 0.03
Group sequences into batches with same length
Saves memory and speeds up training considerably
group_by_length = True
Save checkpoint every X updates steps
save_steps = 0
Log every X updates steps
logging_steps = 25
################################################################################
SFT parameters
################################################################################
Maximum sequence length to use
max_seq_length = None
Pack multiple short examples in the same input sequence to increase efficiency
packing = False
Load the entire model on the GPU 0
device_map = {"": 0}
- Downloads last month
- 25
We're not able to determine the quantization variants.
Install (macOS, Linux)
# Start a local OpenAI-compatible server with a web UI: llama serve -hf KasparZ/llama-2-7b-hitl# Run inference directly in the terminal: llama cli -hf KasparZ/llama-2-7b-hitl