ditli 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ditli-0.0.1/LICENSE ADDED
@@ -0,0 +1,10 @@
1
+
2
+ The MIT License (MIT)
3
+ Copyright (c) 2026, James Kennedy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+
ditli-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.4
2
+ Name: ditli
3
+ Version: 0.0.1
4
+ Summary: A small from-scratch implementation of a diffusion transformer (DiT).
5
+ Author: James Kennedy
6
+ Requires-Python: ~=3.12.0
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ License-File: LICENSE
11
+ Requires-Dist: loguru
12
+ Requires-Dist: mkdocs
13
+ Requires-Dist: pip
14
+ Requires-Dist: pytest
15
+ Requires-Dist: python-dotenv
16
+ Requires-Dist: ruff
17
+ Requires-Dist: tqdm
18
+ Requires-Dist: typer
19
+
20
+ # DiTli
21
+
22
+ <a target="_blank" href="https://cookiecutter-data-science.drivendata.org/">
23
+ <img src="https://img.shields.io/badge/CCDS-Project%20template-328F97?logo=cookiecutter" />
24
+ </a>
25
+
26
+ A small from-scratch implementation of a diffusion transformer (DiT).
27
+
28
+ ## Project Organization
29
+
30
+ ```
31
+ ├── LICENSE <- Open-source license if one is chosen
32
+ ├── Makefile <- Makefile with convenience commands like `make data` or `make train`
33
+ ├── README.md <- The top-level README for developers using this project.
34
+ ├── data
35
+ │ ├── external <- Data from third party sources.
36
+ │ ├── interim <- Intermediate data that has been transformed.
37
+ │ ├── processed <- The final, canonical data sets for modeling.
38
+ │ └── raw <- The original, immutable data dump.
39
+ │
40
+ ├── docs <- A default mkdocs project; see www.mkdocs.org for details
41
+ │
42
+ ├── models <- Trained and serialized models, model predictions, or model summaries
43
+ │
44
+ ├── notebooks <- Jupyter notebooks. Naming convention is a number (for ordering),
45
+ │ the creator's initials, and a short `-` delimited description, e.g.
46
+ │ `1.0-jqp-initial-data-exploration`.
47
+ │
48
+ ├── pyproject.toml <- Project configuration file with package metadata for
49
+ │ ditli and configuration for tools like black
50
+ │
51
+ ├── references <- Data dictionaries, manuals, and all other explanatory materials.
52
+ │
53
+ ├── reports <- Generated analysis as HTML, PDF, LaTeX, etc.
54
+ │ └── figures <- Generated graphics and figures to be used in reporting
55
+ │
56
+ ├── requirements.txt <- The requirements file for reproducing the analysis environment, e.g.
57
+ │ generated with `pip freeze > requirements.txt`
58
+ │
59
+ ├── setup.cfg <- Configuration file for flake8
60
+ │
61
+ └── ditli <- Source code for use in this project.
62
+ │
63
+ ├── __init__.py <- Makes ditli a Python module
64
+ │
65
+ ├── config.py <- Store useful variables and configuration
66
+ │
67
+ ├── dataset.py <- Scripts to download or generate data
68
+ │
69
+ ├── features.py <- Code to create features for modeling
70
+ │
71
+ ├── modeling
72
+ │ ├── __init__.py
73
+ │ ├── predict.py <- Code to run model inference with trained models
74
+ │ └── train.py <- Code to train models
75
+ │
76
+ └── plots.py <- Code to create visualizations
77
+ ```
78
+
79
+ --------
80
+
81
+
ditli-0.0.1/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # DiTli
2
+
3
+ <a target="_blank" href="https://cookiecutter-data-science.drivendata.org/">
4
+ <img src="https://img.shields.io/badge/CCDS-Project%20template-328F97?logo=cookiecutter" />
5
+ </a>
6
+
7
+ A small from-scratch implementation of a diffusion transformer (DiT).
8
+
9
+ ## Project Organization
10
+
11
+ ```
12
+ ├── LICENSE <- Open-source license if one is chosen
13
+ ├── Makefile <- Makefile with convenience commands like `make data` or `make train`
14
+ ├── README.md <- The top-level README for developers using this project.
15
+ ├── data
16
+ │ ├── external <- Data from third party sources.
17
+ │ ├── interim <- Intermediate data that has been transformed.
18
+ │ ├── processed <- The final, canonical data sets for modeling.
19
+ │ └── raw <- The original, immutable data dump.
20
+ │
21
+ ├── docs <- A default mkdocs project; see www.mkdocs.org for details
22
+ │
23
+ ├── models <- Trained and serialized models, model predictions, or model summaries
24
+ │
25
+ ├── notebooks <- Jupyter notebooks. Naming convention is a number (for ordering),
26
+ │ the creator's initials, and a short `-` delimited description, e.g.
27
+ │ `1.0-jqp-initial-data-exploration`.
28
+ │
29
+ ├── pyproject.toml <- Project configuration file with package metadata for
30
+ │ ditli and configuration for tools like black
31
+ │
32
+ ├── references <- Data dictionaries, manuals, and all other explanatory materials.
33
+ │
34
+ ├── reports <- Generated analysis as HTML, PDF, LaTeX, etc.
35
+ │ └── figures <- Generated graphics and figures to be used in reporting
36
+ │
37
+ ├── requirements.txt <- The requirements file for reproducing the analysis environment, e.g.
38
+ │ generated with `pip freeze > requirements.txt`
39
+ │
40
+ ├── setup.cfg <- Configuration file for flake8
41
+ │
42
+ └── ditli <- Source code for use in this project.
43
+ │
44
+ ├── __init__.py <- Makes ditli a Python module
45
+ │
46
+ ├── config.py <- Store useful variables and configuration
47
+ │
48
+ ├── dataset.py <- Scripts to download or generate data
49
+ │
50
+ ├── features.py <- Code to create features for modeling
51
+ │
52
+ ├── modeling
53
+ │ ├── __init__.py
54
+ │ ├── predict.py <- Code to run model inference with trained models
55
+ │ └── train.py <- Code to train models
56
+ │
57
+ └── plots.py <- Code to create visualizations
58
+ ```
59
+
60
+ --------
61
+
@@ -0,0 +1 @@
1
+ from ditli import config # noqa: F401
@@ -0,0 +1,32 @@
1
+ from pathlib import Path
2
+
3
+ from dotenv import load_dotenv
4
+ from loguru import logger
5
+
6
+ # Load environment variables from .env file if it exists
7
+ load_dotenv()
8
+
9
+ # Paths
10
+ PROJ_ROOT = Path(__file__).resolve().parents[1]
11
+ logger.info(f"PROJ_ROOT path is: {PROJ_ROOT}")
12
+
13
+ DATA_DIR = PROJ_ROOT / "data"
14
+ RAW_DATA_DIR = DATA_DIR / "raw"
15
+ INTERIM_DATA_DIR = DATA_DIR / "interim"
16
+ PROCESSED_DATA_DIR = DATA_DIR / "processed"
17
+ EXTERNAL_DATA_DIR = DATA_DIR / "external"
18
+
19
+ MODELS_DIR = PROJ_ROOT / "models"
20
+
21
+ REPORTS_DIR = PROJ_ROOT / "reports"
22
+ FIGURES_DIR = REPORTS_DIR / "figures"
23
+
24
+ # If tqdm is installed, configure loguru with tqdm.write
25
+ # https://github.com/Delgan/loguru/issues/135
26
+ try:
27
+ from tqdm import tqdm
28
+
29
+ logger.remove(0)
30
+ logger.add(lambda msg: tqdm.write(msg, end=""), colorize=True)
31
+ except ModuleNotFoundError:
32
+ pass
@@ -0,0 +1,29 @@
1
+ from pathlib import Path
2
+
3
+ from loguru import logger
4
+ from tqdm import tqdm
5
+ import typer
6
+
7
+ from ditli.config import PROCESSED_DATA_DIR, RAW_DATA_DIR
8
+
9
+ app = typer.Typer()
10
+
11
+
12
+ @app.command()
13
+ def main(
14
+ # ---- REPLACE DEFAULT PATHS AS APPROPRIATE ----
15
+ input_path: Path = RAW_DATA_DIR / "dataset.csv",
16
+ output_path: Path = PROCESSED_DATA_DIR / "dataset.csv",
17
+ # ----------------------------------------------
18
+ ):
19
+ # ---- REPLACE THIS WITH YOUR OWN CODE ----
20
+ logger.info("Processing dataset...")
21
+ for i in tqdm(range(10), total=10):
22
+ if i == 5:
23
+ logger.info("Something happened for iteration 5.")
24
+ logger.success("Processing dataset complete.")
25
+ # -----------------------------------------
26
+
27
+
28
+ if __name__ == "__main__":
29
+ app()
@@ -0,0 +1,29 @@
1
+ from pathlib import Path
2
+
3
+ from loguru import logger
4
+ from tqdm import tqdm
5
+ import typer
6
+
7
+ from ditli.config import PROCESSED_DATA_DIR
8
+
9
+ app = typer.Typer()
10
+
11
+
12
+ @app.command()
13
+ def main(
14
+ # ---- REPLACE DEFAULT PATHS AS APPROPRIATE ----
15
+ input_path: Path = PROCESSED_DATA_DIR / "dataset.csv",
16
+ output_path: Path = PROCESSED_DATA_DIR / "features.csv",
17
+ # -----------------------------------------
18
+ ):
19
+ # ---- REPLACE THIS WITH YOUR OWN CODE ----
20
+ logger.info("Generating features from dataset...")
21
+ for i in tqdm(range(10), total=10):
22
+ if i == 5:
23
+ logger.info("Something happened for iteration 5.")
24
+ logger.success("Features generation complete.")
25
+ # -----------------------------------------
26
+
27
+
28
+ if __name__ == "__main__":
29
+ app()
File without changes
@@ -0,0 +1,30 @@
1
+ from pathlib import Path
2
+
3
+ from loguru import logger
4
+ from tqdm import tqdm
5
+ import typer
6
+
7
+ from ditli.config import MODELS_DIR, PROCESSED_DATA_DIR
8
+
9
+ app = typer.Typer()
10
+
11
+
12
+ @app.command()
13
+ def main(
14
+ # ---- REPLACE DEFAULT PATHS AS APPROPRIATE ----
15
+ features_path: Path = PROCESSED_DATA_DIR / "test_features.csv",
16
+ model_path: Path = MODELS_DIR / "model.pkl",
17
+ predictions_path: Path = PROCESSED_DATA_DIR / "test_predictions.csv",
18
+ # -----------------------------------------
19
+ ):
20
+ # ---- REPLACE THIS WITH YOUR OWN CODE ----
21
+ logger.info("Performing inference for model...")
22
+ for i in tqdm(range(10), total=10):
23
+ if i == 5:
24
+ logger.info("Something happened for iteration 5.")
25
+ logger.success("Inference complete.")
26
+ # -----------------------------------------
27
+
28
+
29
+ if __name__ == "__main__":
30
+ app()
@@ -0,0 +1,30 @@
1
+ from pathlib import Path
2
+
3
+ from loguru import logger
4
+ from tqdm import tqdm
5
+ import typer
6
+
7
+ from ditli.config import MODELS_DIR, PROCESSED_DATA_DIR
8
+
9
+ app = typer.Typer()
10
+
11
+
12
+ @app.command()
13
+ def main(
14
+ # ---- REPLACE DEFAULT PATHS AS APPROPRIATE ----
15
+ features_path: Path = PROCESSED_DATA_DIR / "features.csv",
16
+ labels_path: Path = PROCESSED_DATA_DIR / "labels.csv",
17
+ model_path: Path = MODELS_DIR / "model.pkl",
18
+ # -----------------------------------------
19
+ ):
20
+ # ---- REPLACE THIS WITH YOUR OWN CODE ----
21
+ logger.info("Training some model...")
22
+ for i in tqdm(range(10), total=10):
23
+ if i == 5:
24
+ logger.info("Something happened for iteration 5.")
25
+ logger.success("Modeling training complete.")
26
+ # -----------------------------------------
27
+
28
+
29
+ if __name__ == "__main__":
30
+ app()
@@ -0,0 +1,29 @@
1
+ from pathlib import Path
2
+
3
+ from loguru import logger
4
+ from tqdm import tqdm
5
+ import typer
6
+
7
+ from ditli.config import FIGURES_DIR, PROCESSED_DATA_DIR
8
+
9
+ app = typer.Typer()
10
+
11
+
12
+ @app.command()
13
+ def main(
14
+ # ---- REPLACE DEFAULT PATHS AS APPROPRIATE ----
15
+ input_path: Path = PROCESSED_DATA_DIR / "dataset.csv",
16
+ output_path: Path = FIGURES_DIR / "plot.png",
17
+ # -----------------------------------------
18
+ ):
19
+ # ---- REPLACE THIS WITH YOUR OWN CODE ----
20
+ logger.info("Generating plot from data...")
21
+ for i in tqdm(range(10), total=10):
22
+ if i == 5:
23
+ logger.info("Something happened for iteration 5.")
24
+ logger.success("Plot generation complete.")
25
+ # -----------------------------------------
26
+
27
+
28
+ if __name__ == "__main__":
29
+ app()
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["flit_core >=3.2,<4"]
3
+ build-backend = "flit_core.buildapi"
4
+
5
+ [project]
6
+ name = "ditli"
7
+ version = "0.0.1"
8
+ description = "A small from-scratch implementation of a diffusion transformer (DiT)."
9
+ authors = [
10
+ { name = "James Kennedy" },
11
+ ]
12
+ license = { file = "LICENSE" }
13
+ readme = "README.md"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License"
17
+ ]
18
+ dependencies = [
19
+ "loguru",
20
+ "mkdocs",
21
+ "pip",
22
+ "pytest",
23
+ "python-dotenv",
24
+ "ruff",
25
+ "tqdm",
26
+ "typer",
27
+ ]
28
+ requires-python = "~=3.12.0"
29
+
30
+
31
+ [tool.ruff]
32
+ line-length = 99
33
+ src = ["ditli"]
34
+ include = ["pyproject.toml", "ditli/**/*.py"]
35
+
36
+ [tool.ruff.lint]
37
+ extend-select = ["I"] # Add import sorting
38
+
39
+ [tool.ruff.lint.isort]
40
+ known-first-party = ["ditli"]
41
+ force-sort-within-sections = true
42
+