Views
No views yet
meta-llama/Llama-3.2-3B-Instruct specifically trained to act as an expert geopolitical analyst. It takes raw intelligence and event data (such as GDELT conflict metrics, Goldstein scales, and media tone) and generates structured, evidence-based forecasts on short-term trajectories and long-term perspectives.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5# 1. Load the Base Model
6base_model_id = "meta-llama/Llama-3.2-3B-Instruct"
7tokenizer = AutoTokenizer.from_pretrained(base_model_id)
8
9base_model = AutoModelForCausalLM.from_pretrained(
10 base_model_id,
11 torch_dtype=torch.float16,
12 device_map="auto"
13)
14
15# 2. Load this fine-tuned LoRA adapter
16adapter_repo = "nafis8766/geopolitical-forecasting-llm-merged"
17model = PeftModel.from_pretrained(base_model, adapter_repo)
18
19# 3. Format the Prompt
20events = "On May 10, 2025, border skirmishes were reported..."
21messages = [
22 {"role": "system", "content": "You are an expert geopolitical analyst..."},
23 {"role": "user", "content": f"Analyze the following events and forecast the short-term trajectory:\n{events}"}
24]
25
26inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
27outputs = model.generate(inputs, max_new_tokens=1024)
28print(tokenizer.decode(outputs[0]))