Skip to content

Commit 5ae6169

Browse files
authored
Rename CLI tools and move to proper entry_point (#396)
1 parent cd7228e commit 5ae6169

File tree

19 files changed

+61
-34
lines changed

19 files changed

+61
-34
lines changed

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ def read_requirements(file):
2020
packages=find_packages(),
2121
python_requires=">=3.8",
2222
install_requires=read_requirements("requirements.txt"),
23-
scripts=["_scripts/cli_utils/tune"],
24-
description="Package for finetuning LLMs and diffusion models using native PyTorch",
23+
entry_points={
24+
"console_scripts": [
25+
"tune = torchtune._cli.cli_utils.tune:main",
26+
]
27+
},
28+
description="Package for finetuning LLMs using native PyTorch",
2529
long_description=open("README.md").read(),
2630
long_description_content_type="text/markdown",
2731
url="https://github.com/pytorch-labs/torchtune",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
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-
TUNE_PATH = "_scripts/cli_utils/tune"
7+
TUNE_PATH = "torchtune/_cli/cli_utils/tune.py"

tests/_scripts/test_convert_checkpoint.py renamed to tests/torchtune/_cli/test_convert_checkpoint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
import pytest
1515
import torch
16-
17-
from tests._scripts.common import TUNE_PATH
1816
from tests.test_utils import assert_expected
17+
18+
from tests.torchtune._cli.common import TUNE_PATH
1919
from tests.torchtune.models.llama2.scripts.compare_decoder import Transformer
2020
from torchtune.models.llama2 import llama2
2121

22-
ASSETS = Path(__file__).parent.parent / "assets"
22+
ASSETS = Path(__file__).parent.parent.parent / "assets"
2323

2424
# Generating `tiny_state_dict_with_one_key.pt`
2525
# >>> import torch
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import pytest
1414

15-
from tests._scripts.common import TUNE_PATH
15+
from tests.torchtune._cli.common import TUNE_PATH
1616

1717

1818
class TestTuneCLIWithDownloadScript:
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
import runpy
99
import sys
1010

11-
from _scripts.ls import _NULL_VALUE
12-
1311
from recipes import list_configs, list_recipes
1412

15-
from tests._scripts.common import TUNE_PATH
13+
from tests.torchtune._cli.common import TUNE_PATH
14+
15+
from torchtune._cli.ls import _NULL_VALUE
1616

1717

1818
class TestTuneCLIWithListScript:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import torchtune
1616
from recipes import list_configs, list_recipes
1717

18-
from tests._scripts.common import TUNE_PATH
18+
from tests.torchtune._cli.common import TUNE_PATH
1919

2020

2121
class TestTuneCLI:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.

0 commit comments

Comments
 (0)