Skip to content

Commit 29ae975

Browse files
authored
TorchTune --> torchtune (pytorch#1007)
1 parent 27f6872 commit 29ae975

21 files changed

+61
-61
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ And should see the following output:
175175
```bash
176176
usage: tune [-h] {ls,cp,download,run,validate} ...
177177

178-
Welcome to the TorchTune CLI!
178+
Welcome to the torchtune CLI!
179179

180180
options:
181181
-h, --help show this help message and exit

docs/source/api_ref_utilities.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ torchtune.utils
1010
Checkpointing
1111
-------------
1212

13-
TorchTune offers checkpointers to allow seamless transitioning between checkpoint formats for training and interoperability with the rest of the ecosystem. For a comprehensive overview of
13+
torchtune offers checkpointers to allow seamless transitioning between checkpoint formats for training and interoperability with the rest of the ecosystem. For a comprehensive overview of
1414
checkpointing, please see the :ref:`checkpointing deep-dive <understand_checkpointer>`.
1515

1616
.. autosummary::
@@ -68,7 +68,7 @@ Utilities to reduce memory consumption during training.
6868
Performance and Profiling
6969
-------------------------
7070

71-
TorchTune provides utilities to profile and debug the performance
71+
torchtune provides utilities to profile and debug the performance
7272
of your finetuning job.
7373

7474
.. autosummary::

docs/source/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
# Get TORCHTUNE_VERSION_DOCS during the build.
8585
torchtune_version_docs = os.environ.get("TORCHTUNE_VERSION_DOCS", None)
8686
print(f"torchtune_version_docs: {torchtune_version_docs}")
87-
project = "TorchTune"
87+
project = "torchtune"
8888

8989
# The code below will cut version displayed in the dropdown like this:
9090
# By default, set to "main".
@@ -111,7 +111,7 @@
111111
master_doc = "index"
112112

113113
# General information about the project.
114-
copyright = "2023-present, TorchTune Contributors"
114+
copyright = "2023-present, torchtune Contributors"
115115
author = "Torch Contributors"
116116

117117
# The language for content autogenerated by Sphinx. Refer to documentation

docs/source/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ torchtune tutorials.
5858
:tags: finetuning,llama2,lora
5959

6060
.. customcarditem::
61-
:header: Understanding QLoRA in TorchTune
61+
:header: Understanding QLoRA in torchtune
6262
:card_description: Using QLoRA to quantize base model weights and maximize memory savings
6363
:image: _static/img/generic-pytorch-logo.png
6464
:link: tutorials/qlora_finetune.html

docs/source/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ And should see the following output:
2929

3030
usage: tune [-h] {download,ls,cp,run,validate} ...
3131

32-
Welcome to the TorchTune CLI!
32+
Welcome to the torchtune CLI!
3333

3434
options:
3535
-h, --help show this help message and exit

docs/source/tutorials/e2e_flow.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ Modify ``custom_generation_config.yaml`` to include the following changes.
391391
.. code-block:: yaml
392392
393393
checkpointer:
394-
# we need to use the custom TorchTune checkpointer
394+
# we need to use the custom torchtune checkpointer
395395
# instead of the HF checkpointer for loading
396396
# quantized models
397397
_component_: torchtune.utils.FullModelTorchTuneCheckpointer

docs/source/tutorials/llama3.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ For example, on two devices:
103103
104104
tune run --nproc_per_node 2 lora_finetune_distributed --config llama3/8B_lora
105105
106-
Finally, if we want to use even less memory, we can leverage TorchTune's QLoRA recipe via:
106+
Finally, if we want to use even less memory, we can leverage torchtune's QLoRA recipe via:
107107

108108
.. code-block:: bash
109109
@@ -299,7 +299,7 @@ First, we'll make one more change to our ``custom_generation_config.yaml``.
299299
.. code-block:: yaml
300300
301301
checkpointer:
302-
# we need to use the custom TorchTune checkpointer
302+
# we need to use the custom torchtune checkpointer
303303
# instead of the HF checkpointer for loading
304304
# quantized models
305305
_component_: torchtune.utils.FullModelTorchTuneCheckpointer

recipes/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818

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

tests/test_import_recipes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
def test_import_recipes():
1111
with pytest.raises(
12-
ModuleNotFoundError, match="The TorchTune recipes directory isn't a package"
12+
ModuleNotFoundError, match="The torchtune recipes directory isn't a package"
1313
):
1414
import recipes # noqa

tests/torchtune/_cli/test_tune.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def test_tune_without_args_returns_help(self, capsys, monkeypatch):
2121
captured = capsys.readouterr()
2222
output = captured.out.rstrip("\n")
2323

24-
assert "Welcome to the TorchTune CLI!" in output
24+
assert "Welcome to the torchtune CLI!" in output

tests/torchtune/utils/test_checkpointer.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def weight_dtype(self):
3939
def state_dict_1(self, weight_dtype):
4040
"""
4141
State dict for a HF format checkpoint. This state dict is "complete" and
42-
can be loaded into a TorchTune model once correctly converted.
42+
can be loaded into a torchtune model once correctly converted.
4343
"""
4444
state_dict = {
4545
"model.embed_tokens.weight": randn(_VOCAB_SIZE, _DIM, dtype=weight_dtype),
@@ -189,7 +189,7 @@ def test_load_save_checkpoint_single_file(
189189
We test:
190190
* ``load_checkpoint`` loads the right sets of keys
191191
* Internal state of the checkpointer is correctly updated
192-
* Converted checkpoint can be loaded into the llama2 TorchTune implementation
192+
* Converted checkpoint can be loaded into the llama2 torchtune implementation
193193
* Saved checkpoint keys match the original checkpoint
194194
"""
195195
# Read the state dict directly from file using torch.load. This will be the state
@@ -243,7 +243,7 @@ def test_save_load_checkpoint_multiple_file(
243243
We test:
244244
* ``load_checkpoint`` loads the right sets of keys
245245
* Internal state of the checkpointer is correctly updated
246-
* Converted checkpoint can be loaded into the llama2 TorchTune implementation
246+
* Converted checkpoint can be loaded into the llama2 torchtune implementation
247247
"""
248248
# Read the state dict directly from files
249249
checkpoint_file_1, checkpoint_file_2 = llama2_hf_checkpoints
@@ -303,7 +303,7 @@ def weight_dtype(self):
303303
def state_dict(self, weight_dtype):
304304
"""
305305
State dict for a HF format mistral reward model checkpoint. This state dict is
306-
"complete" and can be loaded into a TorchTune model once correctly converted.
306+
"complete" and can be loaded into a torchtune model once correctly converted.
307307
"""
308308
state_dict = {
309309
"model.embed_tokens.weight": randn(_VOCAB_SIZE, _DIM, dtype=weight_dtype),
@@ -398,7 +398,7 @@ def test_load_save_checkpoint_single_file(
398398
We test:
399399
* ``load_checkpoint`` loads the right sets of keys
400400
* Internal state of the checkpointer is correctly updated
401-
* Converted checkpoint can be loaded into the `mistral_classifier` TorchTune implementation
401+
* Converted checkpoint can be loaded into the `mistral_classifier` torchtune implementation
402402
* Saved checkpoint keys match the original checkpoint
403403
"""
404404
# Read the state dict directly from file using torch.load. This will be the state

torchtune/_cli/tune.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self):
2020
# Initialize the top-level parser
2121
self._parser = argparse.ArgumentParser(
2222
prog="tune",
23-
description="Welcome to the TorchTune CLI!",
23+
description="Welcome to the torchtune CLI!",
2424
add_help=True,
2525
)
2626
# Default command is to print help

torchtune/config/_instantiate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def instantiate(
4444
"""
4545
Given a DictConfig with a _component_ field specifying the object to instantiate and
4646
additional fields for keyword arguments, create an instance of the specified object.
47-
You can use this function to create the exact instance of a TorchTune object you want
47+
You can use this function to create the exact instance of a torchtune object you want
4848
to use in your recipe using the specification from the config.
4949
5050
This function also supports passing in positional args and keyword args within the

torchtune/models/convert_weights.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import torch
1212

1313

14-
# state dict key mappings from Meta's format to TorchTune's format
14+
# state dict key mappings from Meta's format to torchtune's format
1515
_FROM_META = {
1616
"tok_embeddings.weight": "tok_embeddings.weight",
1717
"norm.weight": "norm.scale",
@@ -27,7 +27,7 @@
2727
"layers.{}.feed_forward.w3.weight": "layers.{}.mlp.w3.weight",
2828
}
2929

30-
# state dict key mappings from HF's format to TorchTune's format
30+
# state dict key mappings from HF's format to torchtune's format
3131
_FROM_HF = {
3232
"model.embed_tokens.weight": "tok_embeddings.weight",
3333
"model.layers.{}.self_attn.q_proj.weight": "layers.{}.attn.q_proj.weight",
@@ -66,7 +66,7 @@ def get_mapped_key(key: str, mapping_dict: Dict[str, str]) -> str:
6666

6767
def meta_to_tune(state_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]:
6868
"""
69-
Convert a state dict from Meta's format to TorchTune's format. State dicts
69+
Convert a state dict from Meta's format to torchtune's format. State dicts
7070
from multiple checkpoint files should be consolidated into a single state dict
7171
before calling this function.
7272
@@ -77,7 +77,7 @@ def meta_to_tune(state_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]
7777
state_dict (Dict[str, torch.Tensor]): State dict in Meta's format.
7878
7979
Returns:
80-
Dict[str, torch.Tensor]: State dict in TorchTune's format.
80+
Dict[str, torch.Tensor]: State dict in torchtune's format.
8181
"""
8282
converted_state_dict = {}
8383
for key, value in state_dict.items():
@@ -90,12 +90,12 @@ def meta_to_tune(state_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]
9090

9191
def tune_to_meta(state_dict: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]:
9292
"""
93-
Convert a state dict from TorchTune's format to Meta's format. This function
93+
Convert a state dict from torchtune's format to Meta's format. This function
9494
doesn't handle any sharding or splitting of state dicts. It follows the
9595
state_dict IN -> state_dict OUT pattern.
9696
9797
Args:
98-
state_dict (Dict[str, torch.Tensor]): State dict in TorchTune's format.
98+
state_dict (Dict[str, torch.Tensor]): State dict in torchtune's format.
9999
100100
Returns:
101101
Dict[str, torch.Tensor]: State dict in Meta's format.
@@ -118,7 +118,7 @@ def hf_to_tune(
118118
head_dim: int = None,
119119
) -> Dict[str, torch.Tensor]:
120120
"""
121-
Convert a state dict from HF's format to TorchTune's format. State dicts
121+
Convert a state dict from HF's format to torchtune's format. State dicts
122122
from multiple checkpoint files should be consolidated into a single state dict
123123
before calling this function.
124124
@@ -134,7 +134,7 @@ def hf_to_tune(
134134
as dim // num_heads.
135135
136136
Returns:
137-
Dict[str, torch.Tensor]: State dict in TorchTune's format.
137+
Dict[str, torch.Tensor]: State dict in torchtune's format.
138138
"""
139139
converted_state_dict = {}
140140
if head_dim is None:
@@ -165,12 +165,12 @@ def tune_to_hf(
165165
dim: int = 4096,
166166
):
167167
"""
168-
Convert a state dict from TorchTune's format to HF's format. This function
168+
Convert a state dict from torchtune's format to HF's format. This function
169169
doesn't handle any sharding or splitting of state dicts. It follows the
170170
state_dict IN -> state_dict OUT pattern.
171171
172172
Args:
173-
state_dict (Dict[str, torch.Tensor]): State dict in TorchTune's format.
173+
state_dict (Dict[str, torch.Tensor]): State dict in torchtune's format.
174174
num_heads (int): Number of heads in the model.
175175
num_kv_heads (int): Number of heads in the key/value projection layers.
176176
dim (int): Dimension of the model.

torchtune/models/gemma/_component_builders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"""
2424
Component builders for the Gemma 2B models and popular variants such as LoRA.
2525
26-
TorchTune provides composable building blocks. Builder functions help
26+
torchtune provides composable building blocks. Builder functions help
2727
stitch these building blocks into higher-level components. This design has
2828
two benefits:
2929
- The building blocks themselves are very flexible. For example, ``CausalSelfAttention``

torchtune/models/llama2/_component_builders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"""
2828
Component builders for the Llama2 model and popular variants such as LoRA.
2929
30-
TorchTune provides composable building blocks. Builder functions help
30+
torchtune provides composable building blocks. Builder functions help
3131
stitch these building blocks into higher-level components. This design has
3232
two benefits:
3333
- The building blocks themselves are very flexible. For example, ``CausalSelfAttention``

torchtune/models/llama3/_component_builders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"""
2929
Component builders for the Llama3 model and popular variants such as LoRA.
3030
31-
TorchTune provides composable building blocks. Builder functions help
31+
torchtune provides composable building blocks. Builder functions help
3232
stitch these building blocks into higher-level components. This design has
3333
two benefits:
3434
- The building blocks themselves are very flexible. For example, ``CausalSelfAttention``

torchtune/models/mistral/_component_builders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"""
2525
Component builders for the Mistral 7B models and popular variants such as LoRA.
2626
27-
TorchTune provides composable building blocks. Builder functions help
27+
torchtune provides composable building blocks. Builder functions help
2828
stitch these building blocks into higher-level components. This design has
2929
two benefits:
3030
- The building blocks themselves are very flexible. For example, ``CausalSelfAttention``

torchtune/models/mistral/_convert_weights.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def mistral_reward_hf_to_tune(
3434
head_dim: int = None,
3535
) -> Dict[str, torch.Tensor]:
3636
"""
37-
Convert a state dict from HF's format to TorchTune's format, which contains the weights
37+
Convert a state dict from HF's format to torchtune's format, which contains the weights
3838
of a Mistral reward model.
3939
State dicts from multiple checkpoint files should be consolidated into a single state dict
4040
before calling this function.
@@ -52,7 +52,7 @@ def mistral_reward_hf_to_tune(
5252
as dim // num_heads.
5353
5454
Returns:
55-
Dict[str, torch.Tensor]: State dict in TorchTune's format.
55+
Dict[str, torch.Tensor]: State dict in torchtune's format.
5656
"""
5757
converted_state_dict = {}
5858
if head_dim is None:
@@ -83,14 +83,14 @@ def mistral_reward_tune_to_hf(
8383
dim: int = 4096,
8484
) -> Dict[str, torch.Tensor]:
8585
"""
86-
Convert a state dict from TorchTune's format to Hugging Face's format for a Mistral reward model.
86+
Convert a state dict from torchtune's format to Hugging Face's format for a Mistral reward model.
8787
88-
This function takes a state dictionary in TorchTune's format, which contains the weights of a Mistral reward model,
88+
This function takes a state dictionary in torchtune's format, which contains the weights of a Mistral reward model,
8989
and converts it into a format that can be loaded into a Hugging Face model.
9090
The logic is identical to :func:`~torchtune.models.convert_weights.tune_to_hf`, but with a different mapping.
9191
9292
Args:
93-
state_dict (Dict[str, torch.Tensor]): State dict in TorchTune's format.
93+
state_dict (Dict[str, torch.Tensor]): State dict in torchtune's format.
9494
num_heads (int, optional): Number of heads in the model. Defaults to 32.
9595
num_kv_heads (int, optional): Number of heads in the key/value projection layers. Defaults to 32.
9696
dim (int, optional): Dimension of the model. Defaults to 4096.

torchtune/recipe_interfaces.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class FTRecipeInterface(Protocol):
1111
"""
1212
This class provides a loose structure which every LLM fine-tuning recipe
1313
should follow. Please note that the interface itself should not be a vehicle for
14-
code reuse. TorchTune strictly prohibits implementation inheritance in the codebase.
14+
code reuse. torchtune strictly prohibits implementation inheritance in the codebase.
1515
1616
A few notes about the design and the need for this interface:
1717
- This interface is meant to help recipe-writers organize their code in a way
@@ -64,7 +64,7 @@ class EvalRecipeInterface(Protocol):
6464
"""
6565
This class provides a loose structure which every LLM evaluation recipe
6666
should follow. Please note that the interface itself should not be a vehicle for
67-
code reuse. TorchTune strictly prohibits implementation inheritance in the codebase.
67+
code reuse. torchtune strictly prohibits implementation inheritance in the codebase.
6868
"""
6969

7070
def load_checkpoint(self, **kwargs) -> None:

0 commit comments

Comments
 (0)