Skip to content

Python template to bootstrap torch-based deep learning projects

License

Notifications You must be signed in to change notification settings

links-ads/template-pytorch

 
 

Repository files navigation

Python ML template

A simple template to bootstrap Python machine learning projects, maintaining a standard structure using uv. It should be slightly faster than starting from scratch each time.

Getting Started

To use this template, follow these steps:

  1. Click the "Use this template" button at the top of the repository and follow the procedure.

  2. Clone your new repository to your local machine:

    git clone https://github.com/your-username/your-repo.git
  3. Install uv if you haven't already. On macOS and Linux you can install it using:

    curl -LsSf https://astral.sh/uv/install.sh | sh

    For more installation options, visit uv documentation.

  4. Navigate to the project directory. E.g.:

    cd your-repo
  5. The template provides a simple "self-destructing" initialization script, init.py, that automatically provides the necessary information to generate a fully functional python package (project name, author, ...). With uv this script can be launched as easily as:

    # launch and follow the prompts
    uv run init.py
  6. Add custom dependencies: E.g.

    uv add "numpy>=1.21.0,< 2.0.0"
  7. You're good to go! Of course, you can further customize it to your liking.

Note

The init.py script is self-contained and will delete itself once the procedure is completed. It is absolutely safe to delete if you prefer to edit the files manually.

Extra goodies

If you are using VS Code as your editor of choice, you can use the following snippet in your settings.json file to format and sort imports on save.

{
    "[python]": {
        "diffEditor.ignoreTrimWhitespace": false,
        "editor.wordBasedSuggestions": "off",
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": "explicit"
        },
        "editor.defaultFormatter": "charliermarsh.ruff",
    },
}

Of course, this is completely optional.

About

Python template to bootstrap torch-based deep learning projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 65.2%
  • Makefile 19.4%
  • Jupyter Notebook 15.4%