‹ Reports
The Dispatch

OSS Report: pytorch/torchtune


Torchtune Faces Challenges with Model Compatibility and Memory Management Amidst Active Development

Torchtune, a PyTorch library aimed at fine-tuning large language models, is experiencing significant user engagement but faces ongoing challenges with model compatibility and memory management, particularly with large models like Llama3.

Recent activities reveal a vibrant development community tackling issues such as model loading difficulties, out-of-memory errors during training, and requests for enhanced features like multi-GPU support. The project has seen numerous feature requests and bug reports, indicating both high user interest and areas needing improvement.

Recent Activity

Recent issues highlight recurring themes of model compatibility and memory management. For example, #1355 addresses import issues due to package availability changes, while #1349 deals with type mismatch errors in quantized models. These issues indicate a need for improved robustness in handling model formats and configurations.

The development team has been actively contributing to the project, with notable recent activities including:

Of Note

  1. Model Compatibility Issues: Frequent reports of difficulties in loading models from different formats suggest a need for better integration strategies.

  2. Memory Management Concerns: Out-of-memory errors during training highlight the necessity for more efficient resource utilization techniques.

  3. Community Engagement: Active discussions around PRs and issues reflect strong community involvement, which is crucial for the project's evolution.

  4. Multimodal Capabilities: Efforts to integrate models like Flamingo indicate a strategic push towards supporting diverse data types.

  5. Continuous Integration Enhancements: Improvements in CI processes aim to maintain stability across releases, ensuring reliable performance for users.

Quantified Reports

Quantify commits



Quantified Commit Activity Over 30 Days

Developer Avatar Branches PRs Commits Files Changes
pytorchbot 2 0/0/0 71 851 98444
Salman Mohammadi 1 15/14/1 14 117 5760
Rafi Ayub 1 12/11/1 11 92 5410
Yang Fan 1 1/2/0 2 31 5144
Joe Cummings 3 13/13/0 20 37 4021
Philip Bontrager 2 9/5/2 6 46 2068
lucylq 1 2/1/1 1 9 495
ebsmothers 2 6/5/0 6 26 402
Wing Lian 1 0/1/0 1 10 385
Jerry Zhang 1 2/2/0 2 6 331
Thien Tran 1 4/3/0 3 4 264
Dan Zheng 1 1/1/0 1 9 230
Felipe Mello 1 8/5/1 5 25 145
Takayoshi Makabe 1 1/1/0 1 41 125
ChinoUkaegbu 1 1/1/0 1 12 122
Louis Ulmer 1 0/1/0 1 5 63
Tanish Ambulkar 1 0/1/0 1 5 60
Less Wright 1 2/1/0 1 6 31
sanchitintel 1 1/1/0 1 5 10
Matthias Reso 1 1/1/0 1 1 3
Ramil Nugmanov 1 1/1/0 1 1 3
Jianing Qi (user074) 0 1/0/0 0 0 0
Yan Shi (HJG971121) 0 1/0/0 0 0 0
Srinivas Billa (nivibilla) 0 0/0/1 0 0 0
None (andrewor14) 0 1/0/0 0 0 0
Leigh Gable (leighgable) 0 1/0/0 0 0 0
Jean Schmidt (jeanschmidt) 0 1/0/1 0 0 0
Musab Gultekin (musabgultekin) 0 1/0/1 0 0 0
None (mikaylagawarecki) 0 1/0/0 0 0 0

PRs: created by that dev and opened/merged/closed-unmerged during the period

Quantify Issues



Recent GitHub Issues Activity

Timespan Opened Closed Comments Labeled Milestones
7 Days 33 15 37 15 2
30 Days 72 45 178 31 2
90 Days 158 115 480 91 2
All Time 444 332 - - -

Like all software activity quantification, these numbers are imperfect but sometimes useful. Comments, Labels, and Milestones refer to those issues opened in the timespan in question.

Detailed Reports

Report On: Fetch issues



