Text Classification
Transformers
Safetensors
English
shannon2
feature-extraction
finance
news
macro
financial-news
custom_code
Instructions to use BinomialTechnologies/binomial-shannon-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BinomialTechnologies/binomial-shannon-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="BinomialTechnologies/binomial-shannon-2", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("BinomialTechnologies/binomial-shannon-2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
| """Configuration class for binomial-shannon-2 (router + ticker + macro). | |
| Ships with the model on HuggingFace Hub so | |
| `AutoConfig.from_pretrained(repo, trust_remote_code=True)` works. | |
| """ | |
| from __future__ import annotations | |
| from transformers.configuration_utils import PretrainedConfig | |
| # Ticker mode (Shannon-1 schema) | |
| EVENTS = ( | |
| "earnings", "guidance", "m_and_a", "regulatory_legal", "product", | |
| "exec_change", "dividend_buyback", "analyst_rating", "macro_sector", "other", | |
| ) | |
| CLAIM_TYPES = ("fact", "opinion", "rumor", "forecast") | |
| # Macro mode | |
| TOPICS = ( | |
| "monetary_policy", "fiscal_policy", "inflation", "growth", "labor", | |
| "rates_fixed_income", "equities_markets", "fx_currency", "energy", | |
| "commodities", "credit_banking", "crypto", "mergers_acquisitions", | |
| "trade_policy", "geopolitics", "single_company", "technicals", "other", | |
| ) | |
| SEVERITY_BUCKETS = ("noise", "minor", "notable", "major", "crisis") | |
| NOVELTY_BUCKETS_MACRO = ("rehash", "commentary", "breaking") | |
| CLAIM_TYPES_MACRO = ("fact", "opinion", "rumor", "forecast") | |
| HAWKISH_DOVISH_BUCKETS = ( | |
| "dovish", "mildly_dovish", "neutral", "mildly_hawkish", "hawkish", | |
| ) | |
| class Shannon2Config(PretrainedConfig): | |
| """Config for Shannon2MultiHead. | |
| Shared encoder + 2-way router + ticker head bank (19 outputs, inherited | |
| from shannon-1) + macro head bank (35 outputs). Mirrors shannon-1's hub | |
| configuration approach. | |
| """ | |
| model_type = "shannon2" | |
| def __init__( | |
| self, | |
| encoder_name_or_path: str = "answerdotai/ModernBERT-base", | |
| max_position_embeddings: int = 4096, | |
| head_h1: int = 512, | |
| head_h2: int = 256, | |
| dropout: float = 0.1, | |
| events: tuple[str, ...] = EVENTS, | |
| claim_types: tuple[str, ...] = CLAIM_TYPES, | |
| topics: tuple[str, ...] = TOPICS, | |
| severity_buckets: tuple[str, ...] = SEVERITY_BUCKETS, | |
| novelty_buckets_macro: tuple[str, ...] = NOVELTY_BUCKETS_MACRO, | |
| claim_types_macro: tuple[str, ...] = CLAIM_TYPES_MACRO, | |
| hawkish_dovish_buckets: tuple[str, ...] = HAWKISH_DOVISH_BUCKETS, | |
| **kwargs, | |
| ) -> None: | |
| super().__init__(**kwargs) | |
| self.encoder_name_or_path = encoder_name_or_path | |
| self.max_position_embeddings = max_position_embeddings | |
| self.head_h1 = head_h1 | |
| self.head_h2 = head_h2 | |
| self.dropout = dropout | |
| self.events = list(events) | |
| self.claim_types = list(claim_types) | |
| self.topics = list(topics) | |
| self.severity_buckets = list(severity_buckets) | |
| self.novelty_buckets_macro = list(novelty_buckets_macro) | |
| self.claim_types_macro = list(claim_types_macro) | |
| self.hawkish_dovish_buckets = list(hawkish_dovish_buckets) | |