| title: Pseudoscorex Encoder | |
| emoji: 🧮 | |
| colorFrom: indigo | |
| colorTo: purple | |
| sdk: gradio | |
| sdk_version: 5.6.0 | |
| python_version: "3.12" | |
| app_file: app.py | |
| pinned: false | |
| # pseudoscore-x encoder | |
| CodeT5-large encoder with `<criterion>` and `<score>` special tokens added | |
| (matching the training notebook). Returns per-token hidden states for the | |
| backend's scoring head. | |
| ## API | |
| ```python | |
| from gradio_client import Client | |
| client = Client("YOUR_USERNAME/pseudoscorex-encoder") | |
| out = client.predict("hello world", api_name="/encode") | |
| # out = { | |
| # "hidden_b64": "<base64 float16 array>", | |
| # "shape": [512, 1024], | |
| # "attention_mask": [...], | |
| # "clean_tokens": [...], | |
| # } | |
| ``` | |
| ## Decoding hidden states | |
| ```python | |
| import base64, numpy as np | |
| arr = np.frombuffer(base64.b64decode(out["hidden_b64"]), dtype=np.float16) | |
| arr = arr.reshape(out["shape"]) # (seq_len, 1024) | |
| ``` | |
| ## Hardware | |
| Runs on the free CPU tier. Encoder is loaded once at boot and weights are | |
| frozen, so each request is just a forward pass. | |