Instructions to use SurgeGlobal/OpenBezoar-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SurgeGlobal/OpenBezoar-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SurgeGlobal/OpenBezoar-SFT")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SurgeGlobal/OpenBezoar-SFT") model = AutoModelForCausalLM.from_pretrained("SurgeGlobal/OpenBezoar-SFT") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use SurgeGlobal/OpenBezoar-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SurgeGlobal/OpenBezoar-SFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SurgeGlobal/OpenBezoar-SFT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SurgeGlobal/OpenBezoar-SFT
- SGLang
How to use SurgeGlobal/OpenBezoar-SFT 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 "SurgeGlobal/OpenBezoar-SFT" \ --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": "SurgeGlobal/OpenBezoar-SFT", "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 "SurgeGlobal/OpenBezoar-SFT" \ --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": "SurgeGlobal/OpenBezoar-SFT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use SurgeGlobal/OpenBezoar-SFT with Docker Model Runner:
docker model run hf.co/SurgeGlobal/OpenBezoar-SFT
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("SurgeGlobal/OpenBezoar-SFT")
model = AutoModelForCausalLM.from_pretrained("SurgeGlobal/OpenBezoar-SFT")OpenBezoar-SFT
The OpenBezoar-SFT is an instruction-tuned version of Open LlaMA 3B v2 with Q-LoRA on three of our custom datasets synthetically generated from h2ogpt-gm-oasst1-en-2048-falcon-40b-v2.
Model Details
- Base model: Open LlaMA 3B v2
- LoRA configuration:
- r: 16
- alpha: 16
- dropout: 0.05
- target modules: [q_proj, v_proj, k_proj]
- Datasets used for instruction tuning:
Model Description
OpenBezoar-SFT is built upon the Open Llama 3B v2 architecture and has been fine-tuned to improve its instruction-following abilities.
Model Sources
- Repository: Bitbucket Project
- Paper : Pre-Print
Instruction Format
We follow a modified version of the Alpaca prompt template as shown below. It is important to utilize this template in order to obtain best responses for instruction related tasks.
### System:
Below is an instruction that describes a task, optionally paired with an input that provides further context following that instruction. Write a response that appropriately completes the request.
### Instruction:
{instruction}
### Response:
Notice that no end-of-sentence (eos) token is being appended.
Note: The system prompt shown in the following figure is the one that the model has been trained on most of the time. However, you may attempt to use any other system prompt that is available in the Orca scheme.
Usage
from peft import PeftConfig, PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig, AutoModelForSeq2SeqLM
checkpoint = "SurgeGlobal/OpenBezoar-SFT"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(
checkpoint,
load_in_4bit=True, # optionally for low resource environments
device_map="auto"
)
prompt = """### System:
Below is an instruction that describes a task, optionally paired with an input that provides further context following that instruction. Write a response that appropriately completes the request.
### Instruction:
{instruction}
### Response:""".format(
instruction="What is the world state in the year 1597."
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024, do_sample=True)
print(tokenizer.decode(outputs[0]))
Evaluations
Refer to our self-reported evaluations in our paper (Section 4).
Limitations
- The model might not consistently show improved abilities to follow instructions, and it could respond inappropriately or get stuck in loops.
- This model is not aligned to human preferences and therefore it may generate harmful and uncensored content.
- Caution is urged against relying on this model for production or adjacent use-cases.
Citation
If you find our work useful, please cite our paper as follows:
@misc{surge2024openbezoar,
title={OpenBezoar: Small, Cost-Effective and Open Models Trained on Mixes of Instruction Data},
author={Chandeepa Dissanayake and Lahiru Lowe and Sachith Gunasekara and Yasiru Ratnayake},
year={2024},
eprint={2404.12195},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Model Authors
Chandeepa Dissanayake, Lahiru Lowe, Sachith Gunasekara, and Yasiru Ratnayake
- Downloads last month
- 834
Model tree for SurgeGlobal/OpenBezoar-SFT
Base model
openlm-research/open_llama_3b_v2
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SurgeGlobal/OpenBezoar-SFT")