repo

class pytorch_tao.repo.Repo(path: Union[Path, str])

Code base folder of Tao. A Repo is actually a git Repo that has a .tao folder which includes configuration in it.

Parameters

path – path of the repo.

commit_all(message: str) Commit

Commit all the dirty changes to git It is equal to git add -A; git commit -m xxx

Parameters

message – the message of git commit

classmethod create(path: Union[Path, str], template: str = 'mini') Repo

Create a tao project from scratch. tao new internally call this method, it is equal to mkdir path; tao init path;

Parameters

path – an not exist path to create the tao.repo

Returns

a repo object represents the created one

Return type

Repo

exists() bool

Is this tao repo exists and valid :returns: bool True exists False not

classmethod find_by_file(path: Union[Path, str]) Repo

Find the nearest tao repo of any file. When calling tao run some_script.py, tao will try to find the repo of some_script.py, the file can be nested in sub folders of a tao repo.

Parameters

path – path of the file.

Returns

a repo that the file belongs to.

Return type

Repo

Raises

FileNotFoundError – if no repos are found.

init(template: str)

Making a existing folder a tao repo

run(name: str, dirty: bool, checkout: str)

Start a training process.

Run will call torch.distributed.run so this func will rely on the command line arguments. Call this method with right command line options.

Raises

.DirtyRepoError – if –dirty is not passed and the repo is dirty

sync_code_to_kaggle()

Create a GitHub workflow that sync the source code to Kaggle dataset.

There are presteps before generating this action:

  1. Create a dataset with any file(which will give the dataset_slug parameter)

  2. In the GitHub repo settings, add two GitHub action secrets named KAGGLE_USERNAME and KAGGLE_KEY

tune(name: str, max_trials: int, duplicated: bool)

Start hyperparameter tunning process.

The tao tune interally call this function to start the tunning process.

To call this function successfully, the config(tao.cfg) should have “run_dir” and “study_storage” being set.

Raises

DirtyRepoError – if repo is dirty