Skip to content

Remove dead pre-2.0 VAE and Graph_TorchvisionModel - #1210

Open
fbonc wants to merge 2 commits into
sunlabuiuc:masterfrom
fbonc:fix-vae-graphtorchvision-stale-init
Open

Remove dead pre-2.0 VAE and Graph_TorchvisionModel#1210
fbonc wants to merge 2 commits into
sunlabuiuc:masterfrom
fbonc:fix-vae-graphtorchvision-stale-init

Conversation

@fbonc

@fbonc fbonc commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Issue

VAE (vae.py) and Graph_TorchvisionModel (graph_torchvision_model.py) call BaseModel.__init__ with the pre-2.0 signature (dataset, feature_keys, label_key, mode), but the current BaseModel.__init__ accepts only dataset. Instantiating either class therefore always raises TypeError, so both are unusable. They are pre-2.0 dead code: beyond the constructor, Graph_TorchvisionModel also calls get_label_tokenizer(), get_output_size(tokenizer), and prepare_labels(), none of which exist on the current BaseModel. Both classes are exported from pyhealth.models but referenced nowhere in the library or test suite.

Fix

Removed the two dead modules (pyhealth/models/vae.py, pyhealth/models/graph_torchvision_model.py) and their exports in pyhealth/models/__init__.py. Also removed the now-dangling VAE autodoc page (docs/api/models/pyhealth.models.VAE.rst) and its toctree entry in docs/api/models.rst, which would otherwise break the docs build.

Notes

Two example files still reference the removed classes: examples/cxr/chextXray_image_generation_VAE.py and examples/graph_torchvision_model.ipynb. They were already non-functional (their models could never be constructed) and were left in place to keep this pr scoped to the dead library code. Also historical mentions in docs/log.rst (changelog) and docs/tutorials.rst (example listing) werEeleft untouched as they do not break the build.

Both call BaseModel.__init__ with the pre-2.0 (dataset, feature_keys,
label_key, mode) signature and always raise TypeError on construction;
they also use other removed pre-2.0 APIs and are referenced nowhere in
the library or tests. Remove the modules, their exports, and the dangling
VAE autodoc page.
@DarylOkeke

DarylOkeke commented Aug 28, 2026

Copy link
Copy Markdown

These removals leave two tracked examples importing names that no longer exist: examples/cxr/chextXray_image_generation_VAE.py imports VAE, and examples/graph_torchvision_model.ipynb imports Graph_TorchvisionModel. They may already have failed later during construction, but after this PR they fail immediately on import and still advertise removed APIs. Could those examples be removed or updated as part of the cleanup?

@fbonc

fbonc commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

These removals leave two tracked examples importing names that no longer exist: examples/cxr/chextXray_image_generation_VAE.py imports VAE, and examples/graph_torchvision_model.ipynb imports Graph_TorchvisionModel. They may already have failed later during construction, but after this PR they fail immediately on import and still advertise removed APIs. Could those examples be removed or updated as part of the cleanup?

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants