Text Generation
Transformers
Safetensors
English
raptor
causal-lm
mixture-of-experts
custom-code
conversational
instruction-tuned
custom_code
Instructions to use Voyager466920/Raptor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Voyager466920/Raptor with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Voyager466920/Raptor", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Voyager466920/Raptor", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Voyager466920/Raptor with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Voyager466920/Raptor" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Voyager466920/Raptor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Voyager466920/Raptor
- SGLang
How to use Voyager466920/Raptor 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 "Voyager466920/Raptor" \ --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": "Voyager466920/Raptor", "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 "Voyager466920/Raptor" \ --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": "Voyager466920/Raptor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Voyager466920/Raptor with Docker Model Runner:
docker model run hf.co/Voyager466920/Raptor
| import os | |
| import shutil | |
| import sentencepiece as spm | |
| from transformers import PreTrainedTokenizer | |
| class RaptorTokenizer(PreTrainedTokenizer): | |
| vocab_files_names = {"vocab_file": "tokenizer.model"} | |
| model_input_names = ["input_ids", "attention_mask"] | |
| def __init__(self, vocab_file, **kwargs): | |
| self.vocab_file = vocab_file | |
| self.sp_model = spm.SentencePieceProcessor(model_file=vocab_file) | |
| bos_token = kwargs.pop("bos_token", "<s>") | |
| eos_token = kwargs.pop("eos_token", "</s>") | |
| unk_token = kwargs.pop("unk_token", "<unk>") | |
| pad_token = kwargs.pop("pad_token", "<pad>") | |
| super().__init__(bos_token=bos_token, eos_token=eos_token, unk_token=unk_token, pad_token=pad_token, **kwargs) | |
| def vocab_size(self): | |
| return self.sp_model.vocab_size() | |
| def get_vocab(self): | |
| return {self.sp_model.id_to_piece(index): index for index in range(self.vocab_size)} | |
| def _tokenize(self, text): | |
| return self.sp_model.encode(text, out_type=str) | |
| def _convert_token_to_id(self, token): | |
| return self.sp_model.piece_to_id(token) | |
| def _convert_id_to_token(self, index): | |
| return self.sp_model.id_to_piece(index) | |
| def convert_tokens_to_string(self, tokens): | |
| return self.sp_model.decode(tokens) | |
| def save_vocabulary(self, save_directory, filename_prefix=None): | |
| filename = ((filename_prefix + "-") if filename_prefix else "") + "tokenizer.model" | |
| destination = os.path.join(save_directory, filename) | |
| if os.path.abspath(self.vocab_file) != os.path.abspath(destination): | |
| shutil.copyfile(self.vocab_file, destination) | |
| return (destination,) | |