How panzijie825/s2ip-llm works
Project Type and Purpose
• This is a research-oriented machine-learning pipeline for time-series forecasting.
• It provides both Long-term and Short-term forecasting modules, each ingesting data, preprocessing it, learning prompts for an LLM, and evaluating predictions.
File Structure
• Top-level folders:
• Long-term_Forecasting
• Short-term_Forecasting
• Each forecasting folder contains:
• data_provider (data ingestion & loading)
• models (S2IPLLM model and prompt logic)
• utils (preprocessing, metric calculation, tokenization)
• scripts (shell scripts to launch experiments for different datasets)
• runner scripts (run.py / run_m4.py)
• exp folder in Long-term (experiment orchestration code)
• A shared requirements.txt and environment setup; external datasets download from Google Drive.
README for Insights
• Dependencies managed via Conda and pip.
• Data must be placed under ./data/.
• Execution is via shell scripts that invoke Python runners.
• No web UI or microservice boundaries—this is a batch ML pipeline.
Main Components & Their Interactions
• Data Ingestion
• External Data Source (Google Drive) → Local ./data/
• data_provider/data_loader → pandas or PyTorch Datasets
• Preprocessing & Feature Engineering
• utils/timefeatures, masking, tokenization → transformed tensors
• Model & Prompt Module
• models/S2IPLLM.py (core LLM interface)
• models/prompt.py (prompt construction logic)
• Experiment Runner
• Long-term: exp_basic.py, exp_long_term_forecasting.py → orchestrate training loops, logging
• Short-term: run_m4.py → similar orchestration for M4 data
• Script Launcher
• scripts/*.sh → pass dataset-specific parameters into runners
• Evaluation & Metrics
• utils/metrics.py, m4_summary.py, losses.py → compute performance, save logs
• Environment & Dependencies
• Conda environment, requirements.txt
Relationships & Data Flow
• Feedback loops if any (e.g., hyperparameter tuning or multi-stage experiments in exp/).
Architectural Patterns & Design Principles
• Modularity: clear separation between data ingestion, preprocessing, modeling, and evaluation.
• Reusability: shared utils across both forecasting modules.
• Experiment Repeatability: shell scripts + runner scripts enforce reproducible runs.
• Layered pipeline: Data → Feature Engine → Model → Evaluation.
Technologies & Frameworks
• Python 3.10
• Conda + pip
• PyTorch or TensorFlow (implied by LLM usage)
• Large Language Model API or library (e.g., Hugging Face Transformers)
• Shell for scripting experiments
• pandas, NumPy for data handling