Text Classification
Transformers
Safetensors
decision-model
classification
julia
open-jev
head-finetune
low-resource
Instructions to use SHSLab/Qyvos with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SHSLab/Qyvos with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="SHSLab/Qyvos")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SHSLab/Qyvos", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Qyvos v1: Julia-1 backbone (bit-exact) + Open-Jev head fine-tune (30k rows, low-RAM protocol)
31f7037 verified Download julia/router/encoder.py from SHSLab/Qyvos: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/SHSLab/Qyvos/resolve/main/julia/router/encoder.py
- Command line
-
hf download hf://SHSLab/Qyvos/julia/router/encoder.py
-
curl -L -o encoder.py https://huggingface.co/SHSLab/Qyvos/resolve/main/julia/router/encoder.py
1.79 kB
| """Inference-only ModernBERT path for decision models (no unused outputs).""" | |
| from types import MethodType | |
| import torch | |
| from transformers.modeling_outputs import BaseModelOutput | |
| def _decision_forward(self, input_ids=None, attention_mask=None, **kwargs): | |
| if self.training or kwargs or input_ids is None or attention_mask is None: | |
| return self._julia_original_forward(input_ids=input_ids, attention_mask=attention_mask, **kwargs) | |
| position_ids = torch.arange(input_ids.shape[1], device=input_ids.device).unsqueeze(0) | |
| full_mask, local_mask = self._update_attention_mask(attention_mask, output_attentions=False) | |
| hidden = self.embeddings(input_ids=input_ids) | |
| # Upstream iterates config.layer_types (one entry per layer), overwriting | |
| # the same two dictionary entries 22 times in this checkpoint. | |
| positions = {kind: self.rotary_emb(hidden, position_ids, kind) for kind in self._julia_attention_types} | |
| for layer in self.layers: | |
| hidden = layer(hidden, attention_mask=full_mask, sliding_window_mask=local_mask, | |
| position_ids=position_ids, cu_seqlens=None, max_seqlen=None, | |
| position_embeddings=positions[layer.attention_type], output_attentions=False)[0] | |
| return BaseModelOutput(last_hidden_state=self.final_norm(hidden)) | |
| def specialize_decision_encoder(model): | |
| encoder = model.encoder | |
| if encoder.config.model_type != 'modernbert' or encoder.config._attn_implementation != 'sdpa': | |
| return False | |
| if hasattr(encoder, '_julia_original_forward'): | |
| return True | |
| encoder._julia_original_forward = encoder.forward | |
| encoder._julia_attention_types = tuple(dict.fromkeys(encoder.config.layer_types)) | |
| encoder.forward = MethodType(_decision_forward, encoder) | |
| return True | |