Skip to content

DenDen047/pytorch-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyTorch-based Project Template

Setup

Docker

$ cd docker && docker compose up -d --build
$ docker compose down && docker compose up -d --build && docker exec -it [container_name] bash

uv

$ uv python pin 3.11
$ uv venv --python 3.11
$ source .venv/bin/activate
$ uv init

## uv add numpy ...
$ uv add ipykernel  # if JupyterLab is used

## run python program
$ uv run python main.py

$ uv lock
## uv sync    # installs everything into .venv
$ uv export --format=requirements.txt > requirements.txt
$ deactivate

ref:

venv

$ pyenv install 3.10
$ pyenv local 3.10
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install -U pip

## pip install ...

$ pip freeze > requirements.txt
$ deactivate

Lambda Cloud

ref: https://lambda.ai/blog/set-up-a-tensorflow-gpu-docker-container-using-lambda-stack-dockerfile

ssh ubuntu@IP_ADDRESS -i ~/.ssh/lambda_cloud
curl -fsSL https://raw.githubusercontent.com/DenDen047/dotfiles/refs/heads/master/setup_scripts/lambda_cloud1.sh | bash

# after reboot, run the following command
curl -fsSL https://raw.githubusercontent.com/DenDen047/dotfiles/refs/heads/master/setup_scripts/lambda_cloud2.sh | bash

Usage

Project Configuration

.
├── README.md            # プロジェクト概要と使い方を記述
├── conf/                # 実験設定ファイル (例: parameters.yml, secrets.yml)
├── data/                # データや中間成果物の一時保存場所
├── notebooks/           # JupyterLabでの実験ノート
├── pyproject.toml       # Pythonプロジェクトの主要設定ファイル (PEP 518準拠)
├── setup.cfg            # pyproject.toml未対応の設定を補完
└── src/                 # Pythonパッケージコード (共通処理の関数やクラスなど)

Data directory

Please see the details here.

data/
├── 01_raw/              # Original, immutable data from source systems
├── 02_intermediate/     # Partially processed (cleaned/transformed) data
├── 03_primary/          # Canonical datasets for feature engineering
├── 04_feature/          # Engineered features ready for modeling
├── 05_model_input/      # Data prepared specifically for model training
├── 06_models/           # Trained models (e.g., .pkl, .h5 files)
├── 07_model_output/     # Model outputs like predictions or embeddings
└── 08_reporting/        # Reports, visualizations, dashboards, final outputs

Development

Git Workflow

This project follows git-flow.

  1. Starting Work: Begin new development or experiments by creating a branch off of the develop branch.
  2. Merging to develop: Once work intended for develop is complete, merge it into the develop branch (creating a Pull Request on GitHub is recommended if applicable) and delete the original branch.
  3. Keeping History (Archiving): If you wish to keep the code and history of a branch without merging it into develop (e.g., failed experiments, pure explorations), rename the branch to archive/<original-branch-name>.
    • Example: To archive a branch named exp/try-hyperparams-v1, rename it to archive/exp/try-hyperparams-v1.
  4. Archived Branches: Branches prefixed with archive/ are kept for reference only and must not be merged into active branches like develop or main.

Commit Message

Following commitlint rule:

Jupyter Notebook on Cursor Editor

<iframe width="560" height="315" src="https://www.youtube.com/embed/eOSfeBIBzr0?si=MFjxL47thNJGC1SN" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

Visualization

  • colormap: turbo

Useful Tools

Reference

Sample Projects

Claude Code

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published