Hey everyone,
I wanted to share a lightweight open-source tool I built called pklm-sandbox, designed for developers experimenting with custom generation constraints in Hugging Face transformers.
If you frequently build custom token-masking pipelines or experiment with zero-drift linguistic containment using transformers’ LogitsProcessor architecture, this provides a straightforward sandbox to test things locally.
Installation
You can install it directly via pip:
Bash
pip install git+https://github.com/TheImmortalPython/pklm-sandbox.git
Quick Example
Here is how it integrates into a standard generate pipeline:
Python
import torch
from pklm_sandbox.processor import PKLMSandboxProcessor
# Initialize processor to block specific token IDs (e.g., token 42)
processor = PKLMSandboxProcessor(blocked_token_ids=[42])
# Pass it straight into your standard Hugging Face generate() pipeline
# outputs = model.generate(input_ids, logits_processor=[processor], ...)
It’s completely open-source and meant to give developers a clean starting point for custom token control.
Check out the repository and let me know your thoughts or if you have any feedback: GitHub - TheImmortalPython/pklm-sandbox: Official open-source sandbox for PKLM Core, featuring lightweight Hugging Face logits processing and zero-drift linguistic containment. · GitHub