02_EBD_preprocessing_and_vanilla_colab.ipynb used deprecated MIOFlow (not 2.0) architecture. Updated and tested it. Works now.#28
Open
GiuGiglio wants to merge 1 commit into
Conversation
…autoencoder pipeline This commit fixes a critical GPU device mismatch in the MIOFlow core and massively overhauls the EBD tutorial notebook to use the modern Geometric Autoencoder (GAGA) pipeline instead of the older, manual PHATE DataFrame approach. ### Core Changes (mioflow/mioflow.py): * Fixed GPU Device Mismatch Bug: When running on CUDA, _encode() and decode_to_gene_space() previously crashed with a device mismatch (cuda:0 vs cpu). The internal torch.tensor(X_scaled) and torch.tensor(traj_flat) calls were defaulting to the CPU, while the gaga_autoencoder model sat on the GPU. Added device=self.device to these tensor instantiations to ensure device synchronization. ### Tutorial Notebook Changes (tutorials/02_EBD_preprocessing_and_vanilla_colab.ipynb): * Removed legacy PHATE DataFrame logic and instead set discrete_time directly via pd.factorize. * Integrated GAGA Autoencoder Training: Added the missing cell to explicitly train the GAGA autoencoder (fit_gaga) using X_pca and X_phate. * Corrected MIOFlow Initialization: Replaced the deprecated input_df and obsm_key parameters with the modernized Autoencoder configuration (gaga_model=gaga_model and gaga_input_key='X_pca'). * Overhauled Loss Visualization: Replaced the generic plot_losses() function call with a detailed, custom matplotlib block. * Modernized Trajectory Visualization (Step 11): Re-wrote the visualization block to natively evaluate background cells through the trained gaga_model.encode() pipeline, plotting the trajectories directly on the GAGA latent embedding instead of PHATE. * Fixed Scanpy Namespace Collision: Added import scanpy as sc directly before running highly_variable_genes. The previous scatterplot assignment (sc = ax.scatter) overwrote the scanpy as sc module. * Updated Single-Trajectory Selection: Swapped the background scatter data from true_data (PHATE) to gaga_embedding (GAGA).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix device mismatch in MIOFlow core and upgrade EBD tutorial to GAGA autoencoder pipeline
This commit fixes a critical GPU device mismatch in the MIOFlow core and massively overhauls the EBD tutorial notebook to use the modern Geometric Autoencoder (GAGA) pipeline instead of the older, manual PHATE DataFrame approach.
Core Changes (mioflow/mioflow.py):