torchft 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. torchft-0.2.0/CODE_OF_CONDUCT.md +61 -0
  2. torchft-0.2.0/CONTRIBUTING.md +125 -0
  3. torchft-0.2.0/Cargo.lock +2170 -0
  4. torchft-0.2.0/Cargo.toml +32 -0
  5. torchft-0.2.0/Dockerfile +6 -0
  6. torchft-0.2.0/LICENSE +34 -0
  7. torchft-0.2.0/PKG-INFO +316 -0
  8. torchft-0.2.0/README.md +288 -0
  9. torchft-0.2.0/SECURITY.md +10 -0
  10. torchft-0.2.0/build.rs +12 -0
  11. torchft-0.2.0/docs/Makefile +33 -0
  12. torchft-0.2.0/docs/requirements.txt +16 -0
  13. torchft-0.2.0/docs/source/_static/img/pytorch-logo-dark.svg +33 -0
  14. torchft-0.2.0/docs/source/_static/img/pytorch-logo-flame.png +0 -0
  15. torchft-0.2.0/docs/source/_static/img/torchft_logo.svg +66 -0
  16. torchft-0.2.0/docs/source/_static/img/torchft_logo_dark.svg +72 -0
  17. torchft-0.2.0/docs/source/_static/img/torchft_logo_vertical.svg +98 -0
  18. torchft-0.2.0/docs/source/api.rst +15 -0
  19. torchft-0.2.0/docs/source/assumptions_and_recommendations.rst +28 -0
  20. torchft-0.2.0/docs/source/checkpointing.rst +4 -0
  21. torchft-0.2.0/docs/source/conf.py +425 -0
  22. torchft-0.2.0/docs/source/coordination.rst +4 -0
  23. torchft-0.2.0/docs/source/data.rst +4 -0
  24. torchft-0.2.0/docs/source/ddp.rst +4 -0
  25. torchft-0.2.0/docs/source/index.rst +34 -0
  26. torchft-0.2.0/docs/source/local_sgd.rst +4 -0
  27. torchft-0.2.0/docs/source/manager.rst +4 -0
  28. torchft-0.2.0/docs/source/optim.rst +4 -0
  29. torchft-0.2.0/docs/source/parameter_server.rst +4 -0
  30. torchft-0.2.0/docs/source/process_group.rst +4 -0
  31. torchft-0.2.0/docs/source/protocol.rst +8 -0
  32. torchft-0.2.0/examples/monarch/README.md +51 -0
  33. torchft-0.2.0/examples/monarch/__init__.py +0 -0
  34. torchft-0.2.0/examples/monarch/train_distributed.py +442 -0
  35. torchft-0.2.0/examples/monarch/utils/__init__.py +0 -0
  36. torchft-0.2.0/examples/monarch/utils/failure.py +135 -0
  37. torchft-0.2.0/media/fault_tolerance_poster.pdf +0 -0
  38. torchft-0.2.0/media/fault_tolerance_poster.png +0 -0
  39. torchft-0.2.0/media/hsdp_train_loop.png +0 -0
  40. torchft-0.2.0/media/overview.mmd +46 -0
  41. torchft-0.2.0/media/overview.mmd.svg +359 -0
  42. torchft-0.2.0/media/torchft-overview.png +0 -0
  43. torchft-0.2.0/media/torchft_hyperpod_poster_pytorch_conference_2025.pdf +0 -0
  44. torchft-0.2.0/media/torchft_logo.svg +94 -0
  45. torchft-0.2.0/media/torchft_logo_dark.svg +100 -0
  46. torchft-0.2.0/media/torchft_logo_vertical.svg +98 -0
  47. torchft-0.2.0/proto/torchft.proto +130 -0
  48. torchft-0.2.0/pyproject.toml +74 -0
  49. torchft-0.2.0/scripts/header_check.sh +25 -0
  50. torchft-0.2.0/scripts/patch_nightly_version.py +29 -0
  51. torchft-0.2.0/scripts/publish.sh +17 -0
  52. torchft-0.2.0/scripts/test.sh +12 -0
  53. torchft-0.2.0/src/bin/lighthouse.rs +24 -0
  54. torchft-0.2.0/src/lib.rs +764 -0
  55. torchft-0.2.0/src/lighthouse.rs +1298 -0
  56. torchft-0.2.0/src/manager.rs +1219 -0
  57. torchft-0.2.0/src/net.rs +87 -0
  58. torchft-0.2.0/src/retry.rs +109 -0
  59. torchft-0.2.0/src/timeout.rs +103 -0
  60. torchft-0.2.0/templates/index.html +60 -0
  61. torchft-0.2.0/templates/status.html +49 -0
  62. torchft-0.2.0/test_fixtures/torchft.diloco_regression_test.DiLoCoMockedUpdateTest.test_diloco_mocked_failure_recovery_0.json +618 -0
  63. torchft-0.2.0/test_fixtures/torchft.diloco_regression_test.DiLoCoMockedUpdateTest.test_diloco_mocked_updates_0.json +522 -0
  64. torchft-0.2.0/test_fixtures/torchft.diloco_regression_test.DiLoCoMockedUpdateTest.test_diloco_mocked_updates_1.json +522 -0
  65. torchft-0.2.0/test_fixtures/torchft.diloco_regression_test.DiLoCoMockedUpdateTest.test_diloco_mocked_updates_2.json +522 -0
  66. torchft-0.2.0/test_fixtures/torchft.diloco_regression_test.DiLoCoMockedUpdateTest.test_diloco_mocked_updates_3.json +522 -0
  67. torchft-0.2.0/test_fixtures/torchft.diloco_regression_test.DiLoCoMockedUpdateTest.test_diloco_mocked_updates_4.json +522 -0
  68. torchft-0.2.0/test_fixtures/torchft.diloco_regression_test.DiLoCoMockedUpdateTest.test_diloco_mocked_updates_5.json +522 -0
  69. torchft-0.2.0/tools/linter/adapters/pyre_linter.py +132 -0
  70. torchft-0.2.0/tools/linter/adapters/rust_linter.py +208 -0
  71. torchft-0.2.0/torchft/__init__.py +34 -0
  72. torchft-0.2.0/torchft/_test/diloco_trainer.py +288 -0
  73. torchft-0.2.0/torchft/_test/managed_work_test.py +319 -0
  74. torchft-0.2.0/torchft/_test_utils.py +112 -0
  75. torchft-0.2.0/torchft/_torchft.pyi +116 -0
  76. torchft-0.2.0/torchft/checkpointing/__init__.py +20 -0
  77. torchft-0.2.0/torchft/checkpointing/_rwlock.py +136 -0
  78. torchft-0.2.0/torchft/checkpointing/_serialization.py +39 -0
  79. torchft-0.2.0/torchft/checkpointing/http_transport.py +299 -0
  80. torchft-0.2.0/torchft/checkpointing/http_transport_bench.py +60 -0
  81. torchft-0.2.0/torchft/checkpointing/http_transport_test.py +145 -0
  82. torchft-0.2.0/torchft/checkpointing/pg_transport.py +306 -0
  83. torchft-0.2.0/torchft/checkpointing/pg_transport_bench.py +107 -0
  84. torchft-0.2.0/torchft/checkpointing/pg_transport_test.py +100 -0
  85. torchft-0.2.0/torchft/checkpointing/rwlock_test.py +57 -0
  86. torchft-0.2.0/torchft/checkpointing/transport.py +68 -0
  87. torchft-0.2.0/torchft/checkpointing/transport_test.py +171 -0
  88. torchft-0.2.0/torchft/collectives.py +419 -0
  89. torchft-0.2.0/torchft/collectives_test.py +213 -0
  90. torchft-0.2.0/torchft/coordination.py +39 -0
  91. torchft-0.2.0/torchft/coordination_test.py +35 -0
  92. torchft-0.2.0/torchft/data.py +77 -0
  93. torchft-0.2.0/torchft/data_test.py +39 -0
  94. torchft-0.2.0/torchft/ddp.py +103 -0
  95. torchft-0.2.0/torchft/ddp_test.py +67 -0
  96. torchft-0.2.0/torchft/diloco_regression_test.py +649 -0
  97. torchft-0.2.0/torchft/examples/slurm/README.md +34 -0
  98. torchft-0.2.0/torchft/examples/slurm/punisher.py +95 -0
  99. torchft-0.2.0/torchft/examples/slurm/runner.py +222 -0
  100. torchft-0.2.0/torchft/fsdp_test.py +103 -0
  101. torchft-0.2.0/torchft/futures.py +354 -0
  102. torchft-0.2.0/torchft/futures_test.py +139 -0
  103. torchft-0.2.0/torchft/http.py +14 -0
  104. torchft-0.2.0/torchft/lighthouse_test.py +162 -0
  105. torchft-0.2.0/torchft/local_sgd.py +789 -0
  106. torchft-0.2.0/torchft/local_sgd_integ_test.py +609 -0
  107. torchft-0.2.0/torchft/local_sgd_test.py +323 -0
  108. torchft-0.2.0/torchft/manager.py +1367 -0
  109. torchft-0.2.0/torchft/manager_integ_test.py +818 -0
  110. torchft-0.2.0/torchft/manager_test.py +914 -0
  111. torchft-0.2.0/torchft/multiprocessing.py +38 -0
  112. torchft-0.2.0/torchft/multiprocessing_dummy_context.py +135 -0
  113. torchft-0.2.0/torchft/multiprocessing_test.py +63 -0
  114. torchft-0.2.0/torchft/optim.py +66 -0
  115. torchft-0.2.0/torchft/optim_test.py +49 -0
  116. torchft-0.2.0/torchft/otel.py +135 -0
  117. torchft-0.2.0/torchft/parameter_server.py +194 -0
  118. torchft-0.2.0/torchft/parameter_server_test.py +45 -0
  119. torchft-0.2.0/torchft/process_group.py +2144 -0
  120. torchft-0.2.0/torchft/process_group_test.py +1069 -0
  121. torchft-0.2.0/torchft/quantization.py +696 -0
  122. torchft-0.2.0/torchft/quantization_test.py +130 -0
  123. torchft-0.2.0/torchft/torchcomms.py +324 -0
  124. torchft-0.2.0/torchft/torchcomms_test.py +326 -0
  125. torchft-0.2.0/torchft/torchx.py +89 -0
  126. torchft-0.2.0/torchft/utils.py +67 -0
  127. torchft-0.2.0/torchft/work.py +26 -0
  128. torchft-0.2.0/train_ddp.py +216 -0
  129. torchft-0.2.0/train_diloco.py +250 -0
