Skip to content

Refactor: Drop TensorFlow#42

Draft
Chenghao-Tan wants to merge 7 commits intocharmlab:mainfrom
Chenghao-Tan:refactor--Drop-TensorFlow
Draft

Refactor: Drop TensorFlow#42
Chenghao-Tan wants to merge 7 commits intocharmlab:mainfrom
Chenghao-Tan:refactor--Drop-TensorFlow

Conversation

@Chenghao-Tan
Copy link
Contributor

@Chenghao-Tan Chenghao-Tan commented Feb 13, 2026

Refactor: Drop TensorFlow & Bump Dependencies

This PR drops TensorFlow support and bumps python to 3.12, torch to 2.10(+CUDA12.8).

Working Methods

The methods below are tested with linear target model (tree target model for feature_tweak) and breastcancer dataset, working fine.

  • dice
  • cchvae
  • claproar
  • clue
  • cruds
  • face
  • feature_tweak
  • gravitational
  • gs
  • revise
  • wachter
  • cfvae
  • cfrl
  • probe
  • roar
  • rbr
  • larr
  • mace

Broken Methods

  • cem (need TensorFlow)
  • greedy (need TensorFlow)
  • causal_recourse (need SCM)
  • ar (need purchased version of CPLEX)
  • focus (transplanted, way too slow, not tested)

Fixes

  • Removed TensorFlow-related code and bumped python to 3.12, torch to 2.10(+CUDA12.8).
  • Updated examples to use torch instead
  • Fixed numpy/torch API compatibility
  • Added disabled methods list and tree compatibility list
  • Fixed data/causal_model/causal_model.py with dependency inject
  • Fixed models/catalog/utils.py with dependency inject
  • Transplanted tree target model to torch
  • Fixed face with defensive immutable matrix
  • Fixed autoencoder bce/mse loss compatibility
  • Fixed autoencoder/csvae&vae

Possible Unfavorable/Ongoing Changes

  • Disabled public autoencoder (methods/autoencoder/models/autoencoder.py)
  • Disabled cem
  • Disabled greedy
  • Removed TensorFlow target model
  • Transplanted focus to torch, but way too slow

TODOs

Suggest to do items from up to down.

  • Unify seed and reset it each cycle (experiments/run_experiment.py, and possibly in methods' folders), then re-run all experiments
  • In larr (methods/catalog/larr/model.py), preds_gpu_probs == 0 compares float with int, which is possibly problematic and will cause recourse_needed_X_train to be empty
  • Fix focus
  • Transplant greedy
  • Transplant public autoencoder (methods/autoencoder/models/autoencoder.py)
  • Fix ar
  • Fix causal_recourse
  • Transplant cem
  • Test and clean requirements-dev.txt and setup.py to their minimum, to reduce the risk of dependency incompatibility with other packages
  • (Re-run experiments after everything is fixed)

@amirhk
Copy link
Collaborator

amirhk commented Feb 13, 2026

@HashirA123 @zkhotanlou

Copy link
Contributor

@HashirA123 HashirA123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me. Would love for Zahra to approve as well if she gets the chance. Good catch with the LARR predict_proba comparison. I will check it out and edit as required for the future. Future todos look good too and make sense.

@zkhotanlou
Copy link
Collaborator

Thank you Chenghao, looks good. we are trying to see how the methods are running out of our repo so that we can improve the level of reproducibility. In the current version it seems that there are still some version conflicts. I am running on Python 3.12.10 and there are some packages that require lower versions of python like for nvidia-cufile-cu12 (I have sent the detailed error to you). Can you please check this? Or if you are using a different version of python please let me know.

@Chenghao-Tan Chenghao-Tan changed the title Refactor drop tensor flow Refactor: Drop TensorFlow Feb 24, 2026
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.

4 participants