Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make hands-on Colab friendly #2

Open
m09 opened this issue Dec 4, 2019 · 2 comments
Open

Make hands-on Colab friendly #2

m09 opened this issue Dec 4, 2019 · 2 comments

Comments

@m09
Copy link
Collaborator

m09 commented Dec 4, 2019

No description provided.

@m09
Copy link
Collaborator Author

m09 commented Jan 24, 2020

After more deliberation, the target to achieve is: no external dependency, or as few as possible.

Every dependency should be installed in the docker image. For Colab, a special cell at the start of the notebook should contain the installation part. To make sure it runs only on Colab, it's possible to use:

try:
    import google.colab
    # do stuff
except:
    pass

@m09
Copy link
Collaborator Author

m09 commented Jan 28, 2020

I isolated the dependencies in separate scripts so that they can be installed in one line in Colab. Proposed setup cell is now:

try:
  import google.colab
  from os import environ
  is_git_dir = !git rev-parse --is-inside-work-tree
  if not is_git_dir:
    !git init
    !git remote add origin https://github.com/mloncode/workshop.git
  !git fetch origin master
  !git reset --hard origin/master
  # !./scripts/install-bigartm
  # !./scripts/install-tree-sitter
  # !./scripts/install-nltk-data
  # !pip install -r conf/requirements-setup.txt
  # !pip install -r conf/requirements.txt
  # environ["SOME_ENV_VAR"] = "some_value"
except:
  # Not on Colab, environment is handled separately
  pass

Last step will probably be to split the requirements even further on a per-notebook basis to install only the minimum env for each notebook.

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

No branches or pull requests

1 participant