Instructions to use msaad02/llama2_7b_brockportgpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use msaad02/llama2_7b_brockportgpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="msaad02/llama2_7b_brockportgpt")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("msaad02/llama2_7b_brockportgpt") model = AutoModelForCausalLM.from_pretrained("msaad02/llama2_7b_brockportgpt", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use msaad02/llama2_7b_brockportgpt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "msaad02/llama2_7b_brockportgpt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "msaad02/llama2_7b_brockportgpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/msaad02/llama2_7b_brockportgpt
- SGLang
How to use msaad02/llama2_7b_brockportgpt 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 "msaad02/llama2_7b_brockportgpt" \ --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": "msaad02/llama2_7b_brockportgpt", "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 "msaad02/llama2_7b_brockportgpt" \ --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": "msaad02/llama2_7b_brockportgpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use msaad02/llama2_7b_brockportgpt with Docker Model Runner:
docker model run hf.co/msaad02/llama2_7b_brockportgpt
BrockportGPT LLaMA2 Finetune
This model is part of my thesis to make a question-answering bot for SUNY Brockport. The data used for finetuning is a subset of the question database I generated, and is also available on my huggingface account.
For more information, see my github repo for the project.
Examples
Are SAT scores required?
SAT scores are not required for admission, but test scores are used as part of Brockport's holistic review process to make admissions decisions.
Who can I contact for help with financial aid?
You can contact the financial aid office at SUNY Brockport for assistance with financial aid. They are available to answer any questions and help you navigate the financial aid process.
Prompting
This prompting style is what was used for finetuning:
Below is an inquiry related to SUNY Brockport - from academics, admissions, and faculty support to student life. Prioritize accuracy and brevity.
### Instruction:
{question}### Response:
{response}
Usage
To run this model, I suggest using the following code to load the model in 4-bit and build a pipeline, which implements the correct prompt formatting
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
import textwrap
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
)
model = AutoModelForCausalLM.from_pretrained(
"msaad02/llama2_7b_brockportgpt",
quantization_config=bnb_config,
device_map={"": 0},
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("msaad02/llama2_7b_brockportgpt")
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline(
task="text-generation",
model=model,
tokenizer=tokenizer
)
def qa(text: str, full = False):
# textwrap.dedent gets rid of indenting at the start of each newline
text = textwrap.dedent(f"""\
Below is an inquiry related to SUNY Brockport - from academics, admissions, and faculty support to student life. Prioritize accuracy and brevity.
### Instruction:
{text}
### Response:
""")
response = pipe(text, max_length=100, do_sample=True, top_k=50, top_p=0.95, temperature=1.0)
response = response[0]['generated_text']
response = response.split("### Response:\n")[1] if not full else response
return response
print(qa("How do I apply?", full = True))
- Downloads last month
- 11