Recent Activity Analysis

The PyTorch project torchtune currently has 112 open issues, reflecting a vibrant and active development community. Recent activity highlights a mix of feature requests, bug reports, and discussions about model training configurations, particularly around the Llama3 model. Notably, there are several issues related to fine-tuning and inference errors, indicating potential challenges in usability and integration with existing models.

Several themes emerge from the recent issues:

  • Model Compatibility: Users frequently report difficulties in loading models or checkpoints, particularly when transitioning between different formats (e.g., from Hugging Face to torchtune).
  • Memory Management: Multiple users have raised concerns about out-of-memory (OOM) errors during training, especially with large models like Llama3.
  • Feature Requests: There is a strong demand for additional features such as support for multi-GPU training with QLoRA and improved documentation for using custom datasets.

Issue Details

Most Recently Created Issues

  1. Issue #1362: Can I Finetune Llama3 Without Creating CustomDataset Function?

    • Priority: Low
    • Status: Open
    • Created: 0 days ago
    • Details: User seeks clarification on finetuning Llama3 with a specific dataset format without needing to create a custom dataset function.
  2. Issue #1361: Add Pretraining Code and Multi Modal Support?

    • Priority: Medium
    • Status: Open
    • Created: 2 days ago
    • Details: User requests the addition of pretraining support and multi-modal capabilities for the library.
  3. Issue #1355: Fix Import of torchao Now That torchao-nightly Does Not Exist

    • Priority: High
    • Status: Open
    • Created: 2 days ago
    • Details: User reports an issue with importing a package that is no longer available.
  4. Issue #1352: Create Import Protection for torchvision

    • Priority: Low
    • Status: Open
    • Created: 3 days ago
    • Details: Suggests adding import protection to avoid errors if torchvision is not installed.
  5. Issue #1349: RuntimeError: Index Put Requires the Source and Destination Dtypes Match

    • Priority: High
    • Status: Open
    • Created: 4 days ago
    • Details: User encounters a type mismatch error while applying a recipe on a quantized model.

Most Recently Updated Issues

  1. Issue #1355

    • Last edited 2 days ago; ongoing discussion about resolving import issues.
  2. Issue #1352

    • Edited recently as users discuss implementation plans for import protection.
  3. Issue #1349

    • Edited recently; user provides further details on the encountered error.
  4. Issue #1344: Unpin Numpy

    • Last edited 4 days ago; user suggests removing version constraints on Numpy.
  5. Issue #1340: Add Model Builder Function for Code-Llama 34B

    • Edited 4 days ago; ongoing discussion about adding support for new models.

Summary of Themes

The recent issues indicate that users are actively engaging with the library, seeking improvements in usability and functionality. The most pressing concerns revolve around:

  • Compatibility with existing models and formats.
  • Memory management during training, especially with large models.
  • Feature enhancements to support broader use cases, including multi-modal capabilities and improved dataset handling.

Overall, the active dialogue within the community reflects both enthusiasm for the project and a desire for continued improvements to its functionality and documentation.

Report On: Fetch pull requests



Overview

The dataset provided consists of a comprehensive list of pull requests (PRs) from the pytorch/torchtune repository, which is focused on fine-tuning large language models. The PRs encompass various features, improvements, and bug fixes, reflecting ongoing development efforts within the project.

