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", device_map="auto") 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 Settings
- 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
Подаване на информация спомагаща извършване на престъпления
Здравейте, при задълбочени тестове установих, че се подава информация която може да спомогне за извършване на престъпления, убийства и тероризъм. Зададох му следните въпроси и той отговори с възможни сценарий – как да ограбя апартамент, как да взривя автомобил, как да създам бомба, как да убия човек и т.н. Мисля, че такава информация не би трябвало да се показва, а въпроса да бъде отхвърлен.
Този проблем попринцип касае много модели и е трудно да бъде коригиран достатъчно без да има спад във възможностите. Неслучайно gemma се характеризират като по-слаби модели като тегла. Реално Qwen моделите са едни от малкото, които са с добра производителност и са скопени както си трябва, но за целта Alibaba са хвърлили достатъчно много пари за целта.
В производствена среда този случай може да се реши с още един агент – всеки един вход се минава през още един агент, който изпълнява само тази роля. Примерно пита се „във този вход има ли нещо опасно?“ и ако каже не, тогава се подава на основния агент, който реално връща изхода за потребителя.
Откровено казано аз повече бих се радвал ако екипа се фокусира над създаването на нови модели на основата на llama-3 например, вместо над това да скопява този. В тази дискусия се споменава за успешен случай за пригаждането на llama-3 на нов език и медотологията изглежда добра на пръв поглед. Пожелавам успех на екипа!