Views
No views yet
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.1<|im_start|>system
2You 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|>
3<|im_start|>user
4<news article title/summary + metadata>
5<|im_end|>
6<|im_start|>assistant
7[INST] framing used in SharedLLMManager.TrainedModelClient.generate() when TRAINED_MODEL_TYPE="llama":1<s>[INST] <<SYS>>
2You 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.
3<</SYS>>
4
5<news article title/summary + metadata> [/INST]1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3model_id = "LeviDeHaan/SmolNewsAnalysis-002"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto")
6
7prompt = """<|im_start|>system
8You are a precise financial news analyst...<|im_end|>\n"""
9prompt += "<|im_start|>user\nTesla shares climb after deliveries beat expectations. Symbol: TSLA Site: bloomberg.com\n<|im_end|>\n<|im_start|>assistant\n"
10
11inputs = tokenizer(prompt, return_tensors="pt")
12outputs = model.generate(**inputs, max_new_tokens=160, temperature=0.1)
13response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
14print(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.