@@ -0,0 +1,61 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make
6
+ participation in our project and our community a harassment-free experience for everyone, regardless of age, body size,
7
+ disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education,
8
+ socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
9
+
10
+ ## Our Standards
11
+
12
+ Examples of behavior that contributes to creating a positive environment include:
13
+
14
+ - Using welcoming and inclusive language
15
+ - Being respectful of differing viewpoints and experiences
16
+ - Gracefully accepting constructive criticism
17
+ - Focusing on what is best for the community
18
+ - Showing empathy towards other community members
19
+
20
+ Examples of unacceptable behavior by participants include:
21
+
22
+ - The use of sexualized language or imagery and unwelcome sexual attention or advances
23
+ - Trolling, insulting/derogatory comments, and personal or political attacks
24
+ - Public or private harassment
25
+ - Publishing others' private information, such as a physical or electronic address, without explicit permission
26
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
27
+
28
+ ## Our Responsibilities
29
+
30
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take
31
+ appropriate and fair corrective action in response to any instances of unacceptable behavior.
32
+
33
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
34
+ issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any
35
+ contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
36
+
37
+ ## Scope
38
+
39
+ This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the
40
+ project or its community in public spaces. Examples of representing a project or community include using an official
41
+ project e-mail address, posting via an official social media account, or acting as an appointed representative at an
42
+ online or offline event. Representation of a project may be further defined and clarified by project maintainers.
43
+
44
+ ## Enforcement
45
+
46
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at
47
+ <conduct@pytorch.org>. All complaints will be reviewed and investigated and will result in a response that is deemed
48
+ necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to
49
+ the reporter of an incident. Further details of specific enforcement policies may be posted separately.
50
+
51
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent
52
+ repercussions as determined by other members of the project's leadership.
53
+
54
+ ## Attribution
55
+
56
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at
57
+ https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
58
+
59
+ [homepage]: https://www.contributor-covenant.org
60
+
61
+ For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
@@ -0,0 +1,125 @@
1
+ # Contributing to torchft
2
+
3
+ We want to make contributing to this project as easy and transparent as possible.
4
+
5
+ ## TL;DR
6
+
7
+ We appreciate all contributions. If you are interested in contributing to torchft, there are many ways to help out.
8
+ Your contributions may fall into the following categories:
9
+
10
+ - It helps the project if you can
11
+
12
+ - Report issues that you're facing
13
+ - Give a :+1: on issues that others reported and that are relevant to you
14
+
15
+ - Answering questions on the issue tracker, investigating bugs are very valuable contributions to the project.
16
+
17
+ - You would like to improve the documentation. This is no less important than improving the library itself! If you find
18
+ a typo in the documentation, do not hesitate to submit a GitHub pull request.
19
+
20
+ - If you would like to fix a bug:
21
+
22
+ - comment on the issue that you want to work on this issue
23
+ - send a PR with your fix, see below.
24
+
25
+ - If you plan to contribute new features, utility functions or extensions, please first open an issue and discuss the
26
+ feature with us.
27
+ - If you would like to feature a usage example in our documentation, discuss that with us in an issue.
28
+
29
+ ## Issues
30
+
31
+ We use GitHub issues to track public bugs. Please follow the existing templates if possible and ensure that the
32
+ description is clear and has sufficient instructions to be able to reproduce the issue.
33
+
34
+ ## Development installation
35
+
36
+ torchft is written in Python and Rust so you will need to install the Rust
37
+ toolchain. [rustup](https://rustup.rs/) is recommended as it makes using tools such as linters much
38
+ easier.
39
+
40
+ Once you have rust installed you can install the project via:
41
+
42
+ ```
43
+ $ pip install -e .[dev]
44
+ ```
45
+
46
+ Also see the installation instructions in [the README](./README.md).
47
+
48
+ ## Pull Requests
49
+
50
+ We actively welcome your pull requests.
51
+
52
+ 1. Fork the repo and create your branch from `main`.
53
+ 2. If you've added code that should be tested, add tests.
54
+ 3. If you've changed APIs, update the documentation and examples.
55
+ 4. Ensure the test suite passes.
56
+ 5. If you haven't already, complete the Contributor License Agreement ("CLA").
57
+
58
+ ### Code style
59
+
60
+ `torchft` enforces a fairly strict code format with tools such as cargo fmt and black.
61
+
62
+ ```shell
63
+ pip install lintrunner lintrunner-adapters
64
+ lintrunner init
65
+ lintrunner -a
66
+ cargo +nightly fmt
67
+ ```
68
+
69
+ ### Tests
70
+
71
+ We use `pytest` as our testing framework. To execute a specific test, use the following command:
72
+
73
+ ```sh
74
+ pytest torchft/process_group_test.py -k test_device_mesh
75
+ ```
76
+
77
+ To run the Rust tests run:
78
+
79
+ ```sh
80
+ cargo test
81
+ ```
82
+
83
+ To run the entire suite of tests:
84
+
85
+ ```sh
86
+ $ scripts/test.sh
87
+ ```
88
+
89
+ ### Build Docs
90
+ To build the docs run:
91
+ ```sh
92
+ pip install -r docs/requirements.txt
93
+ cd docs
94
+ make livehtml
95
+ ```
96
+
97
+ The docs will be built in the `docs/build/html` directory and served at http://localhost:8000.
98
+ The page will be automatically re-built as long as the process is kept running.
99
+
100
+ ### Running Multiple Replica Local Job
101
+
102
+ We use torchx to run multiple worker local test jobs. You need to run the
103
+ lighthouse first and then you can use torchx to launch as many replica groups as
104
+ you want. This uses the [train_ddp.py](./train_ddp.py) script.
105
+
106
+ ```sh
107
+ $ torchft_lighthouse --min_replicas 2 --join_timeout_ms 10000 &
108
+ $ torchx run -- --replicas 10
109
+ ```
110
+
111
+ Once the Lighthouse has started you can view the status of all the workers at the Lighthouse dashboard.
112
+
113
+ Default address is: http://localhost:29510
114
+
115
+ ## Contributor License Agreement ("CLA")
116
+
117
+ In order to accept your pull request, we need you to submit a CLA. You only need to do this once to work on any of
118
+ Facebook's open source projects.
119
+
120
+ Complete your CLA here: <https://code.facebook.com/cla>
121
+
122
+ ## License
123
+
124
+ By contributing to torchft, you agree that your contributions will be licensed under the LICENSE file in the root
125
+ directory of this source tree.