Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

google_colab.md 6.5 KB

You have to be logged in to leave a comment. Sign In
title description
DagsHub integration with Google Colab - Your Cloud Notebook | DagsHub DagsHub’s integration with Google Colab allows you to open, version, and commit cloud-based Jupyter Notebook with access to free GPU, with no MLOps friction

Google Colab

Google Colaboratory{:rel="nofollow" target="_blank"} , or "Colab" for short, is a free Jupyter notebook environment that runs entirely in the cloud. It does not require any setup, can be shared easily with team members, and provides free access to GPUs. DagsHub provides its users with Colab Notebook templates for various tasks, such as fully configuring DagsHub with Colab runtime, transferring data from Google Drive to DagsHub Storage, tutorials, and more.

How do DagsHub works with Google Colab?

DagsHub is officially integrated with Google Colab, enabling users to open notebooks in a Colab environment directly from DagsHub projects (free GPU included) and also version and commit them back using Git or DVC. Seamlessly build, train, and collaborate on ML models with ZERO MLOps friction.

See an example notebook:

Open in Colab

You can easily access your DagsHub remotes using Git, DVC, and MLflow from any Colab environment. Colab allows its users to download files to your runtime using API calls and bash commands. By setting your DagsHub credentials, you'll be able to clone the Git server, pull the data hosted on DagsHub Storage and log experiments to the project's MLflow Tracking server.

How to use DagsHub with Google Colab?

Open a notebook from your DagsHub repo in Colab

To open a notebook from DagsHub in Colab, just navigate to your notebook file preview on DagsHub – there you will see the "Open in Colab" button which will open the notebook in Colab.

Adding topics with the UI

Versioning your Colab notebook using Git or DVC on DagsHub

Integrating DagsHub and Colab introduces a significant improvement in notebook version control, as users can use DVC to version large notebooks that Git has trouble facilitating. DagsHub lets you diff notebooks and comment on notebook cells which unlocks collaboration for ML teams, without needing third-party platforms or sharing screenshots across Slack

To version your notebook with the DagsHub Client (run pip install dagshub to install), use the save_notebook function as follows:

from dagshub.notebook import save_notebook

save_notebook(repo="<repo_owner>/<repo_name>")

With the following argument:

  • repo (str): your DagsHub repository in the format of <repo_owner>/<repo_name>

You can also use the following optional arguments:

  • path (str): Where to save the notebook within the repository (including the filename). If the filename is not specified, we'll save it as "notebook-{datetime.now}.ipynb" under the specified folder
  • branch (str): The branch under which the notebook should be saved. Will commit to the default repo branch if not specified
  • commit_message (str): The commit message for the update
  • versioning (str): ['git'|'dvc'] The VCS used to version the notebook

!!! info "Alternative way to version your Colab notebook" In some cases the above function might fail due to Colab related issues. An alternative way to version your notebook is to download it locally, then in an environment with pip install dagshub run the following snippet: python import dagshub dagshub.upload_files(repo="<repo_owner>/<repo_name>", local_path="<path/to/notebook.ipynb>", remote_path="<path/in/remote/notebook.ipynb>", commit_message="<commit_message>")

DagYard – Load your DagsHub project (Data, Models & Code) to Colab

Open in Colab

With this notebook, you can easily pull all of your project’s components from DagsHub to Colab runtime, train the model, log the experiments, version the changes, and push them to DagsHub remotes. You need to simply check some boxes, fill in your details, run the notebook, and you’re set to go! Behind the scenes, it will configure your DagsHub project with Colab and pull the project components you choose to the run time. From the DagYard cell on, you will be able to work on your project, version the changes with Git and DVC, and easily push them to the DagsHub remotes.

The DagWalker – Copy your data from GDrive to DagsHub

Open in Colab

Follow this notebook to copy and version directories from Google Drive to DagsHub storage using DVC.

Tutorials

  • Hello World{:rel="nofollow" target="_blank"} - Try DagsHub without installing anything locally. The primary goal of this notebook is to help you learn the basic features and usage of DagsHub while maintaining a relatively clean environment. By following this notebook, you will create your first hello-world project on DagsHub.
  • Tensorflow{:rel="nofollow" target="_blank"} , fast.ai{:rel="nofollow" target="_blank"} - Learn how to log MLflow Experiments to your DagsHub's MLflow Tracking server by following a few steps.
  • DagsHub x GitHub{:rel="nofollow" target="_blank"} - Learn how to use all the benefits DagsHub has to offer in your GitHub project by following this notebook.
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...