Text Classification
Transformers
Safetensors
English
Korean
Japanese
qev_decision_merged
feature-extraction
qev
typed-decision
custom-code
bf16
custom_code
Instructions to use querypieai/QEV-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use querypieai/QEV-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="querypieai/QEV-9B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("querypieai/QEV-9B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download head_qev.py from querypieai/QEV-9B: direct link, hf CLI and curl.
- Browser
- Download file 812 Bytes
-
https://huggingface.co/querypieai/QEV-9B/resolve/main/head_qev.py
- Command line
-
hf download hf://querypieai/QEV-9B/head_qev.py
-
curl -L -o head_qev.py https://huggingface.co/querypieai/QEV-9B/resolve/main/head_qev.py
812 Bytes
| from __future__ import annotations | |
| import math | |
| import torch | |
| from torch import nn | |
| class PointerHead(nn.Module): | |
| """Scores each option boundary against the question decision state.""" | |
| def __init__(self, hidden_size: int, pointer_dim: int = 256, dropout: float = 0.0): | |
| super().__init__() | |
| self.query = nn.Linear(hidden_size, pointer_dim) | |
| self.key = nn.Linear(hidden_size, pointer_dim) | |
| self.dropout = nn.Dropout(dropout) | |
| self.scale = 1 / math.sqrt(pointer_dim) | |
| self.temperature = 1.0 | |
| def forward(self, decision: torch.Tensor, options: torch.Tensor) -> torch.Tensor: | |
| logits = (self.key(self.dropout(options)) * self.query(self.dropout(decision))).sum(-1) * self.scale | |
| return logits if self.training else logits / float(self.temperature) | |