Summary of Pull Requests

  1. PR #1360: Introduces improvements to training UX by displaying GPU metrics directly in the console for better optimization during training runs. This addresses user feedback from AWS regarding the need for actionable insights during model tuning.

  2. PR #1357: Implements components for the Flamingo model, re-implementing previous work based on refactoring efforts. This PR signifies a step towards enhancing multimodal capabilities within torchtune.

  3. PR #1356: Aims to decouple nightly and stable regression tests to ensure that failures in nightly builds do not affect stable tests. This change enhances the reliability of CI processes.

  4. PR #1351: Adds a CPU offload optimizer from torchao, improving memory efficiency during training, particularly for large models like Llama2-7B.

  5. PR #1350: Introduces a learning rate scheduler to the single-device full fine-tuning process, allowing for more flexible training configurations.

  6. PR #1333: Fixes version dependency issues with QAT (Quantization-Aware Training), ensuring compatibility with specific versions of PyTorch.

  7. PR #1330: Updates the QAT recipe to align with recent changes in the full fine-tune distributed recipe, ensuring feature parity across different training methods.

  8. PR #1315: Proposes a proof-of-concept solution to prevent out-of-memory (OOM) errors during checkpoint saving on Colab, showcasing practical improvements for users.

  9. PR #1313: Adds utilities for classifier checkpointing, improving how models load weights during fine-tuning processes.

  10. PR #1309: Introduces support for expandable segments in recipes, enhancing memory management capabilities during training.

  11. PR #1294: Redefines the aten.copy_ operation in torchtune with an inplace version to improve performance and compatibility with newer PyTorch versions.

  12. PR #1286: Deprecates older instruct/chat classes in favor of a unified prompt template interface, streamlining multimodal processing workflows.

  13. PR #1280: Adds support for Intel XPU backend in a device-agnostic manner, expanding hardware compatibility for users.

  14. PR #1263: Introduces a new layer for Mora (Memory Optimized Rank Adaptation), enhancing model efficiency during training.

  15. PR #1152: Focuses on debugging and compiling issues related to FSDP2 (Fully Sharded Data Parallel) recipes with QLoRA.

  16. PR #1193: Integrates flex attention into torchtune, improving sample packing throughput significantly compared to previous implementations.

  17. PR #1076: Implements LayerSkip functionality to allow dynamic dropout of layers during training, optimizing resource usage and potentially improving performance.

  18. PR #1106: Proposes merging instruct/chat datasets into a unified format for better usability and consistency across multimodal applications.

  19. PR #984: Adds an example integration with Hugging Face's Accelerate library, demonstrating how torchtune can work seamlessly with other popular frameworks.

Analysis of Pull Requests

The pull requests reflect several key themes and trends within the ongoing development of torchtune:

Feature Enhancements

Many PRs focus on adding new features or improving existing functionalities. For instance, PRs like #1360 and #1351 introduce significant enhancements that improve user experience and optimize performance during model training. The addition of features such as CPU offloading and learning rate scheduling indicates a strong emphasis on making the library more efficient and user-friendly.

Multimodal Capabilities

