Setup Functions

dagshub.init(repo_name: str | None = None, repo_owner: str | None = None, url: str | None = None, root: str | None = None, host: str | None = None, mlflow: bool = True, dvc: bool = False, patch_mlflow: bool = False)

Initialize a DagsHub repository or DagsHub-related functionality.

Initialization includes:
  1. Creates a repository on DagsHub if it doesn’t exist yet.

  2. If dvc flag is set, adds the DagsHub repository as a dvc remote.

  3. If mlflow flag is set, initializes MLflow environment variables to enable logging experiments into the DagsHub hosted MLflow. That means that if you call dagshub.init() in your script, then any MLflow function called later in the script will log to the DagsHub hosted MLflow.

Parameters:
  • repo_name – Along with repo_owner defines the repository on DagsHub.

  • repo_owner – Along with repo_name defines the repository on DagsHub.

  • url – Url to the repository on DagsHub. Can be used as an alternative to repo_owner/repo_name arguments.

  • root – Path to the locally hosted git repository. If it’s not set, tries to find a repository traversing up the filesystem.

  • host – Address of the DagsHub instance with the repository. If specified, then all request to dagshub are going to be sent to this instance.

  • mlflow – Configure MLflow to log experiments to DagsHub.

  • dvc – Configure a dvc remote in the repository.

  • patch_mlflow – Run dagshub.mlflow.patch_mlflow() so errors while logging with MLflow don’t stop execution