Last active
January 21, 2023 07:32
-
-
Save alchem0x2A/27b4754213e66af9c135a0ce25619668 to your computer and use it in GitHub Desktop.
Initialize google colab with ocpmodels dependencies
This file contains 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
#!/bin/bash | |
# This script runs a bootstrap process to setup gh in google colab and setup the authentication | |
# It requires GITHUB_TOKEN to be set (e.g. use a cell with `getpass`) | |
if [ -z "$GITHUB_TOKEN" ] && [ -z "$GH_TOKEN" ] | |
then | |
echo "Neither GITHUB_TOKEN nor GH_TOKEN not set! Exit" | |
exit 1 | |
fi | |
# Download the gh cli for debian | |
cd /content | |
if [ -z `which gh` ] | |
then | |
wget -q https://github.com/cli/cli/releases/download/v2.21.2/gh_2.21.2_linux_amd64.deb -O gh.deb | |
dpkg -i gh.deb | |
rm gh.deb | |
fi | |
# Check the gh status | |
gh auth status | |
if [[ $? != 0 ]] | |
then | |
echo "Github auth failed. Is the token correct?" | |
exit 1 | |
fi | |
gh auth setup-git | |
echo "Bootstrapping gh finished. Use gh repo clone to start clone your repo" |
This file contains 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
#!/bin/bash | |
# This script runs a bootstrap process for initializing the python dependencies for open catalyst project | |
# under the googl colab root /content | |
# To run the script in a google colab cell, use | |
# !curl -sL <url_to_this_gist> | bash | |
TORCH_VER=`python -c "import torch; print(torch.__version__)"` | |
echo "Using pytorch $TORCH_VER" | |
cd /content | |
git clone https://github.com/Open-Catalyst-Project/ocp.git || true | |
python -m pip install \ | |
ase==3.22 \ | |
matplotlib \ | |
pre-commit==2.10.* \ | |
pymatgen \ | |
pyyaml==5.4.* \ | |
tensorboard\ | |
tqdm==4.58.* \ | |
numba \ | |
Pillow \ | |
wandb \ | |
lmdb==1.1.1 \ | |
pytest==6.2.2 \ | |
submitit \ | |
sphinx-rtd-theme \ | |
pandas \ | |
joblib \ | |
syrupy | |
if [[ $? != 0 ]] | |
then | |
echo "Dependency installation fails!" | |
exit 1 | |
fi | |
# PYG dependencies. Note the torch & cuda version can change according to the google colab version | |
python -m pip install pyg-lib \ | |
torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric \ | |
-f https://data.pyg.org/whl/torch-${TORCH_VER}.html | |
if [[ $? != 0 ]] | |
then | |
echo "PYG installation fails!" | |
exit 1 | |
fi | |
# Install the OCP dependency | |
ln -s /content/ocp/ocpmodels /content || true | |
# Test ocp installation | |
python -c "import ocpmodels; print('OK')" | |
python -c "from ocpmodels.models.gemnet.gemnet import GemNetT; print('OK')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment