Skip to content

Commit f97bcda

Browse files
authoredApr 9, 2024
Fix packaging for WHL format (pytorch#656)
1 parent 9b68873 commit f97bcda

9 files changed

+77
-69
lines changed
 

‎MANIFEST.in

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
# Add necessary recipe files (not as importable)
2-
recursive-include recipes *.py *.yaml
3-
4-
# Add requirements
5-
include requirements.txt
6-
include dev-requirements.txt
7-
8-
# Remove tests from packaging
9-
prune tests
1+
prune tests # Remove all testing files from final dist/

‎dev-requirements.txt

-9
This file was deleted.

‎pyproject.toml

+66
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,69 @@
1+
# ---- All project specifications ---- #
2+
[project]
3+
name = "torchtune"
4+
description = "A native-PyTorch library for LLM fine-tuning"
5+
readme = "README.md"
6+
requires-python = ">=3.8"
7+
license = {file = "LICENSE"}
8+
authors = [
9+
{ name = "PyTorch Team", email = "packages@pytorch.org" },
10+
]
11+
keywords = ["pytorch", "finetuning", "llm"]
12+
dependencies = [
13+
# Hugging Face integrations
14+
"datasets",
15+
"huggingface_hub",
16+
"safetensors",
17+
18+
# Miscellaneous
19+
"sentencepiece",
20+
"tqdm",
21+
"omegaconf",
22+
23+
# Quantization
24+
"torchao==0.1",
25+
]
26+
dynamic = ["version"]
27+
28+
[project.urls]
29+
GitHub = "https://github.com/pytorch/torchtune"
30+
Documentation = "https://pytorch.org/torchtune/main/index.html"
31+
Issues = "https://github.com/pytorch/torchtune/issues"
32+
33+
[project.scripts]
34+
tune = "torchtune._cli.tune:main"
35+
36+
[project.optional-dependencies]
37+
dev = [
38+
"bitsandbytes",
39+
"pre-commit",
40+
"pytest",
41+
"pytest-cov",
42+
"pytest-mock",
43+
"pytest-integration",
44+
"tensorboard",
45+
"transformers",
46+
"wandb",
47+
]
48+
49+
[tool.setuptools.dynamic]
50+
version = {attr = "torchtune.__version__"}
51+
52+
53+
# ---- Explicit project build information ---- #
54+
[build-system]
55+
requires = ["setuptools", "wheel"]
56+
build-backend = "setuptools.build_meta"
57+
58+
[tool.setuptools.packages.find]
59+
where = [""]
60+
include = ["torchtune*", "recipes*"]
61+
62+
[tool.setuptools.package-data]
63+
recipes = ["configs/*.yaml", "configs/*/*.yaml"]
64+
65+
66+
# ---- Tooling specifications ---- #
167
[tool.usort]
268
first_party_detection = false
369

‎recipes/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
# TODO: Add proper link to pytorch.org/torchtune/... when the docs are live.
2020
raise ModuleNotFoundError(
21-
"The TorchTune recipes folder isn't a package and you should not import anything from there. "
22-
"Refer to our docs for detailed instructions on how to use the recipes!"
23-
"This file only exists for testing reasons."
21+
"The TorchTune recipes directory isn't a package and you should not import anything from here. "
22+
"Refer to our docs for detailed instructions on how to use recipes!"
2423
)

‎requirements.txt

-12
This file was deleted.

‎setup.py

-34
This file was deleted.

‎tests/recipes/test_configs.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
import os
77
from pathlib import Path
88

9+
import torchtune
10+
911
from omegaconf import OmegaConf
1012
from torchtune import config
1113

12-
CONFIG_DIR = Path(__file__).resolve().parent.parent.parent / "recipes" / "configs"
14+
CONFIG_DIR = Path(torchtune.__file__).parent.parent / "recipes" / "configs"
1315

1416

1517
class TestConfigs:

‎tests/test_import_recipes.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88

99

1010
def test_import_recipes():
11-
with pytest.raises(ModuleNotFoundError, match="recipes folder isn't a package"):
11+
with pytest.raises(
12+
ModuleNotFoundError, match="The TorchTune recipes directory isn't a package"
13+
):
1214
import recipes # noqa

‎torchtune/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
__version__ = "0.0.1"
8+
79
from torchtune import datasets, models, modules, utils
810

911
__all__ = [datasets, models, modules, utils]

0 commit comments

Comments
 (0)
Please sign in to comment.