Text Generation
GGUF
Japanese
japanese
instruction-tuning
little-language-model
tiny-language-model
edge-ai
embedded-ai
ex-word
llama-cpp
lm-studio
custom-code
conversational
Instructions to use ToTo-40417/EXLLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ToTo-40417/EXLLM with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf ToTo-40417/EXLLM:F16 # Run inference directly in the terminal: llama cli -hf ToTo-40417/EXLLM:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ToTo-40417/EXLLM:F16 # Run inference directly in the terminal: llama cli -hf ToTo-40417/EXLLM:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf ToTo-40417/EXLLM:F16 # Run inference directly in the terminal: ./llama-cli -hf ToTo-40417/EXLLM:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf ToTo-40417/EXLLM:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf ToTo-40417/EXLLM:F16
Use Docker
docker model run hf.co/ToTo-40417/EXLLM:F16
- LM Studio
- Jan
- vLLM
How to use ToTo-40417/EXLLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ToTo-40417/EXLLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ToTo-40417/EXLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ToTo-40417/EXLLM:F16
- Ollama
How to use ToTo-40417/EXLLM with Ollama:
ollama run hf.co/ToTo-40417/EXLLM:F16
- Unsloth Desktop
- Docker Model Runner
How to use ToTo-40417/EXLLM with Docker Model Runner:
docker model run hf.co/ToTo-40417/EXLLM:F16
- Lemonade
How to use ToTo-40417/EXLLM with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ToTo-40417/EXLLM:F16
Run and chat with the model
lemonade run user.EXLLM-F16
List all available models
lemonade list
- Atomic Chat
| import json, unicodedata | |
| from collections import Counter | |
| from pathlib import Path | |
| BYTE_BASE=0; BYTE_COUNT=256 | |
| def normalize_text(s:str)->str: | |
| s=unicodedata.normalize('NFC',s) | |
| return ''.join((' ' if (ord(c)<32 and c not in '\n\t') else c) for c in s).strip() | |
| class HybridTokenizer: | |
| def __init__(self, chars): | |
| self.chars=list(chars); self.char_to_id={c:256+i for i,c in enumerate(self.chars)} | |
| s=256+len(self.chars) | |
| self.PAD=s; self.BOS=s+1; self.USER=s+2; self.ASSIST=s+3; self.EOS=s+4; self.vocab_size=s+5 | |
| def build_from_jsonl(cls, paths, max_chars=768): | |
| cnt=Counter() | |
| for path in paths: | |
| for line in open(path,encoding='utf-8'): | |
| r=json.loads(line) | |
| cnt.update(normalize_text(r['prompt'])); cnt.update(normalize_text(r['answer'])) | |
| # ASCII stays as byte tokens. Frequent non-ASCII chars become atomic tokens. | |
| chars=[c for c,_ in cnt.most_common() if ord(c)>=128][:max_chars] | |
| return cls(chars) | |
| def save(self,path): | |
| Path(path).write_text(json.dumps({'type':'hybrid-char-byte-fallback','chars':self.chars,'normalization':'NFC','special':{'PAD':self.PAD,'BOS':self.BOS,'USER':self.USER,'ASSIST':self.ASSIST,'EOS':self.EOS}},ensure_ascii=False,indent=2),encoding='utf-8') | |
| def load(cls,path): return cls(json.loads(Path(path).read_text(encoding='utf-8'))['chars']) | |
| def encode_text(self,s): | |
| out=[] | |
| for c in normalize_text(s): | |
| if c in self.char_to_id: out.append(self.char_to_id[c]) | |
| else: out.extend(c.encode('utf-8','strict')) | |
| return out | |
| def encode_user(self,s): return [self.BOS,self.USER,*self.encode_text(s),self.ASSIST] | |
| def encode_example(self,prompt,answer,max_seq_len=128): | |
| p=self.encode_text(prompt); a=self.encode_text(answer) | |
| seq=[self.BOS,self.USER,*p,self.ASSIST,*a,self.EOS] | |
| if len(seq)>max_seq_len: | |
| excess=len(seq)-max_seq_len; p=p[min(excess,len(p)):] | |
| seq=[self.BOS,self.USER,*p,self.ASSIST,*a,self.EOS] | |
| if len(seq)>max_seq_len: | |
| a=a[:max(1,max_seq_len-(4+len(p)))] | |
| seq=[self.BOS,self.USER,*p,self.ASSIST,*a,self.EOS] | |
| return seq | |
| def token_bytes(self,tok): | |
| if 0<=tok<256: return bytes([tok]) | |
| i=tok-256 | |
| if 0<=i<len(self.chars): return self.chars[i].encode('utf-8') | |
| return b'' | |
| def decode(self,toks): | |
| b=bytearray() | |
| for t in toks: | |
| if t in (self.PAD,self.BOS,self.USER,self.ASSIST,self.EOS): continue | |
| b.extend(self.token_bytes(t)) | |
| return bytes(b).decode('utf-8','strict') | |
| class UTF8State: | |
| __slots__=('need','lo','hi') | |
| def __init__(self): self.need=0; self.lo=0x80; self.hi=0xBF | |
| def accepts_byte(self,b): | |
| if self.need: return self.lo<=b<=self.hi | |
| return b in (9,10,13) or 0x20<=b<=0x7E or 0xC2<=b<=0xF4 | |
| def push(self,b): | |
| if not self.accepts_byte(b): return False | |
| if self.need: | |
| self.need-=1; self.lo=0x80; self.hi=0xBF; return True | |
| if b<=0x7F: return True | |
| if 0xC2<=b<=0xDF: self.need=1 | |
| elif b==0xE0: self.need=2; self.lo=0xA0 | |
| elif 0xE1<=b<=0xEC or 0xEE<=b<=0xEF: self.need=2 | |
| elif b==0xED: self.need=2; self.hi=0x9F | |
| elif b==0xF0: self.need=3; self.lo=0x90 | |
| elif 0xF1<=b<=0xF3: self.need=3 | |
| elif b==0xF4: self.need=3; self.hi=0x8F | |
| return True | |
| def complete(self): return self.need==0 | |