Text Generation
Transformers
Safetensors
Dutch
Chinese
gpt2
causal-lm
language-model
babylm
babylm-2026
multilingual
paradigmfinder
text-generation-inference
Instructions to use NeTSlab/gpt2_parfind_nl_zh_equal with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NeTSlab/gpt2_parfind_nl_zh_equal with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NeTSlab/gpt2_parfind_nl_zh_equal")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NeTSlab/gpt2_parfind_nl_zh_equal") model = AutoModelForCausalLM.from_pretrained("NeTSlab/gpt2_parfind_nl_zh_equal", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NeTSlab/gpt2_parfind_nl_zh_equal with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NeTSlab/gpt2_parfind_nl_zh_equal" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NeTSlab/gpt2_parfind_nl_zh_equal", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/NeTSlab/gpt2_parfind_nl_zh_equal
- SGLang
How to use NeTSlab/gpt2_parfind_nl_zh_equal 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 "NeTSlab/gpt2_parfind_nl_zh_equal" \ --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": "NeTSlab/gpt2_parfind_nl_zh_equal", "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 "NeTSlab/gpt2_parfind_nl_zh_equal" \ --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": "NeTSlab/gpt2_parfind_nl_zh_equal", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use NeTSlab/gpt2_parfind_nl_zh_equal with Docker Model Runner:
docker model run hf.co/NeTSlab/gpt2_parfind_nl_zh_equal
Add files using upload-large-folder tool
Browse files- revision_info.json +1 -1
- tokenizer.py +12 -0
revision_info.json
CHANGED
|
@@ -9,5 +9,5 @@
|
|
| 9 |
"This matches the packaged top-level model checkpoint."
|
| 10 |
],
|
| 11 |
"source_checkpoint_dir": "/home/achille.fusco/pr_baby_lm/BabyLM_2026_ENH/04-experiments/model_gpt2_ParFindFast_nld_zho_BD_budget16k_zhchildes_v1.0/checkpoints/epoch_9",
|
| 12 |
-
"target_bundle_dir": "/home/achille.fusco/pr_baby_lm/BabyLM_2026_ENH/03-models/
|
| 13 |
}
|
|
|
|
| 9 |
"This matches the packaged top-level model checkpoint."
|
| 10 |
],
|
| 11 |
"source_checkpoint_dir": "/home/achille.fusco/pr_baby_lm/BabyLM_2026_ENH/04-experiments/model_gpt2_ParFindFast_nld_zho_BD_budget16k_zhchildes_v1.0/checkpoints/epoch_9",
|
| 12 |
+
"target_bundle_dir": "/home/achille.fusco/pr_baby_lm/BabyLM_2026_ENH/03-models/gpt2_parfind_nl_zh_equal_tokfix/main_bundle"
|
| 13 |
}
|
tokenizer.py
CHANGED
|
@@ -441,8 +441,20 @@ class EnhancedParadigmTokenizerWrapper(PreTrainedTokenizerFast):
|
|
| 441 |
if filename in {"paradigms.json", "tokenizer.json"}:
|
| 442 |
return None
|
| 443 |
|
|
|
|
| 444 |
for path in downloaded:
|
| 445 |
candidate = Path(path).parent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
if (candidate / "tokenizer.json").is_file() and (candidate / "paradigms.json").is_file():
|
| 447 |
return str(candidate)
|
| 448 |
return None
|
|
|
|
| 441 |
if filename in {"paradigms.json", "tokenizer.json"}:
|
| 442 |
return None
|
| 443 |
|
| 444 |
+
snapshot_candidates = []
|
| 445 |
for path in downloaded:
|
| 446 |
candidate = Path(path).parent
|
| 447 |
+
snapshot_candidates.append(candidate)
|
| 448 |
+
for parent in Path(path).parents:
|
| 449 |
+
snapshot_candidates.append(parent / "snapshots" / str(revision))
|
| 450 |
+
|
| 451 |
+
seen = set()
|
| 452 |
+
for candidate in snapshot_candidates:
|
| 453 |
+
candidate = Path(candidate)
|
| 454 |
+
key = str(candidate)
|
| 455 |
+
if key in seen:
|
| 456 |
+
continue
|
| 457 |
+
seen.add(key)
|
| 458 |
if (candidate / "tokenizer.json").is_file() and (candidate / "paradigms.json").is_file():
|
| 459 |
return str(candidate)
|
| 460 |
return None
|