Instructions to use timorobrecht/babylm-qwen2-33m-bpe with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use timorobrecht/babylm-qwen2-33m-bpe with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="timorobrecht/babylm-qwen2-33m-bpe")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("timorobrecht/babylm-qwen2-33m-bpe") model = AutoModelForCausalLM.from_pretrained("timorobrecht/babylm-qwen2-33m-bpe", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use timorobrecht/babylm-qwen2-33m-bpe with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "timorobrecht/babylm-qwen2-33m-bpe" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "timorobrecht/babylm-qwen2-33m-bpe", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/timorobrecht/babylm-qwen2-33m-bpe
- SGLang
How to use timorobrecht/babylm-qwen2-33m-bpe 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 "timorobrecht/babylm-qwen2-33m-bpe" \ --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": "timorobrecht/babylm-qwen2-33m-bpe", "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 "timorobrecht/babylm-qwen2-33m-bpe" \ --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": "timorobrecht/babylm-qwen2-33m-bpe", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use timorobrecht/babylm-qwen2-33m-bpe with Docker Model Runner:
docker model run hf.co/timorobrecht/babylm-qwen2-33m-bpe
Configuration Parsing Warning:In UNKNOWN_FILENAME: "auto_map.AutoTokenizer" must be a string
Pinyin-Code Causal LM
This repository contains a custom Transformers causal language model.
External evaluation repositories should load it with
trust_remote_code=True and use the causal backend.
Dependencies
Install the runtime dependencies before loading the model:
pip install torch transformers safetensors sentencepiece pypinyin jieba
sentencepiece is required for the SentencePiece tokenizer. pypinyin is required
for raw Mandarin-to-pinyin preprocessing. jieba is required when
use_jieba is true; this export was created with use_jieba=true.
Loading
from transformers import (
AutoConfig,
AutoModel,
AutoModelForCausalLM,
AutoModelForSequenceClassification,
AutoTokenizer,
)
model_path = "PATH_OR_REPO_ID"
config = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
base_model = AutoModel.from_pretrained(model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True)
classifier = AutoModelForSequenceClassification.from_pretrained(
model_path,
trust_remote_code=True,
num_labels=3,
)
Evaluation
Configure external evaluators with:
- model path: this local folder or Hugging Face repo ID
- backend:
causal - trust remote code: enabled
The tokenizer accepts raw text through standard calls such as
tokenizer(text), tokenizer(text, add_special_tokens=False), and
tokenizer(texts, padding=True, truncation=True, return_tensors="pt").
It also accepts return_offsets_mapping=True for compatibility with
completion-ranking evaluators that need suffix masks. The model supports
output_hidden_states=True for representation extraction tasks.
This export sets patch_pathlib_utf8_open=true in config.json.
When loaded with trust_remote_code=True, the config installs a narrow
Windows compatibility shim so later text-mode Path.open("r") calls
without an explicit encoding default to UTF-8. Set
PINYIN_CODE_DISABLE_UTF8_OPEN_PATCH=1 before loading the model to
disable that shim.
Export metadata:
- tokenizer_kind:
sentencepiece - transliteration:
pinyin-code - use_jieba:
true
- Downloads last month
- 28