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
File size: 812 Bytes
96adfbe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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)
|