Instructions to use INSAIT-Institute/BgGPT-7B-Instruct-v0.2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use INSAIT-Institute/BgGPT-7B-Instruct-v0.2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="INSAIT-Institute/BgGPT-7B-Instruct-v0.2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("INSAIT-Institute/BgGPT-7B-Instruct-v0.2") model = AutoModelForCausalLM.from_pretrained("INSAIT-Institute/BgGPT-7B-Instruct-v0.2") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use INSAIT-Institute/BgGPT-7B-Instruct-v0.2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "INSAIT-Institute/BgGPT-7B-Instruct-v0.2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "INSAIT-Institute/BgGPT-7B-Instruct-v0.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/INSAIT-Institute/BgGPT-7B-Instruct-v0.2
- SGLang
How to use INSAIT-Institute/BgGPT-7B-Instruct-v0.2 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 "INSAIT-Institute/BgGPT-7B-Instruct-v0.2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "INSAIT-Institute/BgGPT-7B-Instruct-v0.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "INSAIT-Institute/BgGPT-7B-Instruct-v0.2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "INSAIT-Institute/BgGPT-7B-Instruct-v0.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use INSAIT-Institute/BgGPT-7B-Instruct-v0.2 with Docker Model Runner:
docker model run hf.co/INSAIT-Institute/BgGPT-7B-Instruct-v0.2
missing tokenizer.model
I had to copy tokenizer.model from v1.0 to be able to start the model, since I was encountering this issue:
https://github.com/ThilinaRajapakse/simpletransformers/issues/873
Is that the expected approach?
И как го подкара ?
Копирах tokenizer.model oт version0.1 и след това с LLaMA-Factory
Благодаря,
ще пробвам.
На какъв хардуер работи ?
аз ползвах Tesla V100-SXM2-32GB, но заема малко повече от половината памет
Tokenizer.model не ви трябва. Относно VRAM, помислете за quantuzation.
При мене тръгна. Обаче лъже като дърт циганин.
tokenizer.model has been added to the repo. You were correct in using the one from v0.1. You can use one of the GGUF quantized versions if it doesn't fit on your hardware, otherwise, you need more than 15GB of VRAM to run without offloading to CPU. If you have a good GPU but not enough memory, I believe llamacpp can help with doing the opposite - GPU offloading.