How kagamibaka/dlol works
Project type and purpose
• This is a research‐oriented PyTorch codebase implementing “Dynamic Label-Order Learning” for multi-label classification (event extraction) on the Reuters dataset, based on the AAAI’24 paper. It is neither a traditional full-stack app nor a microservice; it’s an ML pipeline/research tool.
File structure
• Top-level directories:
• data/ & data_convert/: raw and processed data, conversion scripts
• seq2seq/: model architecture and utilities
• extraction/: post-prediction parsing and metric calculation
• scripts/: auxiliary bash/python preprocessing
• Key files/scripts:
• run_reuters.sh & run_seq2seq*.bash / run_seq2seq.py – orchestrate training/inference
• evaluation.py & run_eval.bash – compute final metrics
• checkpoint-*/ – serialized model and prediction outputs
README for insights
• Confirms the pipeline steps: environment setup → data preprocessing → training (run_reuters.sh) → evaluation (run_eval.bash).
• Core frameworks: Python 3.10, PyTorch, CUDA, BART.
Main components & their relationships
A. Data Layer
– Raw JSON files: data/reuters/*.json
– Shuffled splits: data/reuters/shuffled/{train,dev,test}.json
B. Data Conversion
– data_convert/ (convert_text_to_tree.py, task_format/, format/)
– scripts/processing_data.bash
→ Outputs model-ready inputs (tree/text formats)
C. Model Training & Inference
– run_reuters.sh invokes run_seq2seq.py / run_seq2seq_verbose.bash
– my_bart.py wraps the BART model
– seq2seq/: constrained_seq2seq.py, label_smoother_sum.py, utils.py, sentence_splitter.py
→ Produces model checkpoints under checkpoint-* and raw prediction files
D. Prediction Parsing & Extraction
– extraction/predict_parser/ (tree_predict_parser.py)
– extraction/extract_constraint.py, label_tree.py, event_schema.py
– extraction/extraction_metrics.py, calc_header_f_score_UFET.py
→ Converts raw seq2seq outputs into structured event labels
E. Evaluation
– evaluation.py + run_eval.bash
– Consumes parsed predictions and gold data → computes final scores (test_results_seq2seq.txt)
Architectural patterns & design principles
• Pipeline modularity: clear separation of preprocessing, model, parsing, evaluation
• Reusable scripts to orchestrate each stage
• Directory grouping by functionality (data, model, extraction)
Final reminders
• Be highly detailed: include every major submodule and script
• Data formats at each stage (raw JSON → tree format → tokenized input → raw text preds → structured events)
• Don’t overthink: separate the system into these functional components and illustrate their connectivity clearly