Skip to content

Commit b0a80df

Browse files
committed
[BE] restructure tests and assets folders
ghstack-source-id: 847008cf86e4cbeb77a00bf1cd455543899fe2b1 Pull Request resolved: #748
1 parent 00f5302 commit b0a80df

22 files changed

+15
-14
lines changed

.github/workflows/integration_test_4gpu.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ jobs:
4343
python -m pip install -e .
4444
4545
mkdir artifacts-to-be-uploaded
46-
python ./test_runner.py artifacts-to-be-uploaded --ngpu 4
46+
python ./tests/integration_tests.py artifacts-to-be-uploaded --ngpu 4

.github/workflows/integration_test_8gpu.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
3939
python -m pip install --force-reinstall --pre torch --index-url https://download.pytorch.org/whl/nightly/cu124
4040
mkdir artifacts-to-be-uploaded
41-
python ./test_runner.py artifacts-to-be-uploaded --ngpu 8
41+
python ./tests/integration_tests.py artifacts-to-be-uploaded --ngpu 8

.github/workflows/unit_test_cpu.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ jobs:
2525
pip config --user set global.progress_bar off
2626
2727
pip install --force-reinstall --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
28-
pytest test --cov=. --cov-report=xml --durations=20 -vv
28+
pytest tests/unit_tests --cov=. --cov-report=xml --durations=20 -vv

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
files: \.py$
2525
args:
2626
- --license-filepath
27-
- docs/license_header.txt
27+
- assets/license_header.txt
2828

2929
- repo: https://github.com/pycqa/flake8
3030
rev: 34cbf8ef3950f43d09b85e2e45c15ae5717dc37b

assets/images/readme.md

-1
This file was deleted.
File renamed without changes.
File renamed without changes.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dev = [
3636
]
3737

3838
[tool.setuptools.dynamic]
39-
version = {file = "version.txt"}
39+
version = {file = "assets/version.txt"}
4040

4141

4242
# ---- Explicit project build information ---- #
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test_runner.py renamed to tests/integration_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def build_test_list():
254254
[
255255
"--experimental.pipeline_parallel_degree 2",
256256
"--experimental.pipeline_parallel_schedule PipelineScheduleMulti",
257-
"--experimental.pipeline_parallel_schedule_csv ./test/assets/custom_schedule.csv",
257+
"--experimental.pipeline_parallel_schedule_csv ./tests/assets/custom_schedule.csv",
258258
"--experimental.pipeline_parallel_microbatches 8",
259259
],
260260
],
File renamed without changes.

test/multimodal_model/test_multimodal_model.py renamed to tests/unit_tests/multimodal_model/test_multimodal_model.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
VisionEncoder,
1313
)
1414

15-
from test.multimodal_model.test_utils import fixed_init_model, fixed_init_tensor
15+
from tests.unit_tests.multimodal_model.test_utils import (
16+
fixed_init_model,
17+
fixed_init_tensor,
18+
)
1619

1720

1821
@pytest.fixture

test/datasets/test_checkpoint.py renamed to tests/unit_tests/test_dataset_checkpointing.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
from torchtitan.datasets.tokenizer import build_tokenizer
1010

1111

12-
class TestCheckpoint:
12+
class TestDatasetCheckpointing:
1313
def test_c4_resumption(self):
1414
dataset_name = "c4_test"
15-
dataset_path = "./test/assets/c4_test"
15+
dataset_path = "./tests/assets/c4_test"
1616
batch_size = 1
1717
seq_len = 1024
1818
world_size = 4
@@ -41,8 +41,7 @@ def test_c4_resumption(self):
4141
def _build_dataloader(
4242
self, dataset_name, dataset_path, batch_size, seq_len, world_size, rank
4343
):
44-
tokenizer_type = "tiktoken"
45-
tokenizer = build_tokenizer("tiktoken", "./test/assets/test_tiktoken.model")
44+
tokenizer = build_tokenizer("tiktoken", "./tests/assets/test_tiktoken.model")
4645
return build_hf_data_loader(
4746
dataset_name=dataset_name,
4847
dataset_path=dataset_path,
File renamed without changes.

torchtitan/datasets/hf_datasets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DatasetConfig:
4545
text_processor=_process_c4_text,
4646
),
4747
"c4_test": DatasetConfig(
48-
path="test/assets/c4_test",
48+
path="tests/assets/c4_test",
4949
loader=lambda path: load_dataset(path, split="train"),
5050
text_processor=_process_c4_text,
5151
),

train_configs/debug_model.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ name = "llama3"
2424
flavor = "debugmodel"
2525
norm_type = "rmsnorm" # layernorm / np_layernorm / rmsnorm / fused_rmsnorm
2626
# test tokenizer.model, for debug purpose only
27-
tokenizer_path = "./test/assets/test_tiktoken.model"
27+
tokenizer_path = "./tests/assets/test_tiktoken.model"
2828

2929
[optimizer]
3030
name = "AdamW"

0 commit comments

Comments
 (0)