Instructions to use LeoLM/leo-hessianai-7b-chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LeoLM/leo-hessianai-7b-chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LeoLM/leo-hessianai-7b-chat", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LeoLM/leo-hessianai-7b-chat", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("LeoLM/leo-hessianai-7b-chat", trust_remote_code=True, 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LeoLM/leo-hessianai-7b-chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LeoLM/leo-hessianai-7b-chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LeoLM/leo-hessianai-7b-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LeoLM/leo-hessianai-7b-chat
- SGLang
How to use LeoLM/leo-hessianai-7b-chat 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 "LeoLM/leo-hessianai-7b-chat" \ --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": "LeoLM/leo-hessianai-7b-chat", "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 "LeoLM/leo-hessianai-7b-chat" \ --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": "LeoLM/leo-hessianai-7b-chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LeoLM/leo-hessianai-7b-chat with Docker Model Runner:
docker model run hf.co/LeoLM/leo-hessianai-7b-chat
missing tokenizer.model?
is the file "tokenizer.model" missing?
can you add it (also to all the other repos)?
Oh yeah, I could have seen that. Will also do :) Afaik this is not necessary if you do not set use_fast=False.
i'm trying to use it with llama.cpp, but there seems to be a different tokenizer for the chat version?Exception: Vocab size mismatch (model has 32128, but ../leo-hessianai-7b-chat/tokenizer.model has 32000).
Seems I've uploaded a wrong tokenizer model. I've now uploaded the correct version in this repo. Please confirm that it works for you? Will then update for the others.
Sadly no, still same tokenizer.model:
~/git/leo-hessianai-7b-chat main base 15:33:36
❯ md5sum tokenizer.model
eeec4125e9c7560836b4873b6f8e3025 tokenizer.model
~/git/leo-hessianai-7b-chat main base 15:33:38
❯ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 2), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), 526 bytes | 175.00 KiB/s, done.
From https://huggingface.co/LeoLM/leo-hessianai-7b-chat
b96b28f..7c343a5 main -> origin/main
Updating b96b28f..7c343a5
Fast-forward
~/git/leo-hessianai-7b-chat main base 17:29:52
❯ md5sum tokenizer.model
eeec4125e9c7560836b4873b6f8e3025 tokenizer.model
Not quite sure how to help with this then. After some testing on my side, the tokenizer.model seems correct (i.e. has 32006 tokens in the vocab) and also encodes correctly. The model has 32128 vocab size after padding to a multiple of 128.
Is there any option on your side to use the default huggingface tokenizer? Or otherwise see if other users of llama.cpp have run into similar issues?
same here. Replacing "32128" with "32000" for entry "vocab_size" in config.json lets llama.cpp convert the model. But then it fails with "error loading model: create_tensor: tensor 'token_embd.weight' has wrong shape; expected 4096, 32000, got 4096, 32128, 1, 1".
it seems, it boils down to a mismatch of vocabulary dimensions in tokenizer.model, config.json, tokenizer.json, and token_embd.weight - huggingface does not check this or is smart enough to adjust on the fly.