How ilyalasy/dom-lm works
DOM-LM is an unofficial PyTorch implementation for learning from webpage structure. The principal workflow is SWDE HTML pages → DOM-aware feature preprocessing → serialized feature dataset → whole-node masked-language-model training. The model combines DOM/tree embeddings with a Transformer encoder and task heads. The README also identifies fine-tuning for attribute extraction, open information extraction, and QA as future work; the code exposes token-classification and QA model classes, but no complete fine-tuning workflow is documented. Arrows reflect shown calls, data handling, or README workflow; unsampled details are omitted.
Main entry points: train.py Training orchestration · preprocess_swde.py SWDE preprocessing · preprocess.py DOM features · modeling_domlm.py Masked-LM head
Components 17
DOM preprocessing
- HTML cleanup
src/html_utils.py - DOM features
src/preprocess.py - SWDE preprocessing
src/preprocess_swde.py
Training data
- Feature files
- SWDE dataset
src/dataset.py - Node-mask collator
src/data_collator.py
DOM-LM model
- Model configuration
src/domlm/configuration_domlm.py - DOM embeddings
src/domlm/modeling_domlm.py - Transformer encoder
src/domlm/modeling_domlm.py - Masked-LM head
src/domlm/modeling_domlm.py - Task heads
src/domlm/modeling_domlm.py
Training and tasks
- Training orchestration
src/train.py - Trained MLM
- Attribute extraction
src/preprocess.py - Question answering
src/domlm/modeling_domlm.py
Other components
- Researcher
- SWDE HTML
Connections 17
- Researcher → SWDE preprocessing: runs preprocessing
README.md - SWDE HTML → SWDE preprocessing: provides pages
src/preprocess_swde.py - SWDE preprocessing → DOM features: extracts features
src/preprocess_swde.py - DOM features → HTML cleanup: cleans HTML
src/preprocess.py - SWDE preprocessing → Feature files: writes features
src/preprocess_swde.py - Feature files → SWDE dataset: loads pickles
src/dataset.py - Researcher → Training orchestration: runs training
README.md - Training orchestration → SWDE dataset: uses samples
src/train.py - Training orchestration → Node-mask collator: configures batches
src/train.py - Training orchestration → Masked-LM head: trains model
src/train.py - Model configuration → DOM embeddings: configures
src/domlm/modeling_domlm.py - DOM embeddings → Transformer encoder: feeds representations
src/domlm/modeling_domlm.py - Transformer encoder → Masked-LM head: feeds hidden states
src/domlm/modeling_domlm.py - Training orchestration → Trained MLM: produces
src/train.py - DOM features → Attribute extraction: supports task features
src/preprocess.py - Masked-LM head → Task heads: shares DOMLM backbone
src/domlm/modeling_domlm.py - Task heads → Question answering: includes QA model
src/domlm/modeling_domlm.py