Skip to content

Commit d38093f

Browse files
authored
Revert "Add core dependency on stable torchdata (#2408) (#2509)"
This reverts commit 4e458d6.
1 parent 4e458d6 commit d38093f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+366
-1551
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
### 📣 Recent updates 📣
1313
* *February 2025*: Multi-node training is officially [open for business in torchtune](https://pytorch.org/torchtune/main/tutorials/multinode.html)! Full finetune on multiple nodes to take advantage of larger batch sizes and models.
14-
* *December 2024*: torchtune now supports **Llama 3.3 70B**! Try it out by following our installation instructions [here](#installation-%EF%B8%8F), then run any of the configs [here](recipes/configs/llama3_3).
14+
* *December 2024*: torchtune now supports **Llama 3.3 70B**! Try it out by following our installation instructions [here](#Installation), then run any of the configs [here](recipes/configs/llama3_3).
1515
* *November 2024*: torchtune has released [v0.4.0](https://github.com/pytorch/torchtune/releases/tag/v0.4.0) which includes stable support for exciting features like activation offloading and multimodal QLoRA
1616
* *November 2024*: torchtune has added [Gemma2](recipes/configs/gemma2) to its models!
1717
* *October 2024*: torchtune added support for Qwen2.5 models - find the configs [here](recipes/configs/qwen2_5/)
18-
* *September 2024*: torchtune has support for **Llama 3.2 11B Vision**, **Llama 3.2 3B**, and **Llama 3.2 1B** models! Try them out by following our installation instructions [here](#installation-%EF%B8%8F), then run any of the text configs [here](recipes/configs/llama3_2) or vision configs [here](recipes/configs/llama3_2_vision).
18+
* *September 2024*: torchtune has support for **Llama 3.2 11B Vision**, **Llama 3.2 3B**, and **Llama 3.2 1B** models! Try them out by following our installation instructions [here](#Installation), then run any of the text configs [here](recipes/configs/llama3_2) or vision configs [here](recipes/configs/llama3_2_vision).
1919

2020

2121
 
@@ -25,9 +25,9 @@
2525

2626
torchtune is a PyTorch library for easily authoring, post-training, and experimenting with LLMs. It provides:
2727

28-
- Hackable training recipes for SFT, knowledge distillation, DPO, PPO, GRPO, and quantization-aware training
28+
- Hackable training recipes for SFT, knowledge distillation, RL and RLHF, and quantization-aware training
2929
- Simple PyTorch implementations of popular LLMs like Llama, Gemma, Mistral, Phi, Qwen, and more
30-
- Best-in-class memory efficiency, performance improvements, and scaling, utilizing the latest PyTorch APIs
30+
- OOTB best-in-class memory efficiency, performance improvements, and scaling, utilizing the latest PyTorch APIs
3131
- YAML configs for easily configuring training, evaluation, quantization or inference recipes
3232

3333
 

docs/source/api_ref_models.rst

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -299,26 +299,6 @@ To download the Qwen2 1.5B model, for example:
299299
qwen2.lora_qwen2_7b
300300
qwen2.qwen2_tokenizer
301301

302-
phi-4
303-
-----
304-
305-
Models from the `Phi-4 family <https://arxiv.org/abs/2412.08905>`_.
306-
307-
To download the Phi-4 instruct model:
308-
309-
.. code-block:: bash
310-
311-
tune download microsoft/phi-4 --hf-token <HF_TOKEN>
312-
313-
.. autosummary::
314-
:toctree: generated/
315-
:nosignatures:
316-
317-
phi4.phi4_14b
318-
phi4.lora_phi4_14b
319-
phi4.qlora_phi4_14b
320-
phi4.phi4_tokenizer
321-
322302
phi-3
323303
-----
324304

docs/source/api_ref_training.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,4 @@ Miscellaneous
128128
:nosignatures:
129129

130130
get_unmasked_sequence_lengths
131-
disable_dropout
132131
set_seed

docs/source/deep_dives/checkpointer.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,6 @@ to look for it in the output_dir.
402402
.. code-block:: yaml
403403
404404
checkpointer:
405-
# [... rest of the config...]
406-
407405
# checkpoint files. Note that you will need to update this
408406
# section of the config with the intermediate checkpoint files
409407
checkpoint_files: [
@@ -425,11 +423,10 @@ because the base model being loaded is still the same.
425423
.. code-block:: yaml
426424
427425
checkpointer:
428-
# [... rest of the config...]
429426
430427
# adapter_checkpoint. Note that you will need to update this
431428
# section of the config with the intermediate checkpoint files
432-
adapter_checkpoint: epoch_{YOUR_EPOCH}/adapter_model.pt
429+
adapter_checkpoint: epoch_{YOUR_EPOCH}/adapter_model.safetensors
433430
434431
# set to True if restarting training
435432
resume_from_checkpoint: True

docs/source/tutorials/e2e_flow.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Finetune your model
2929
-------------------
3030

3131
First, let's download a model using the tune CLI. The following command will download the `Llama3.2 3B Instruct <https://ai.meta.com/blog/llama-3-2-connect-2024-vision-edge-mobile-devices/>`_
32-
model from the Hugging Face Hub and save it to the local filesystem. Hugging Face uploaded the original
32+
model from the Hugging Face Hub and save it the local filesystem. Hugging Face uploaded the original
3333
weights (``consolidated.00.pth``) and the weights compatible with the `from_pretrained() <https://huggingface.co/docs/huggingface_hub/main/en/guides/integrations#frompretrained>`_ API (``*.safetensors``).
3434
We don't need both so we'll ignore the original weights when downloading.
3535

@@ -168,15 +168,15 @@ There are 3 types of folders:
168168
Let's understand the files:
169169

170170
- ``adapter_model.safetensors`` and ``adapter_model.pt`` are your LoRA trained adapter weights. We save a duplicated .pt version of it to facilitate resuming from checkpoint.
171-
- ``model-{}-of-{}.safetensors`` are your trained full model weights (not adapters). When LoRA finetuning, these are only present if we set ``save_adapter_weights_only=False``. In that case, we merge the base model with trained adapters, making inference easier.
171+
- ``model-{}-of-{}.safetensors`` are your trained full model weights (not adapters). When LoRA finetuning, these are only present if we set ``save_adapter_weights_only=False``. In that case, we merge the merged base model with trained adapters, making inference easier.
172172
- ``adapter_config.json`` is used by Huggingface PEFT when loading an adapter (more on that later);
173173
- ``model.safetensors.index.json`` is used by Hugging Face ``from_pretrained()`` when loading the model weights (more on that later)
174-
- All other files were originally in the checkpoint_dir. They are automatically copied during training. Files over 100MiB and ending in .safetensors, .pth, .pt, .bin are ignored, making it lightweight.
174+
- All other files were originally in the checkpoint_dir. They are automatically copied during training. Files over 100MiB and ending on .safetensors, .pth, .pt, .bin are ignored, making it lightweight.
175175

176176
Evaluate your model
177177
-------------------
178178

179-
We've fine-tuned a model. But how well does this model really do? Let's determine this through structured evaluation and playing with it.
179+
We've fine-tuned a model. But how well does this model really do? Let's determine this through structured evaluation and playing around with it.
180180

181181
.. _eval_harness_label:
182182

@@ -364,8 +364,9 @@ to those in the previously-linked table.
364364
Use your model in the wild
365365
--------------------------
366366

367-
Let's say we're happy with how our model is performing at this point - we want to do something with it! Productionize it for serving, publish on the Hugging Face Hub, etc.
368-
Since we handle checkpoint conversion, you can directly work with standard formats.
367+
Let's say we're happy with how our model is performing at this point - we want to do something with it! Productionize for serving, publish on the Hugging Face Hub, etc.
368+
As we mentioned above, one of the benefits of handling of the checkpoint conversion is that you can directly work with standard formats. This helps
369+
with interoperability with other libraries since torchtune doesn't add yet another format to the mix.
369370

370371
Use with Hugging Face ``from_pretrained()``
371372
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -438,8 +439,8 @@ Use with vLLM
438439
`vLLM <https://docs.vllm.ai/en/latest/>`_ is a fast and easy-to-use library for LLM inference and serving. They include a lot of awesome features like
439440
state-of-the-art serving throughput, continuous batching of incoming requests, quantization, and speculative decoding.
440441

441-
The library will load any .safetensors file. Since we already merged the full model weights and adapter weights, we can safely delete the
442-
adapter weights (or move them) so that vLLM doesn't get confused by those files.
442+
The library will load any .safetensors file. Since here we mixed both the full model weights and adapter weights, we have to delete the
443+
adapter weights to succesfully load it.
443444

444445
.. code-block:: python
445446

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ authors = [
1010
]
1111
keywords = ["pytorch", "finetuning", "llm"]
1212
dependencies = [
13-
# Stable torchdata (no nightly support)
14-
"torchdata",
1513

1614
# Hugging Face integrations
1715
"datasets",
@@ -35,6 +33,7 @@ dependencies = [
3533

3634
# Multimodal
3735
"Pillow>=9.4.0",
36+
3837
]
3938
dynamic = ["version"]
4039

recipes/configs/llama3_2_vision/11B_generation_v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# tune download meta-llama/Llama-3.2-11B-Vision-Instruct --output-dir /tmp/Llama-3.2-11B-Vision-Instruct --ignore-patterns "original/consolidated*"
66
#
77
# To launch, run the following command from root torchtune directory:
8-
# tune run dev/generate_v2 --config llama3_2_vision/11B_generation_v2
8+
# tune run dev/generate_v2 --config llama3_2_vision/generation_v2
99

1010
output_dir: ./
1111

recipes/configs/dev/11B_lora_multi_dataset.yaml renamed to recipes/configs/llama3_2_vision/11B_lora_multi_dataset.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
# tune download meta-llama/Llama-3.2-11B-Vision-Instruct --output-dir /tmp/Llama-3.2-11B-Vision-Instruct --ignore-patterns "original/consolidated*"
66
#
77
# To launch on 2 devices, run the following command from root:
8-
# tune run --nproc_per_node 2 dev/lora_finetune_distributed_multi_dataset --config dev/11B_lora_multi_dataset
8+
# tune run --nproc_per_node 2 lora_finetune_distributed_multi_dataset --config llama3_2_vision/11B_lora_multi_dataset
99
#
1010
# You can add specific overrides through the command line. For example
1111
# to override the checkpointer directory while launching training:
12-
# tune run --nproc_per_node 2 dev/lora_finetune_distributed_multi_dataset --config dev/11B_lora_multi_dataset checkpointer.checkpoint_dir=<YOUR_CHECKPOINT_DIR>
12+
# tune run --nproc_per_node 2 lora_finetune_distributed_multi_dataset --config llama3_2_vision/11B_lora_multi_dataset checkpointer.checkpoint_dir=<YOUR_CHECKPOINT_DIR>
1313
#
1414
# This config works best when the model is being fine-tuned on 2+ GPUs.
1515
# For single device LoRA finetuning please use 11B_lora_single_device.yaml
@@ -116,6 +116,7 @@ enable_activation_checkpointing: True
116116
dtype: bf16
117117

118118
# Logging
119+
output_dir: /tmp/lora-llama3.2-vision-finetune
119120
metric_logger:
120121
_component_: torchtune.training.metric_logging.DiskLogger
121122
log_dir: ${output_dir}/logs

recipes/configs/mistral/7B_full_ppo_low_memory.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ output_dir: /tmp/torchtune/mistral_7B/full_ppo_low_memory # /tmp may be deleted
3030
tokenizer:
3131
_component_: torchtune.models.mistral.mistral_tokenizer
3232
path: /tmp/Mistral-7B-Instruct-v0.2/tokenizer.model
33-
max_seq_len: 512
33+
max_seq_len: null
3434

3535
# Dataset
3636
dataset:

recipes/configs/phi4/evaluation.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,17 @@ checkpointer:
1414
_component_: torchtune.training.FullModelHFCheckpointer
1515
checkpoint_dir: /tmp/phi-4
1616
checkpoint_files: [
17-
model-00001-of-00006.safetensors,
18-
model-00002-of-00006.safetensors,
19-
model-00003-of-00006.safetensors,
20-
model-00004-of-00006.safetensors,
21-
model-00005-of-00006.safetensors,
22-
model-00006-of-00006.safetensors,
17+
model-00001-of-00002.safetensors,
18+
model-00002-of-00002.safetensors
2319
]
2420
recipe_checkpoint: null
2521
output_dir: ${output_dir}
26-
model_type: PHI4
22+
model_type: PHI3_MINI
2723
resume_from_checkpoint: False
2824

2925
# Tokenizer
3026
tokenizer:
31-
_component_: torchtune.models.phi4.phi4_tokenizer
27+
_component_: torchtune.models.phi4.phi4_14b_tokenizer
3228
vocab_path: /tmp/phi-4/vocab.json
3329
merges_path: /tmp/phi-4/merges.txt
3430
max_seq_len: null

0 commit comments

Comments
 (0)