GithubHelp home page GithubHelp logo

kaylode / theseus Goto Github PK

View Code? Open in Web Editor NEW
34.0 3.0 6.0 110.97 MB

General template for most Pytorch projects

License: MIT License

Python 99.42% Dockerfile 0.58%
template pytorch classification segmentation computer-vision natural-language-processing object-detection structured-data

theseus's Introduction

⛵ Ship of Theseus

The ship wherein Theseus and the youth of Athens returned from Crete had thirty oars, and was preserved by the Athenians down even to the time of Demetrius Phalereus, for they took away the old planks as they decayed, putting in new and stronger timber in their places, insomuch that this ship became a standing example among the philosophers, for the logical question of things that grow; one side holding that the ship remained the same, and the other contending that it was not the same. — Plutarch, Theseus


📝 Instructions

Installation

  • Create virtual environment: conda create -n myenv python=3.10
  • Install Pytorch. Currently support torch==1.13.1
  • Inside your project, install this package by git+https://github.com/kaylode/theseus.git@master#egg=theseus[cv,cv.classification,cv.detection,cv.semantic] extra packages can be identified from the pyproject.toml.

To adapt for personal project

  1. Create your own dataset, dataloader, model, loss function, metric function, ... and register it to the registry so that it can be generated from config at runtime.
  2. Customize inherited trainer and pipeline to your need, such as what to do before/after training/validating step,...
  3. Write custom callbacks (recommended!), follow Lightning
  4. Modify configuration file

See theseus/cv/classification for example

To execute scripts with arguments

  • Run the script with --config-dir flag with a specified config folder that contains the yaml file. And --config-name is that file's name.

Example:

python train.py \
    --config-dir configs \
    --config-name pipeline.yaml
  • To override arguments inside the .yaml file, follow the instructions from Hydra. For example, to train 50 epochs and resume training from checkpoints:
python train.py \
    --config-dir configs \
    --config-name pipeline.yaml \
    trainer.args.max_epochs=5000 \
    global.resume=checkpoint.pth

Notice: There are no spaces between keys and values in -o flag

🎒 Resources

  • Example colab notebooks for classification tasks: Notebook
  • Example colab notebooks for semantic segmentation tasks: Notebook

📘 References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.