Text Generation
Transformers
Safetensors
English
notoken_gen55
notokenlm
byte-level
tokenizer-free
hybrid
hierarchical
code
code-generation
custom_code
Instructions to use VeroLM/NoTokenLM-CodeGen-5.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use VeroLM/NoTokenLM-CodeGen-5.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="VeroLM/NoTokenLM-CodeGen-5.5", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("VeroLM/NoTokenLM-CodeGen-5.5", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use VeroLM/NoTokenLM-CodeGen-5.5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "VeroLM/NoTokenLM-CodeGen-5.5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VeroLM/NoTokenLM-CodeGen-5.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/VeroLM/NoTokenLM-CodeGen-5.5
- SGLang
How to use VeroLM/NoTokenLM-CodeGen-5.5 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 "VeroLM/NoTokenLM-CodeGen-5.5" \ --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": "VeroLM/NoTokenLM-CodeGen-5.5", "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 "VeroLM/NoTokenLM-CodeGen-5.5" \ --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": "VeroLM/NoTokenLM-CodeGen-5.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use VeroLM/NoTokenLM-CodeGen-5.5 with Docker Model Runner:
docker model run hf.co/VeroLM/NoTokenLM-CodeGen-5.5
Download tokenization_notoken_gen55.py from VeroLM/NoTokenLM-CodeGen-5.5: direct link, hf CLI and curl.
- Browser
- Download file 1.97 kB
-
https://huggingface.co/VeroLM/NoTokenLM-CodeGen-5.5/resolve/main/tokenization_notoken_gen55.py
- Command line
-
hf download hf://VeroLM/NoTokenLM-CodeGen-5.5/tokenization_notoken_gen55.py
-
curl -L -o tokenization_notoken_gen55.py https://huggingface.co/VeroLM/NoTokenLM-CodeGen-5.5/resolve/main/tokenization_notoken_gen55.py
1.97 kB
| """Byte "tokenizer" of NoTokenLM-Gen-5.5: token id == UTF-8 byte value (0..255). Byte 0 is the end-of-document marker (EOD).""" | |
| import json | |
| import os | |
| from typing import Dict, List, Optional, Tuple | |
| from transformers import PreTrainedTokenizer | |
| class NoTokenGen55Tokenizer(PreTrainedTokenizer): | |
| vocab_files_names = {} | |
| model_input_names = ["input_ids"] | |
| def __init__(self, eod_token="\x00", **kwargs): | |
| self._byte_tokens = [chr(i) for i in range(256)] # token i is the single character whose code point is i (only used as a label) | |
| super().__init__(eos_token=eod_token, pad_token=eod_token, bos_token=None, unk_token=None, **kwargs) | |
| def vocab_size(self) -> int: | |
| return 256 | |
| def get_vocab(self) -> Dict[str, int]: | |
| return {t: i for i, t in enumerate(self._byte_tokens)} | |
| # text <-> byte ids (does not go through a vocabulary) | |
| def encode(self, text, add_special_tokens=False, **kwargs) -> List[int]: | |
| ids = list(text.encode("utf-8")) | |
| return ids + [0] if add_special_tokens else ids | |
| def decode(self, token_ids, skip_special_tokens=True, **kwargs) -> str: | |
| if hasattr(token_ids, "tolist"): | |
| token_ids = token_ids.tolist() | |
| bs = bytes(int(i) for i in token_ids if not (skip_special_tokens and int(i) == 0)) | |
| return bs.decode("utf-8", errors="replace") | |
| def _tokenize(self, text, **kwargs) -> List[str]: | |
| return [self._byte_tokens[b] for b in text.encode("utf-8")] | |
| def _convert_token_to_id(self, token) -> int: | |
| return ord(token) if len(token) == 1 and ord(token) < 256 else 0 | |
| def _convert_id_to_token(self, index) -> str: | |
| return self._byte_tokens[int(index)] | |
| def convert_tokens_to_string(self, tokens) -> str: | |
| return bytes(ord(t) for t in tokens).decode("utf-8", errors="replace") | |
| def save_vocabulary(self, save_directory, filename_prefix: Optional[str] = None) -> Tuple[str]: | |
| return () | |