Skip to content

gitE0Z9/pytorch-implementations

Repository files navigation

Pytorch 實作系列

english-version

中文版本

文章同步發布在個人部落格(https://gite0z9.github.io)

此專案初衷是實作多年來學習的深度學習模型,並提供 notebook 跟 medium 文章學習,而非一個專注於特定領域的 production-ready 庫

接下來的開發方向會往 monorepo 延伸

領域(domain) 模型(model)
少樣本學習(few shot learning)
圖像分類(image classification)
物件偵測(object detection)
語意分割(semantic segmentation)
圖像生成(image generation)
光學文字辨識(optical character recognition)
風格遷移(style transfer)
文本分類(text classification)
命名實體辨識(named entity recognition)
增強學習(reinforcement learning)
序列資料(sequence data)
語言模型(language model)
圖神經網路(graph neural network)

開發環境

python: 3.11

安裝方式

pip install git+https://www.github.com/gite0z9/pytorch-implementations.git@main#torchlake --target=/torchlake

專案結構

notebooks: 展示如何使用 torchlake.

torchlake: 由不同應用領域組成的深度學習包.

每個領域大致上會有如下結構

├───adapter
├───artifacts
│   └───model_name
├───configs
│   └───model_name
├───constants
├───controller
├───datasets
│   └───dataset_name
├───models
│   ├───base
│   └───model_name
│       ├───model.py
│       ├───network.py
│       ├───loss.py
│       └───decode.py
├───reference
│   └───model_name
│       └───paper
├───runs
├───scripts
│   └───debug
├───tests
├───utils
└───requirements.txt

adapter: 介接 controller 和其他資源(model, model.loss, etc.)

configs: 模型設定檔,包括裝置定義、模型定義、訓練定義、推論定義,共四個面向

constants: 固定的值,包括 constant 和 enum

controller: 控制器,controller是共用基底,trainerevaluatorpredictor負責訓練、評估、預測三種工作

models: 模型定義,network.py是模型區塊,model.py是最後組裝的模型,loss.py是損失函數

datasets: 資料集,目前是照領域區分,有分 raw dataset 和 csv dataset,前者是讀取 raw data,後者是讀取處理過的 csv(如歸一化座標)

runs: 記載trainerevaluator的結果的 tensorboard log 資料夾

tests: 單元測試,使用 pytest

utils: 存放依賴性低且復用性高的函式

model 和 dataset 的 config 會用 pydantic 控制格式

About

Deep learning models implemented in PyTorch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published