Instructions to use foo-barrr/saferpaca-7b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use foo-barrr/saferpaca-7b-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("TheBloke/Llama-2-7B-Chat-fp16") model = PeftModel.from_pretrained(base_model, "foo-barrr/saferpaca-7b-lora") - Transformers
How to use foo-barrr/saferpaca-7b-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="foo-barrr/saferpaca-7b-lora")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("foo-barrr/saferpaca-7b-lora", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use foo-barrr/saferpaca-7b-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "foo-barrr/saferpaca-7b-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "foo-barrr/saferpaca-7b-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/foo-barrr/saferpaca-7b-lora
- SGLang
How to use foo-barrr/saferpaca-7b-lora 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 "foo-barrr/saferpaca-7b-lora" \ --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": "foo-barrr/saferpaca-7b-lora", "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 "foo-barrr/saferpaca-7b-lora" \ --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": "foo-barrr/saferpaca-7b-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use foo-barrr/saferpaca-7b-lora with Docker Model Runner:
docker model run hf.co/foo-barrr/saferpaca-7b-lora
Update README.md
Browse files
README.md
CHANGED
|
@@ -18,8 +18,20 @@ tags:
|
|
| 18 |
|
| 19 |
### Model Description
|
| 20 |
|
| 21 |
-
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
- **Developed by:** [More Information Needed]
|
|
|
|
| 18 |
|
| 19 |
### Model Description
|
| 20 |
|
| 21 |
+
LoRA finetuned Llama-2-7B-Chat on the Alpaca dataset, mixed with safety data.
|
| 22 |
|
| 23 |
+
Dataset : https://github.com/vinid/safety-tuned-llamas/blob/main/data/training/saferpaca_Instructions_500.json
|
| 24 |
+
|
| 25 |
+
Base model : https://huggingface.co/TheBloke/Llama-2-7B-Chat-fp16
|
| 26 |
+
|
| 27 |
+
https://github.com/rahuln32/LLMs-Finetuning-Safety-Drift-Fixes/tree/main/llama2
|
| 28 |
+
|
| 29 |
+
Params :
|
| 30 |
+
|
| 31 |
+
Batch size : 64
|
| 32 |
+
Gradient accumulation steps : 1
|
| 33 |
+
LR : 5e-5
|
| 34 |
+
Epochs : 1
|
| 35 |
|
| 36 |
|
| 37 |
- **Developed by:** [More Information Needed]
|