Several PRs (e.g., #1357 and #1106) are aimed at enhancing multimodal functionalities within torchtune, particularly through the integration of models like Flamingo and Llama3. This trend suggests an increasing interest in developing capabilities that allow models to handle diverse data types (text and images) effectively.

CI Improvements

The repository is actively working on improving its continuous integration (CI) processes as seen in PRs like #1356 and #1333. These changes aim to ensure that failures in nightly builds do not impact stable releases, thereby enhancing overall reliability and user trust in the library's stability.

Performance Optimization

A recurring theme is the optimization of performance through various means such as flex attention (#1193), dynamic batching (#1121), and layer skipping (#1076). These optimizations are critical as they directly affect training speed and resource utilization, which are crucial factors when working with large language models.

Community Engagement

The discussions around many PRs indicate active community involvement in shaping the direction of torchtune's development. Contributors are encouraged to provide feedback on proposed changes, which fosters a collaborative environment conducive to innovation and improvement.

Documentation and Usability

Several PRs emphasize improving documentation (e.g., PRs like #1196) to enhance user understanding of features and functionalities within torchtune. This focus on documentation is essential for attracting new users and facilitating easier adoption of the library's capabilities.

In conclusion, the pull requests showcase a vibrant development ecosystem within torchtune that is responsive to user needs while pushing forward innovative features aimed at optimizing model training processes across diverse hardware platforms and data modalities. The emphasis on community engagement further strengthens this project’s potential for growth and adaptation in an evolving AI landscape.

Report On: Fetch commits



Repo Commits Analysis

Development Team and Recent Activity

Team Members and Recent Contributions

  1. Joe Cummings (joecummings)

    • Recent Activity:
    • Updated CodeLlama configs and fixed some Phi3 configurations.
    • Updated peak memory stats logging.
    • Refactored RoPE base for CodeLlama.
    • Contributed to multiple PRs related to model configurations and improvements.
    • Collaborations: Worked with Felipe Mello on PR template updates.
  2. Rafi Ayub (RdoubleA)

    • Recent Activity:
    • Moved prompt templating to tokenizer, significantly affecting multiple test files.
    • Refactored SFTDataset for Alpaca and preference dataset with transforms design.
    • Contributed extensively to testing various datasets and models.
    • Collaborations: Engaged in several collaborative efforts on dataset improvements.
  3. Philip Bontrager (pbontrager)

    • Recent Activity:
    • Developed Deep Fusion Modules and refactored TransformerDecoderLayer.
    • Made significant contributions to documentation updates regarding API references.
    • Collaborations: Worked with Joe Cummings on model-related improvements.
  4. Felipe Mello (felipemello1)

    • Recent Activity:
    • Updated the PR template and added extra checks in code.
    • Collaborations: Co-authored several PRs with Joe Cummings.
  5. Less Wright (lessw2020)

    • Recent Activity:
    • Added definitions and builders for the llama3.1 405B model.
  6. Thien Tran (gau-nernst)

    • Recent Activity:
    • Added model+loss compile for full finetune single device.
    • Contributed to profiling recipes.
  7. Salman Mohammadi (SalmanMohammadi)

    • Recent Activity:
    • Generalized reward models and worked on various enhancements related to RLHF components.
    • Contributed significantly to documentation updates and model improvements.
  8. Dan Zheng (dzheng256)

    • Recent Activity:
    • Integrated CometLogger for metrics logging.
  9. Evan Smothers (ebsmothers)

    • Recent Activity:
    • Fixed evaluation in regression tests and contributed to various recipe updates.
  10. Yang Fan (fyabc)

    • Recent Activity:
    • Added support for Qwen2-0.5B and Qwen2-1.5B models.
  11. Wing Lian (winglian)

    • Recent Activity:
    • Implemented NF4 quantization of linear layers without LoRA applied.
  12. Takayoshi Makabe (spider-man-tm)

    • Recent Activity:
    • Added an adapter-only option to LoRA configs.
  13. Jerry Zhang (jerryzh168)

    • Recent Activity:
    • Minor fixes in documentation and testing code.
  14. Lucy Lq (lucylq)

    • Recent Activity:
    • Exported ClipImageTransform with extensive changes across multiple files.
  15. Matthias Reso (mreso)

    • Recent Activity:
    • Added a utility function in torchtune.utils.
  16. Chino Ukaegbu (ChinoUkaegbu)

    • Recent Activity:
    • Refactored loss modules and updated references.
  17. Ramil Nugmanov (stsouko)

    • Recent Activity:
    • Removed unused variables in the transformer module.

Patterns, Themes, and Conclusions

  • The team is actively engaged in enhancing the functionality of the torchtune library, focusing on model configurations, fine-tuning techniques, and improving testing frameworks.
  • Collaboration is evident among team members, particularly in updating documentation, refining models, and addressing bugs or enhancements collectively.
  • A significant emphasis is placed on modular design, as seen in recent contributions that improve integration with existing models while maintaining usability for end-users.
  • The frequency of commits indicates a dynamic development pace, with multiple contributors making substantial changes across various components of the library.
  • Continuous improvement of documentation reflects a commitment to user experience and community engagement, crucial for open-source projects like torchtune.

Overall, the development team demonstrates strong collaboration and a focus on enhancing both functionality and usability within the torchtune project, ensuring it remains a valuable tool for fine-tuning large language models in PyTorch.