Downloads · 30 days
19
16% of all-time downloads
LeviDeHaan/SmolNewsAnalysis-002
SmolNewsAnalysis-002 is a text generation model from LeviDeHaan. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
- Hugging Face model card: https://huggingface.co/LeviDeHaan/SmolNewsAnalysis-002 - Author: Levi De Haan - Project overview: https://levidehaan.com/projects/twatter
Downloads · 30 days
19
16% of all-time downloads
All-time downloads
122
Public
Parameters
362M
724 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors724 MB · 99%
From the Hugging Face model README
SmolNewsAnalysis-002)HuggingFaceTB/SmolLM2-360M-Instruct (360M parameters, Apache-2.0)....).SharedLLMManager.TrainedModelClient and invoked by stock_news_processor.py for Alpaca feed scoring.[-1, 1] summarizing bullish/bearish tone.0-1).Extremely Bad News, Bad News, Meh News, Regular News, Big News, or Huge News.0-1).chat_template.jinja and Modelfile when missing:You are a precise financial news analyst. Read the news text and output a compact JSON with fields: symbol, site, source_name, sentiment_score, sentiment_confidence, wow_score, wow_confidence. Output only the JSON without commentary.
<|im_start|>system
You are a precise financial news analyst. Read the news text and output a compact JSON with fields: symbol, site, source_name, sentiment_score, sentiment_confidence, wow_score, wow_confidence. Output only the JSON without commentary.<|im_end|>
<|im_start|>user
<news article title/summary + metadata>
<|im_end|>
<|im_start|>assistant
[INST] framing used in SharedLLMManager.TrainedModelClient.generate() when TRAINED_MODEL_TYPE="llama":<s>[INST] <<SYS>>
You are a precise financial news analyst. Read the news text and output a compact JSON with fields: symbol, site, source_name, sentiment_score, sentiment_confidence, wow_score, wow_confidence. Output only the JSON without commentary.
<</SYS>>
<news article title/summary + metadata> [/INST]
Output Must be a single JSON object; downstream parsing stops at the first closing brace.
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "LeviDeHaan/SmolNewsAnalysis-002"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto")
prompt = """<|im_start|>system
You are a precise financial news analyst...<|im_end|>\n"""
prompt += "<|im_start|>user\nTesla shares climb after deliveries beat expectations. Symbol: TSLA Site: bloomberg.com\n<|im_end|>\n<|im_start|>assistant\n"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=160, temperature=0.1)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
stock_news_processor.py and exported through extract_stock_json_news_training.py to training_data/news_data/stock_news_training.json.Big News 645, Regular News 272, Bad News 253, Huge News 198, Meh News 120, Extremely Bad News 16 (plus 2 legacy Bad News (negative but not catastrophic) entries coerced to canonical values at inference time).learning_rate=5e-5, per_device_train_batch_size=2, gradient_accumulation_steps=8, num_train_epochs=10, cutoff_len=2048, lora_r=8, lora_alpha=16, lora_dropout=0, lr_scheduler_type=cosine_with_restarts, max_grad_norm=1.0, warmup_steps=0.num_input_tokens_seen in all_results.json).stock_news_processor.py trims to 1800 chars).symbol values.Regular News via analyzer normalization.