Skip to content

Conversation

@amarzullo24
Copy link
Collaborator

@amarzullo24 amarzullo24 commented Dec 30, 2024

Notebook for Chapter 11 (temporal graphML)

TODO:

  • Test on Colab
  • Test with poetry

Copy link
Owner

@deusebio deusebio left a comment

Choose a reason for hiding this comment

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

Thanks @amarzullo24 ! This is indeed quite good! We need to resolve a few issues attached (especially linked to OpenTLP) and create a proper poetry environment before merging.

I'm happy to help to create the Poetry environment, after we consolidate and resolve the few major issues attached. In order to do this, it would also be super helpful if you could also export the full environemnt that you have on Google Colab, such that I can reproduce it using poetry

"# Import necessary libraries and modules\n",
"import numpy as np\n",
"import torch\n",
"from TMF.TMF import TMF # Custom TMF implementation\n",
Copy link
Owner

Choose a reason for hiding this comment

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

issue I had a look at the repository. Unfortunately it does not include any dependency and/or constraints. Despite it provides a number of interesting implementations, it does not provide any stable environments and I'd rather just include the module (i.e. TMF.TMF) that we need given the impossibility of properly wiring this with poetry

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that's why in the notebook I'm cloning the repo on the fly. Can I leave it as it is?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Currently we clone the repo on the fly so that all the pipeline it's self contained.

"source": [
"# Unzip the sample graph\n",
"%cd /content/OpenTLP/Python\n",
"!cd data && unzip data.zip"
Copy link
Owner

Choose a reason for hiding this comment

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

todo given we should probably copy and paste the relevant bits from the module, we can probably just curl the data.zip and unzip its content with pure python code, as much as it is done here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't get, sorry! Are you asking to just do the unzip in pure python or there's something more?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Modified to use only Python to unzip

"# install StellarGraph from this modified repo if running on Google Colab\n",
"import sys\n",
"if 'google.colab' in sys.modules:\n",
" !pip install git+https://github.com/VenkateshwaranB/stellargraph.git"
Copy link
Owner

Choose a reason for hiding this comment

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

question Why are we not using the "official" stellar graph? is there any implementation in this fork that are relevant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The official StellarGraph repo has some problems with Colab (I think we can use the original one locally). Check here

Copy link
Owner

@deusebio deusebio Jan 5, 2025

Choose a reason for hiding this comment

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

That's probably because of the Python version, and that's why we had to pin the python version in other chapters to 3.8. I would be consistent and stick to Python 3.8 and the official stellargraph version here as well, unless we have strong reason (e.g. the other repo implementing some functionalities needed for temporal graph ML) to not do that

We can consider to bump the Python to 3.10 across and use a different version of stellargraph, but I would do it for all the chapters

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. Using StellarGraph from requirements

" !pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html\n",
" !pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html\n",
" !pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-{TORCH}+{CUDA}.html\n",
" !pip install torch-geometric"
Copy link
Owner

Choose a reason for hiding this comment

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

todo we should remove this and use proper poetry environments. I can take care of this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is just for testing in Colab. I think the poetry environment should work

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@deusebio
Copy link
Owner

@amarzullo24 could you have a look at the comments? We still need to integrate this with poetry and enable testing in CI to merge this PR

@deusebio
Copy link
Owner

I can look more into Poetry integration, but I would need the export for the env, such that I don't have to figure out the versions of the packages myself, also with a trial-and-error. If you take care of making the notebook self-contained, by also curling external datasets, then we should be good

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