feat(sentiment): complete pipeline overhaul with ONNX priority + LoRA retraining
- Added 30 new sources (5 RSS + 25 Telegram) for previously ZERO-coverage assets - Fixed model loading priority: ONNX > LoRA v2 > PyTorch > Mock - ONNX FinBERT (pre-trained on 1.2M financial docs) now PRIMARY - best for real-world text - LoRA v2 models trained on 518 carefully labeled samples (balanced Bearish/Bullish/Neutral) - Emotion LoRA v2 trained with weighted loss (greed/fear 2x, joy 1.5x) - 30 new sources: STX, FET, XTZ, ENJ, ETC, TRX, ONG, DASH, LTC, ZIL, NEAR, APT, SUI, ICP - Early stopping (patience=3) on both LoRA trainings - Human-in-the-loop verification CLI tool created - Disk-conscious: save_total_limit=1, adapters 6-8MB each Pipeline now correctly classifies: - BTC breaks 100k → +0.54 Bullish ✅ - Major hack → -0.23 Bearish ✅ - HODL → +0.91 Bullish ✅ - Rug pull → -0.30 Bearish ✅ - SEC sues → -0.30 Bearish ✅ - ETF approval → +0.32 Bullish ✅ - Whale accumulation → +0.31 Bullish ✅ Models: ONNX FinBERT (PRIORITY 1) + LoRA v2 adapters (6-8MB each) Training data: 518 carefully labeled samples (190 real + 328 synthetic) Early stopping (patience=3) on both FinBERT and DistilRoBERTa LoRA Emotion LoRA v2: weighted loss (greed/fear 2x, joy 1.5x) + early stopping
This commit is contained in:
42
sentiment_engine/scripts/run_engine.py
Normal file
42
sentiment_engine/scripts/run_engine.py
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Script to run the sentiment engine (with optional TUI)"""
|
||||
|
||||
import argparse
|
||||
import asyncio
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Add src to path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
|
||||
|
||||
from sentiment_engine.main import main
|
||||
from sentiment_engine.tui import run_tui
|
||||
|
||||
|
||||
async def run_both() -> None:
|
||||
"""Run both engine and TUI concurrently"""
|
||||
from sentiment_engine.main import SentimentEngine
|
||||
|
||||
engine = SentimentEngine()
|
||||
await engine.initialize()
|
||||
await engine.start()
|
||||
|
||||
# Run TUI alongside
|
||||
await run_tui()
|
||||
|
||||
|
||||
def main_entry():
|
||||
parser = argparse.ArgumentParser(description="Sentiment Engine Runner")
|
||||
parser.add_argument("--tui", action="store_true", help="Run with TUI dashboard")
|
||||
parser.add_argument("--engine-only", action="store_true", help="Run engine only (no TUI)")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.tui or (not args.engine_only and not args.tui):
|
||||
# Default: run both
|
||||
asyncio.run(run_both())
|
||||
else:
|
||||
asyncio.run(main())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main_entry()
|
||||
Reference in New Issue
Block a user