instance_id stringlengths 21 53 | repo stringclasses 188
values | language stringclasses 1
value | pull_number int64 20 148k | title stringlengths 6 144 | body stringlengths 0 83.4k | created_at stringdate 2015-09-25 03:17:17 2025-07-10 16:50:35 | problem_statement stringlengths 188 240k | hints_text stringlengths 0 145k | resolved_issues listlengths 1 6 | base_commit stringlengths 40 40 | commit_to_review dict | reference_review_comments listlengths 1 62 | merged_commit stringlengths 40 40 | merged_patch stringlengths 297 9.87M | metadata dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Avaiga__taipy-585@f39ef98 | Avaiga/taipy | Python | 585 | Added s3 object data node (AWS) | Fixes [Avaiga/taipy/issues/536](https://github.com/Avaiga/taipy/issues/536)
# Changes made
- Added a new DataNode to support the reading and writing of objects to Amazon Web Service S3 bucket.
- Performed unit testing on this new feauture to ensure that it works as required.
; you may not use this file except in compliance with\n+# the License. You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE... | 4175dca9126fc15ac039c79ae26c564d722523d2 | diff --git a/Pipfile b/Pipfile
index 6239395ee6..31bde2f699 100644
--- a/Pipfile
+++ b/Pipfile
@@ -34,6 +34,7 @@ sqlalchemy = "==2.0.16"
toml = "==0.10"
twisted = "==23.8.0"
tzlocal = "==3.0"
+boto3 = "==1.29.1"
[dev-packages]
autopep8 = "*"
@@ -73,6 +74,7 @@ types-python-dateutil = "*"
types-pytz = "*"
types-... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
HypothesisWorks__hypothesis-4279@11085e7 | HypothesisWorks/hypothesis | Python | 4,279 | Shrink NaN to canonical form | Closes #4277.
The first issue (`-nan`) is a one-liner, switching from `sign_aware_lte` to `math.copysign` to detect the sign of a choice.
Second issue (`struct.unpack('d', struct.pack('Q', 0xfff8000000000001))[0]`) requires distinguishing NaNs in float shrinking, so that code is reshuffled a bit to separate out t... | 2025-02-27T13:08:03Z | Shrink NaN to canonical form
```
for s in [0, 2, 4]:
@given(st.lists(st.integers()|st.floats()))
@seed(s)
def sort_is_reversible(l):
assert sorted(l, reverse=True) == list(reversed(sorted(l)))
try:
sort_is_reversible()
except AssertionError as e:
print(e.__notes__[0].replace(... | [
{
"body": "```\nfor s in [0, 2, 4]:\n @given(st.lists(st.integers()|st.floats()))\n @seed(s)\n def sort_is_reversible(l):\n assert sorted(l, reverse=True) == list(reversed(sorted(l)))\n try:\n sort_is_reversible()\n except AssertionError as e:\n print(e.__notes__[0].replace(\... | 36bd5dbc509792f5d1cdb8873370aa3b362ad267 | {
"head_commit": "11085e7edcf0a48a7dbb913c92eeee83fd5a7682",
"head_commit_message": "Use constant for SIGNALING_NAN",
"patch_to_review": "diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst\nnew file mode 100644\nindex 0000000000..9c0a8cac20\n--- /dev/null\n+++ b/hypothesis-python/RELEASE.r... | [
{
"diff_hunk": "@@ -19,19 +20,19 @@\n \n class Float(Shrinker):\n def setup(self):\n- self.NAN = math.nan\n self.debugging_enabled = True\n \n- def make_immutable(self, f):\n- f = float(f)\n+ def make_canonical(self, f):\n if math.isnan(f):\n- # Always use the ... | 14a565611b6e5c5af5eb4cc8b2a795a24e1c2e69 | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..9c0a8cac20
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,3 @@
+RELEASE_TYPE: patch
+
+Improve shrinking of non-standard NaN float values (:issue:`4277`).
diff --git a/hypothesis-python/src/hy... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
HypothesisWorks__hypothesis-4362@bd01806 | HypothesisWorks/hypothesis | Python | 4,362 | Rule bundle printing | Closes #4361 by improving printing of the steps (going into exception notes).
There are some matters of taste wrt exactly how the bundle variables should look, which I'll address in comments below. | 2025-04-15T08:11:47Z | return symbols in reproduce statement undefined with targets in stateful test.
I write a simple stateful test to reproduce this issue:
```python
from hypothesis.stateful import RuleBasedStateMachine, Bundle, rule, initialize
from hypothesis import settings, Verbosity
from hypothesis import strategies as st
import ra... | The `targets=` argument to `@rule` is for replicating the same value to multiple bundles - see https://hypothesis.readthedocs.io/en/latest/reference/api.html#hypothesis.stateful.rule. So, in this case, the tuple return value is added to both bundles. To get the desired result, you will need to either define one rule pe... | [
{
"body": "I write a simple stateful test to reproduce this issue: \n\n```python \nfrom hypothesis.stateful import RuleBasedStateMachine, Bundle, rule, initialize\nfrom hypothesis import settings, Verbosity\nfrom hypothesis import strategies as st\nimport random\n\n@settings(max_examples=100, verbosity=Verbosit... | 994c03b78dbd5ad09bb16d5c54d334a0daaa532d | {
"head_commit": "bd01806de3834a3043f93587d3dac55e788dca94",
"head_commit_message": "Special-case 1-target multi-result",
"patch_to_review": "diff --git a/hypothesis-python/src/hypothesis/stateful.py b/hypothesis-python/src/hypothesis/stateful.py\nindex 2ade095dbe..46aeb6eba9 100644\n--- a/hypothesis-python/src/h... | [
{
"diff_hunk": "@@ -1248,6 +1248,83 @@ def fail_fast(self, param):\n )\n \n \n+@pytest.mark.parametrize(\n+ \"initial,repr_\",\n+ [\n+ (\"ret1\", \"a_0 = b_0 = a_1 = \"),\n+ (multiple(), \"\"),\n+ (multiple(\"ret1\"), \"(a_0,) = (b_0,) = (a_1,) = \"),\n+ (multiple(\"ret1\",... | d244844fd1bdd4642c9f66029e6905a679a7359b | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..e71c7f356b
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,4 @@
+RELEASE_TYPE: patch
+
+Improves output when assigning values to multiple target bundles
+in a stateful rule (:issue:`4361`).
dif... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
HypothesisWorks__hypothesis-3837@beb143f | HypothesisWorks/hypothesis | Python | 3,837 | Warnings for side effects during import | Warn if the storage directory is accessed, or if a lazy strategy is materialized, during import. This is intended to target plugins that are loaded during import of hypothesis through importlib entrypoints, but the scope is expanded to the full duration of the import (because why not).
For pytest plugins, it's not c... | 2024-01-12T11:35:13Z | Folder ".hypothesis" appears after "pytest" run but I don't use hypothesis
I don't use hypothesis. But when I run pytest on my own package the "hypothesis" plugin seems to be active. At the end a folder named `.hypothesis` appears in my project folder.
A assume that some other pip packages do have hypothesis as an d... | #2106
We're very careful to only create that folder when Hypothesis is _used_, not just imported, so my guess is that you have a pytest plugin which actually invokes some Hypothesis code.
Can you share a minimal reproducible example, or at least paste in all the output from running `pytest`? If we can identify the... | [
{
"body": "I don't use hypothesis. But when I run pytest on my own package the \"hypothesis\" plugin seems to be active. At the end a folder named `.hypothesis` appears in my project folder.\r\n\r\nA assume that some other pip packages do have hypothesis as an dependency and that is why it exists in my system. ... | 9b182e9d4b876cdf2282644506a9925ee9baaa55 | {
"head_commit": "beb143f0718c4a39b17785d267a07ffa8d4db20c",
"head_commit_message": "Fix test when pytest or other plugins emit warnings, add a no-cover",
"patch_to_review": "diff --git a/hypothesis-python/.coveragerc b/hypothesis-python/.coveragerc\nindex 7732c620a2..89be7942bc 100644\n--- a/hypothesis-python/.c... | [
{
"diff_hunk": "@@ -117,6 +117,13 @@ class HypothesisDeprecationWarning(HypothesisWarning, FutureWarning):\n \"\"\"\n \n \n+class HypothesisSideeffectWarning(HypothesisWarning):\n+ \"\"\"A warning issued by Hypothesis when it sees actions that are\n+ discouraged at import or initialization time becaus... | dbd7ae9bd3288c8e357d83055957c50053373929 | diff --git a/hypothesis-python/.coveragerc b/hypothesis-python/.coveragerc
index 7732c620a2..89be7942bc 100644
--- a/hypothesis-python/.coveragerc
+++ b/hypothesis-python/.coveragerc
@@ -3,6 +3,7 @@ branch = True
omit =
**/_hypothesis_ftz_detector.py
**/_hypothesis_pytestplugin.py
+ **/_hypothesis_globals... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
HypothesisWorks__hypothesis-4110@e7e09bd | HypothesisWorks/hypothesis | Python | 4,110 | first draft of handling marker exceptions wrapped in exceptiongroup | I have barely used Hypothesis, and never worked with the codebase, so there are several gaps in code coverage and question marks on implementation decisions. If somebody more familiar wants to take a quick pass and opine it'd be very helpful :)
I can get code coverage by manually raising the specific `ExceptionGroup... | 2024-09-19T13:55:19Z | Our internals should handle `StopTest` and other marker exceptions even when wrapped in an `ExceptionGroup`
Hypothesis currently misbehaves if the marker exceptions we raise are wrapped up in an `ExceptionGroup`, e.g.:
```python
import trio
from hypothesis import given, strategies as st
@given(st.data())
def t... | How picky are you about depending on `exceptiongroup` for newer python versions?
3.12.1 added `ExceptionGroup` support for `contextlib.suppress`, so if we wanna use `exceptiongroup.suppress` we need to bump the `install_requirement` to `python < 3.12.1`.
I count 9 instances of `suppress` usage.
Big `try: ... excep... | [
{
"body": "Hypothesis currently misbehaves if the marker exceptions we raise are wrapped up in an `ExceptionGroup`, e.g.:\r\n\r\n```python\r\nimport trio\r\nfrom hypothesis import given, strategies as st\r\n\r\n@given(st.data())\r\ndef test(data):\r\n async def task(pred):\r\n return data.draw(st.bool... | 2fd99dd01b9653115fa9b10bfbe906388ce35e23 | {
"head_commit": "e7e09bde27654769453282d4888e86f7f60841a9",
"head_commit_message": "add future annotations to unbreak py38",
"patch_to_review": "diff --git a/hypothesis-python/src/hypothesis/core.py b/hypothesis-python/src/hypothesis/core.py\nindex 304ba614d0..bb9bd36346 100644\n--- a/hypothesis-python/src/hypot... | [
{
"diff_hunk": "@@ -1086,6 +1136,9 @@ def _execute_once_for_engine(self, data: ConjectureData) -> None:\n # This can happen if an error occurred in a finally\n # block somewhere, suppressing our original StopTest.\n # We raise a new one here to resume normal opera... | fa31a4e996e2153bc627f1d5e9766beaf1c357fb | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..b289060100
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,3 @@
+RELEASE_TYPE: minor
+
+This release improves Hypothesis' handling of ExceptionGroup - it's now able to detect marker detections ... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
HypothesisWorks__hypothesis-3521@2814f29 | HypothesisWorks/hypothesis | Python | 3,521 | Improve handling of forward references in get_type_hints | Closes #3519 | 2022-12-03T22:34:00Z | Hypothesis fails with ForwardRefs and recursive pydantic models
I would like to use hypothesis to generate instances of pydantic models, but it looks like it cannot handle recursive models with ForwardRefs.
(Quite) minimal example triggering the problem:
```python
from pydantic import BaseModel
from typing impo... | Thanks for the report - I cut this down further to:
```python
import typing
from pydantic import BaseModel
from hypothesis.internal import compat
class Dummy(BaseModel):
x: "typing.Union[int, Dummy]"
Dummy.update_forward_refs()
print(typing.get_type_hints(Dummy))
print(compat.get_type_hints(Dummy))
... | [
{
"body": "I would like to use hypothesis to generate instances of pydantic models, but it looks like it cannot handle recursive models with ForwardRefs.\r\n\r\n(Quite) minimal example triggering the problem:\r\n\r\n```python\r\nfrom pydantic import BaseModel\r\nfrom typing import Optional, Union\r\nfrom hypoth... | 808c61b55f401d967b2de27db037a9a753776008 | {
"head_commit": "2814f29eac103edb5c95b94d4ac37c0858b15e65",
"head_commit_message": "fix failing tests",
"patch_to_review": "diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst\nnew file mode 100644\nindex 0000000000..01c2236f3a\n--- /dev/null\n+++ b/hypothesis-python/RELEASE.rst\n@@ -0,0 +... | [
{
"diff_hunk": "@@ -111,10 +146,25 @@ def get_type_hints(thing):\n and is_a_type(p.annotation)\n and p.annotation is not p.empty\n ):\n+\n+ p_hint = p.annotation\n+\n+ # Defer to `get_type_hints` if signature annotatio... | f046651c7a107ddd8edd184cd0c638443ba2e981 | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..01c2236f3a
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,6 @@
+RELEASE_TYPE: minor
+
+This release improves Hypothesis' ability to resolve forward references in
+type annotations. It fixes a... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
HypothesisWorks__hypothesis-3409@fd095bc | HypothesisWorks/hypothesis | Python | 3,409 | Allow subnormal in complex_numbers | Fixes #3390.
Adds the `allow_subnormal` argument to `complex_numbers` by applying it to both the real and imaginary parts separately. | 2022-07-16T20:51:02Z | `allow_subnormal` keyword for `complex_numbers`
I would like to be able to exclude subnormals from the floats drawn (or more specifically the resulting imaginary and real parts of the constructed complex number) in the `complex_numbers` strategy, but that's currently not possible.
Has this been considered already? | Worth noting supporting v2 of the Array API in `hypothesis.extra.array_api`, which includes complex numbers which would presumably make subnormals out-of-scope, would probably want this feature. (I'll have to write a separate issue outlining the different approaches we could take for v2 support generally).
I think we'r... | [
{
"body": "I would like to be able to exclude subnormals from the floats drawn (or more specifically the resulting imaginary and real parts of the constructed complex number) in the `complex_numbers` strategy, but that's currently not possible. \r\nHas this been considered already?\r\n\r\n",
"number": 3390,... | eed37f681b2baf007034a453193d8e314c3c15f4 | {
"head_commit": "fd095bcc14965bfeb5a173203bf0f021cf39684e",
"head_commit_message": "Fix _is_subnormal",
"patch_to_review": "diff --git a/AUTHORS.rst b/AUTHORS.rst\nindex ae41da8e34..4ea8610e75 100644\n--- a/AUTHORS.rst\n+++ b/AUTHORS.rst\n@@ -51,6 +51,7 @@ their individual contributions.\n * `Eduardo Enriquez <h... | [
{
"diff_hunk": "@@ -1639,7 +1643,14 @@ def complex_numbers(\n f\"Cannot have allow_nan={allow_nan!r}, min_magnitude={min_magnitude!r} \"\n f\"max_magnitude={max_magnitude!r}\"\n )\n- allow_kw = {\"allow_nan\": allow_nan, \"allow_infinity\": allow_infinity}\n+ allow_kw = {",... | bcc61764c85fc107b99c0dbf4d68000712223245 | diff --git a/AUTHORS.rst b/AUTHORS.rst
index ae41da8e34..4ea8610e75 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -51,6 +51,7 @@ their individual contributions.
* `Eduardo Enriquez <https://www.github.com/eduzen>`_ (eduardo.a.enriquez@gmail.com)
* `El Awbery <https://www.github.com/ElAwbery>`_
* `Emmanuel Leblond <h... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
HypothesisWorks__hypothesis-3548@2628087 | HypothesisWorks/hypothesis | Python | 3,548 | add option to generate annotations for the tests generated by hypothesis | This adds a `annotation` argument to all public ghostwriter functions, as well as a `--annotations` and `--no-annotations` flag to the CLI. It searches the function for which the tests are generated for type annotations. If the arguments have type annotations, the same will be used for the generated tests.
The gener... | 2023-01-18T16:28:49Z | Add type hints to the tests generated by ghostwriter
I was wondering if it is possible to add type hints to the tests generated by ghostwriter. For that I've come up with a straight-forward solution (~44 insertions), which uses the `_get_params` method to get the parameters and uses them to see what annotations are req... | Seems like a reasonable feature! I think we'll want to add add an `annotations: bool | None = None` argument: if boolean we do or don't write out type annotations, and if None we match the annotated-ness of the code we're writing tests for. A PR would be fantastic; I'm very happy to review things and help contributor... | [
{
"body": "I was wondering if it is possible to add type hints to the tests generated by ghostwriter. For that I've come up with a straight-forward solution (~44 insertions), which uses the `_get_params` method to get the parameters and uses them to see what annotations are required. If `inspect.Parameter.empty... | 0c7d2fc4e16d5434bd373b1ac175e9069d7011e6 | {
"head_commit": "26280872e844eb3ac4bc58c11bff557bd7c1dd02",
"head_commit_message": "improved the stability of the annotation detection in the ghostwriter",
"patch_to_review": "diff --git a/AUTHORS.rst b/AUTHORS.rst\nindex 34f86e2052..dbc3cf3760 100644\n--- a/AUTHORS.rst\n+++ b/AUTHORS.rst\n@@ -120,6 +120,7 @@ th... | [
{
"diff_hunk": "@@ -812,6 +822,159 @@ def _make_test_body(\n return imports, body\n \n \n+def _annotate_args(\n+ argnames: Iterable[str], funcs: Iterable[Callable], imports: ImportSet\n+) -> Iterable[str]:\n+ arg_parameters: Dict[str, Set[Any]] = {}\n+ for func in funcs:\n+ for key, param in... | 3f2413762ed960582064a13c0235e5c4a0c39701 | diff --git a/AUTHORS.rst b/AUTHORS.rst
index 34f86e2052..dbc3cf3760 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -120,6 +120,7 @@ their individual contributions.
* `Munir Abdinur <https://www.github.com/mabdinur>`_
* `Nicholas Chammas <https://www.github.com/nchammas>`_
* `Nick Anyos <https://www.github.com/NickAny... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
HypothesisWorks__hypothesis-3668@8f13ecf | HypothesisWorks/hypothesis | Python | 3,668 | Warn if search space for inferred strategy is small (no variation) | Fixes https://github.com/HypothesisWorks/hypothesis/issues/3653. | 2023-06-01T10:34:28Z | Warn (or fail) when inferred strategy is the trivial default object
Given the following two tests:
```python
from hypothesis import given
import numpy as np
@given(x=...)
def test_int(x: int):
assert x==0
@given(x=...)
def test_int8(x: np.int8):
assert x==0
```
The first one fails (as it shou... | I think emitting a warning when `st.from_type(thing)` resolves to a non-registered zero-argument `st.builds(thing)` would be reasonable, even though that won't catch all cases where we only generate a single value (and in fact doesn't guarantee that it always generates a single value!). Implementation of that will go ... | [
{
"body": "Given the following two tests:\r\n\r\n```python\r\nfrom hypothesis import given\r\nimport numpy as np\r\n\r\n@given(x=...)\r\ndef test_int(x: int):\r\n assert x==0\r\n\r\n@given(x=...)\r\ndef test_int8(x: np.int8):\r\n assert x==0\r\n```\r\n\r\nThe first one fails (as it should!), but the secon... | c58cb0f277d637ca0e330424ebaf22b33ca41138 | {
"head_commit": "8f13ecfa558dd7a21c7343202f6447c45bb626d1",
"head_commit_message": "Fixes more tests",
"patch_to_review": "diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst\nnew file mode 100644\nindex 0000000000..a589d77751\n--- /dev/null\n+++ b/hypothesis-python/RELEASE.rst\n@@ -0,0 +1... | [
{
"diff_hunk": "@@ -1204,6 +1213,13 @@ def defer_recursion(thing, producer):\n # may be able to fall back on type annotations.\n if issubclass(thing, enum.Enum):\n return sampled_from(thing)\n+ # Handle numpy types through extras\n+ if thing.__module__ == \"numpy\":\n+ import numpy ... | 04ec6791eda7e6f999fdcf8c06a39ee185704ea8 | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..7b421375aa
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,6 @@
+RELEASE_TYPE: minor
+
+Warn in :func:`~hypothesis.strategies.from_type` if the inferred strategy
+has no variation (always retur... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
HypothesisWorks__hypothesis-3186@a4705d4 | HypothesisWorks/hypothesis | Python | 3,186 | Fix stateful _print_step for invariants | fix #3185 | 2021-12-08T17:13:47Z | stateful _print_step doesn't display invariant
minimal example:
```python
from hypothesis.stateful import *
class StateMachine(RuleBasedStateMachine):
@invariant()
def invariant1(self):
assert False
@rule()
def rule1(self):
assert True
run_state_machine_as_test(StateMachi... | [
{
"body": "minimal example:\r\n```python\r\nfrom hypothesis.stateful import *\r\n\r\nclass StateMachine(RuleBasedStateMachine):\r\n @invariant()\r\n def invariant1(self):\r\n assert False\r\n\r\n @rule()\r\n def rule1(self):\r\n assert True\r\n\r\nrun_state_machine_as_test(StateMachine... | 09fc14039576fa2891b565bc1c4aff3d361d3489 | {
"head_commit": "a4705d4dbabaec4b88b147ae6a561fc2023d9983",
"head_commit_message": "Add RELEASE.rst for issue #3185",
"patch_to_review": "diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst\nnew file mode 100644\nindex 0000000000..fb53656140\n--- /dev/null\n+++ b/hypothesis-python/RELEASE.... | [
{
"diff_hunk": "@@ -204,7 +208,11 @@ def run_state_machine(factory, data):\n # If it does, and the result is a 'MultipleResult',\n # then 'print_step' prints a multi-variable assignment.\n machine._print_step(rule, data_to_print, result)\n-... | ecced4c597ddfdf5a1781198d4e1384c69f55e05 | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..fb53656140
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,3 @@
+RELEASE_TYPE: patch
+
+This patch fix invariants display in stateful falsifying examples (:issue:`3185`).
\ No newline at end of... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
HypothesisWorks__hypothesis-3247@de0e0c3 | HypothesisWorks/hypothesis | Python | 3,247 | Make `hypothesis.infer` an alias for `...` and enable `@given(...)` to infer-all | Closes #3188 | 2022-03-05T19:05:15Z | Permit `...` in place of `hypothesis.infer`, and enable users to write `@given(...)` to mean "infer everything"
I propose that `Ellipses`, or `...`, be used in place of `hypothesis.infer` in the context of `@given`. E.g.
```python
from hypothesis import given, infer
@given(x=infer, y=infer)
def test_me(x: int, ... | [
{
"body": "I propose that `Ellipses`, or `...`, be used in place of `hypothesis.infer` in the context of `@given`. E.g.\r\n\r\n```python\r\nfrom hypothesis import given, infer\r\n\r\n@given(x=infer, y=infer)\r\ndef test_me(x: int, y: str):\r\n # code here\r\n```\r\n\r\ncould be re-written as\r\n\r\n```python... | f2a3966b9455ad63a88ba7ee416988c8267273ae | {
"head_commit": "de0e0c3219a38907e3d585c5565218ba8364af58",
"head_commit_message": "Remove references to infer in error messages and docstrings",
"patch_to_review": "diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst\nnew file mode 100644\nindex 0000000000..0ebc45aa05\n--- /dev/null\n+++ ... | [
{
"diff_hunk": "@@ -887,7 +887,7 @@ def builds(\n if to_infer - set(hints):\n badargs = \", \".join(sorted(to_infer - set(hints)))\n raise InvalidArgument(\n- f\"passed infer for {badargs}, but there is no type annotation\"\n+ f\"passed ... for {bada... | 12073e7c89e59bb037aae850262b26bf96f89caa | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..0ebc45aa05
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,6 @@
+RELEASE_TYPE: minor
+
+This release changes the implementation of :const:`~hypothesis.infer` to be an alias
+for :obj:`python:E... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} | |
HypothesisWorks__hypothesis-2970@63fd316 | HypothesisWorks/hypothesis | Python | 2,970 | add .hypothesis to invalid tests | adds `.hypothesis` to invalid tests.
this fixes #2966
I'm not quite sure where (or how) I should test it, I couldn't find any tests using .hypothesis other than the ones swapping the test function and that won't work here without making the invalid tests far more complicated...
all existing tests seem to pass. | 2021-05-22T15:26:42Z | confusing errors when using hypothesis with pytest-asyncio
given the following invalid test as `foo` does not exist...
```python
import hypothesis
import pytest
@pytest.mark.asyncio
@hypothesis.given(foo=hypothesis.infer)
async def test_foo() -> None:
pass
```
pytest will error the test with the foll... | Yep, looks like you're exactly right. Want to open a PR to fix it? If not, we'll be happy to fix
https://github.com/HypothesisWorks/hypothesis/blob/06aa7b45e57ac90e3c66e24b0b8157d70af1aa08/hypothesis-python/src/hypothesis/core.py#L238-L243
I am happy to make a PR, but what would the preferred fix be? Deleting the ... | [
{
"body": "given the following invalid test as `foo` does not exist...\r\n\r\n```python\r\nimport hypothesis\r\nimport pytest\r\n\r\n@pytest.mark.asyncio\r\n@hypothesis.given(foo=hypothesis.infer)\r\nasync def test_foo() -> None:\r\n pass\r\n```\r\n\r\npytest will error the test with the following...\r\n\r\n... | 37532c8fe168a6b4a4f287000b822887cdc02073 | {
"head_commit": "63fd3162272744d95d4c3c8f7ddf47b0f4ac6e74",
"head_commit_message": "test: adding tests for .hypothesis on invalid tests",
"patch_to_review": "diff --git a/AUTHORS.rst b/AUTHORS.rst\nindex cede38481b..0fa24c42bf 100644\n--- a/AUTHORS.rst\n+++ b/AUTHORS.rst\n@@ -36,6 +36,7 @@ their individual contr... | [
{
"diff_hunk": "@@ -155,3 +158,15 @@ def test(s):\n (saved_examples,) = db.data.values()\n assert seen == buffers\n assert len(saved_examples) == db_size\n+\n+\n+def test_fuzzing_invalid_test_raises_error():\n+ # Invalid: @given with too many positional arguments\n+ @given(st.integers(), st.in... | 57af7dabc280067477f29d1ffe53a249b780b51f | diff --git a/AUTHORS.rst b/AUTHORS.rst
index cede38481b..0fa24c42bf 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -36,6 +36,7 @@ their individual contributions.
* `Cristi Cobzarenco <https://github.com/cristicbz>`_ (cristi@reinfer.io)
* `Damon Francisco <https://github.com/dtfrancisco>`_ (damontfrancisco@yahoo.com)
... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
HypothesisWorks__hypothesis-2446@d016284 | HypothesisWorks/hypothesis | Python | 2,446 | WIP: Smarter return type for st.functions() | @Zac-HD I got started on making the changes. Just wanted to check, if I am making the code changes in the right direction.
Disclaimer - A few test cases are failing. I will fix them.
(edit for magic comment: resolves #2425) | 2020-05-21T12:03:41Z | Type annotations used for `functions` strategy
When you accept a function as a parameter to another function, if you're using `mypy` and `typing` you may well have that method described already using `Callable` etc. In this case, it's redundant to create a lambda function for the `like` attribute of `hypothesis.strateg... | It's not quite clear to me what you're asking for. If you mean "`st.functions(like=Callable[[int, int], int])` should work", you're better off using `st.from_type()`.
If you mean "`st.functions()` ought to infer a strategy for `returns` from the return-type annotation on the `like` function", that sounds pretty goo... | [
{
"body": "When you accept a function as a parameter to another function, if you're using `mypy` and `typing` you may well have that method described already using `Callable` etc. In this case, it's redundant to create a lambda function for the `like` attribute of `hypothesis.strategies.functions`. It would be ... | a2268fd1aaa07a6ac2e849be39576a8e43c90865 | {
"head_commit": "d016284c31a9a3ae5c002e213547b9d017f2f481",
"head_commit_message": "Added release notes, and test to validate new changes",
"patch_to_review": "diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst\nindex c5b10ddda9..522aaa9bc3 100644\n--- a/CONTRIBUTING.rst\n+++ b/CONTRIBUTING.rst\n@@ -185,6 +185,7 @... | [
{
"diff_hunk": "@@ -75,12 +75,22 @@ def test_functions_lambda_with_arg(f):\n assert isinstance(f(1), bool)\n \n \n-@pytest.mark.parametrize(\"like,returns\", [(None, booleans()), (lambda: None, None)])\n+@pytest.mark.parametrize(\n+ \"like,returns\", [(None, booleans()), (lambda: None, \"not a strategy\"... | 83aa57926b4afc875c9521498151ab85290c4901 | diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index c5b10ddda9..522aaa9bc3 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -185,6 +185,7 @@ their individual contributions.
* `Adam Johnson <https://github.com/adamchainz>`_
* `Adam Sven Johnson <https://www.github.com/pkqk>`_
+* `Akash Suresh <https://www.... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
HypothesisWorks__hypothesis-2189@8a7701b | HypothesisWorks/hypothesis | Python | 2,189 | Do not catch and record KeyboardInterrupt | When a KeyboardInterrupt occurs, `hypothesis` should not treat it as a normal exception raised by a test or by a strategy - in particular it should not retry running anything, it should exit more or less directly. Instead, #2186 shows that `hypothesis` retries the generation and finds it doesn't raise KeboardInterrupt ... | 2019-11-07T23:25:04Z | hypothesis reports Flaky on KeyboardInterrupt
It should simply exit gracefully; especially in fuzzing modes it's often just worth running it until the user wants to do something else, so bizarre messages aren't a good response to KeyboardInterrupt. Ideally the traceback before the KeyboardInterrupt would let the user f... | There are [only a few places where we `except BaseException`](https://github.com/HypothesisWorks/hypothesis/search?q=%22except+BaseException%22&unscoped_q=%22except+BaseException%22), and we should probably only be catching `Exception` from those in `core.py` and `control.py`.
In particular the "Flaky" message is be... | [
{
"body": "It should simply exit gracefully; especially in fuzzing modes it's often just worth running it until the user wants to do something else, so bizarre messages aren't a good response to KeyboardInterrupt. Ideally the traceback before the KeyboardInterrupt would let the user figure out whether something... | 99c07f377335023723276ab64586533607a202c4 | {
"head_commit": "8a7701b070974b0d4d03ce5ee4e2d0f9454d82e8",
"head_commit_message": "Add and annotate no-branch pragma",
"patch_to_review": "diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst\nnew file mode 100644\nindex 0000000000..9c4c21103d\n--- /dev/null\n+++ b/hypothesis-python/RELEAS... | [
{
"diff_hunk": "@@ -0,0 +1,77 @@\n+# coding=utf-8\n+#\n+# This file is part of Hypothesis, which may be found at\n+# https://github.com/HypothesisWorks/hypothesis/\n+#\n+# Most of this work is copyright (C) 2013-2019 David R. MacIver\n+# (david@drmaciver.com), but it contains contributions by others. See\n+# CO... | 36b2bcbfe2e3da9f69ec2afed1aa1b5049e74962 | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..9c4c21103d
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,6 @@
+RELEASE_TYPE: patch
+
+This patch ensures that a KeyboardInterrupt received during example generation
+is not treated as a myste... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
HypothesisWorks__hypothesis-1962@d974208 | HypothesisWorks/hypothesis | Python | 1,962 | Add feature for multiple unique_by functions | Fixes #1916, each callable passed in the `unique_by` tuple has it's own respective `seen` set | 2019-05-06T19:54:39Z | Allow st.lists() to accept a tuple of functions for unique_by
Let's say I want to generate a list of users, but I want each user to be unique by `id` and `email` independently, not unique by the pair of properties.
For example, the strategy should not generate ```[{'id': 1, 'email': 'john@aol.com'}, {'id': 1, 'email... | Sounds like a useful feature request to me! Tagged as enhancement because it's upgrading an existing strategy rather than adding a new one.
You could currently approximate this by generating two unique lists, or by filtering, but that will be inefficient to shrink or to generate respectively. (check out the `@compos... | [
{
"body": "Let's say I want to generate a list of users, but I want each user to be unique by `id` and `email` independently, not unique by the pair of properties.\r\n\r\nFor example, the strategy should not generate ```[{'id': 1, 'email': 'john@aol.com'}, {'id': 1, 'email': 'jane@aol.com'}]```, because they bo... | 730a9d122a6725c16039c4b1882e2736e5998516 | {
"head_commit": "d97420829cc3b33bb7479098b0df418351ecd3ee",
"head_commit_message": "Add failing tests for feature checking",
"patch_to_review": "diff --git a/hypothesis-python/tests/cover/test_simple_collections.py b/hypothesis-python/tests/cover/test_simple_collections.py\nindex 5fc8518223..7bc8f2192c 100644\n-... | [
{
"diff_hunk": "@@ -731,10 +731,20 @@ def lists(\n object equality, as if unique_by was ``lambda x: x``. This comparison only\n works for hashable types.\n \n- if unique_by is not None it must be a function returning a hashable type\n- when given a value drawn from elements. The resulting list wil... | 7578a75425368af2ed9be223e9de0f5aecdf47e5 | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..d9cea89f19
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,7 @@
+RELEASE_TYPE: minor
+
+The ``unique_by`` argument to :obj:`~hypothesis.strategies.lists` now accepts a
+tuple of callables such ... | {
"difficulty": "medium",
"estimated_review_effort": 2,
"problem_domain": "New Feature Additions"
} |
HypothesisWorks__hypothesis-2112@b9a875a | HypothesisWorks/hypothesis | Python | 2,112 | Fix #2106. Defer directory creation to DirectoryBasedExampleDatabase | This PR aims to delay creation of the `.hypothesis/examples` directory until it is actually needed. This is done by shifting responsibility for creation from `configuration.py` to `DirectoryBasedExampleDatabase.save`.
Be sure to let me know if anything else is needed from my side :)
And please point me to another i... | 2019-10-03T15:21:20Z | .hypothesis directory always created (pytest plugin)
Hi,
I've just started using hypothesis. Many thanks for a great package. One small issue (which I couldn't find reported elsewhere but maybe my lack of google-fu...) is that, now I have it installed, any time I run pytest (whether or not the particular package I'm... | It would be good if we deferred creation of that directory to the first write!
I'd be happy to have a go at this in the spirit of hacktoberfest (so somewhere next week).
As I see it this would require only a few small changes:
1) No longer make the directory as part of configuration (in `configuration.py`). Instead... | [
{
"body": "Hi,\r\n\r\nI've just started using hypothesis. Many thanks for a great package. One small issue (which I couldn't find reported elsewhere but maybe my lack of google-fu...) is that, now I have it installed, any time I run pytest (whether or not the particular package I'm testing uses hypothesis) a .h... | 2dd4a87cc3ac6850832709da3afb5d340cc8c8ec | {
"head_commit": "b9a875a7744738b6cfb92de4a38ac1b1bfc204cb",
"head_commit_message": "Address comments, resolve failing CI\n\nCurrently hypothesis will make the .hypothesis directory if there are failing tests, or something calls charmap (such as st.text). Otherwise, the directory is not made.",
"patch_to_review":... | [
{
"diff_hunk": "@@ -22,12 +22,30 @@\n import warnings\n from hashlib import sha1\n \n-from hypothesis.configuration import storage_directory\n+from hypothesis.configuration import hypothesis_home_dir\n from hypothesis.errors import HypothesisException, HypothesisWarning\n from hypothesis.internal.compat import ... | f578989b9c9be7ebe58cee7f636d5a7167c37f59 | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..13dd324be9
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,7 @@
+RELEASE_TYPE: patch
+
+This patch defers creation of the ``.hypothesis`` directory until we have
+something to store in it, mean... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
HypothesisWorks__hypothesis-1701@3c98301 | HypothesisWorks/hypothesis | Python | 1,701 | Don't error on a Lambda in a line with Unicode identifiers | Closes #1700.
@lucaswiman’s guess is correct:
> This seems to be an off-by-two error with this example (source is 'mbda x: abs(x) > 1e-5))'), so I'm guessing it's probably that col_offset is computed on the bytes of the original file (UTF-8 encoded in this case)
The `inspect` module gives you source code as Un... | 2018-12-17T22:37:11Z | Error with lambda in a line containing unicode identifiers
`.filter(lambda ...)` fails when used on a line with unicode identifiers prior to the lambda declaration. For example:
```python
from hypothesis import given
import hypothesis.strategies as st
π = 3.1415
@given(st.floats(min_value=-π, max_value=π).filter... | [
{
"body": "`.filter(lambda ...)` fails when used on a line with unicode identifiers prior to the lambda declaration. For example:\r\n```python\r\nfrom hypothesis import given\r\nimport hypothesis.strategies as st\r\nπ = 3.1415\r\n\r\n@given(st.floats(min_value=-π, max_value=π).filter(lambda x: abs(x) > 1e-5))\r... | e9c5134ca3b6a638c30a4bf1eeb2b5e996357e3f | {
"head_commit": "3c98301f80769452cd9856323e5e9cebc8212cd7",
"head_commit_message": "Add a newline to placate black",
"patch_to_review": "diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst\nnew file mode 100644\nindex 0000000000..45ddff1147\n--- /dev/null\n+++ b/hypothesis-python/RELEASE.r... | [
{
"diff_hunk": "@@ -347,9 +348,54 @@ def extract_lambda_source(f):\n return if_confused\n lambda_ast = aligned_lambdas[0]\n assert lambda_ast.lineno == 1\n- source = source[lambda_ast.col_offset :].strip()\n \n+ # If the source code contains Unicode characters, the bytes of the original\n+... | 71c3a7b8d4c03d9fcfbb4d817832a073bb4b7424 | diff --git a/hypothesis-python/RELEASE.rst b/hypothesis-python/RELEASE.rst
new file mode 100644
index 0000000000..45ddff1147
--- /dev/null
+++ b/hypothesis-python/RELEASE.rst
@@ -0,0 +1,4 @@
+RELEASE_TYPE: patch
+
+This patch fixes :issue:`1700`, where a line that contained a Unicode character
+before a lambda definiti... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} | |
HypothesisWorks__hypothesis-1035@7e50bd5 | HypothesisWorks/hypothesis | Python | 1,035 | Clean up tests/cover/test_numerics.py | This:
* Replaces use of `@fails` to assert the ability to find certain examples with the more modern `find_any`
* Replaces all use of math functions (which convert to floats) with the corresponding decimal methods
As a result fixes #1033 | 2017-12-18T11:25:13Z | test_decimals_include_nan is flaky
```
---------------------------------- Hypothesis ----------------------------------
You can add @seed(327206777863050896557169937789875330632) to this test or run pytest with --hypothesis-seed=327206777863050896557169937789875330632 to reproduce this failure.
_____________________... | I think this is a genuine bug in the test. `math.isnan(x)` is not the correct way to check if a decimal is NaN, that would be `x.is_nan()`.
I'm curious as to why your build is so much better at finding flaky test bugs than ours is though given that it's running the same tests! | [
{
"body": "```\r\n---------------------------------- Hypothesis ----------------------------------\r\nYou can add @seed(327206777863050896557169937789875330632) to this test or run pytest with --hypothesis-seed=327206777863050896557169937789875330632 to reproduce this failure.\r\n__________________________ test... | d98af95b322d2f7a60d03a87508f0e47420e71ac | {
"head_commit": "7e50bd50734f57f5cc149f2d8f3e3986af72c402",
"head_commit_message": "Remove remaining use of math on decimal",
"patch_to_review": "diff --git a/tests/cover/test_numerics.py b/tests/cover/test_numerics.py\nindex 05dc8ab508..afd95df6e3 100644\n--- a/tests/cover/test_numerics.py\n+++ b/tests/cover/te... | [
{
"diff_hunk": "@@ -72,40 +71,37 @@ def test_fuzz_decimals_bounds(data):\n assert val.as_tuple().exponent == -places\n \n \n-@fails\n-@given(decimals())\n-def test_all_decimals_can_be_exact_floats(x):\n- assume(x.is_finite())\n- assert decimal.Decimal(float(x)) == x\n+def test_all_decimals_can_be_... | 07857b8e4bdc987e1978d346df0508002d7d73f0 | diff --git a/tests/cover/test_numerics.py b/tests/cover/test_numerics.py
index 05dc8ab508..a12aab9d95 100644
--- a/tests/cover/test_numerics.py
+++ b/tests/cover/test_numerics.py
@@ -17,14 +17,13 @@
from __future__ import division, print_function, absolute_import
-import math
import decimal
import pytest
fr... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Test Suite / CI Enhancements"
} |
HypothesisWorks__hypothesis-1117@327216c | HypothesisWorks/hypothesis | Python | 1,117 | Minimum viable Django validator introspection | *Just* enough work towards #1116 that it closes #1112.
CC @DRMacIver, @MrGreenTea | 2018-02-15T14:11:26Z | FailedHealthCheck with hypothesis.extra.django for django.contrib.auth.models.User model
I just use create the most simple strategy like this:
`USER_STRATEGY = models.models(User)`
Then I get a FailedHealthCheck:
`hypothesis.errors.FailedHealthCheck: It looks like your strategy is filtering out a lot of data. Heal... | I would guess you have some complex validation on one or more fields, and the default strategy is giving you data of the right type (eg `DateField`) that fails validation (eg 'only the first of the month').
You can override the strategy for each field of a model, with the example of customer age [here](https://hypot... | [
{
"body": "I just use create the most simple strategy like this:\r\n`USER_STRATEGY = models.models(User)`\r\n\r\nThen I get a FailedHealthCheck:\r\n`hypothesis.errors.FailedHealthCheck: It looks like your strategy is filtering out a lot of data. Health check found 50 filtered examples but only 3 good ones. This... | 63bb247e5b874202d26fd694704692218d159eea | {
"head_commit": "327216c012a2ac3ed67189b6cbb11becd3ed2c95",
"head_commit_message": "Add regression test for default User model\n\nCurrently fails because we use a generic text strategy instead of\ngenerating from the regex.",
"patch_to_review": "diff --git a/tests/django/toystore/test_given_models.py b/tests/dja... | [
{
"diff_hunk": "@@ -141,12 +154,38 @@ def _get_strategy_for_field(f):\n return strategy\n \n \n-def models(model, **extra):\n- \"\"\"Return a strategy for instances of a model.\"\"\"\n- result = {k: v for k, v in extra.items() if v is not default_value}\n+def models(model, **field_strategies):\n+ \... | e51dcea04e8436d9806387cc183b031f2629e9c7 | diff --git a/RELEASE.rst b/RELEASE.rst
new file mode 100644
index 0000000000..25d7c62a38
--- /dev/null
+++ b/RELEASE.rst
@@ -0,0 +1,13 @@
+RELEASE_TYPE: patch
+
+This patch improves strategy inference in :mod:`hypothesis.extra.django`
+to account for some validators in addition to field type - see
+:issue:`1116` for on... | {
"difficulty": "medium",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
HypothesisWorks__hypothesis-537@47465c1 | HypothesisWorks/hypothesis | Python | 537 | A new and terrifying age of continuous deployment is upon us | This pull request closes #408.
I am operating on the thesis that if something is worth doing then it's worth dialling up to 11, releasing the hounds, and then nuking it from orbit (after ensuring the hounds are safely out of the blast radius. Hypothesis does not condone cruelty to animals): All merges to master that... | 2017-04-20T11:54:31Z | Better release automation
The current release process is a bit mickey mouse and involves me manually running pip commands. This is less than ideal.
It should be possible to set up Travis to build packages and upload them to pypi for us whenever there is a tag that matches the version number that passes its build.
... | I am generally 👍 for automation.
I am also in favour of cutting a 3.7.0 release soon, because we have a bunch of cool stuff on master – in particular, all your improvements to the shrinker – that nobody else is getting to use. Why should we keep all the good stuff to ourselves?
Assuming you agree, let’s use this... | [
{
"body": "The current release process is a bit mickey mouse and involves me manually running pip commands. This is less than ideal.\r\n\r\nIt should be possible to set up Travis to build packages and upload them to pypi for us whenever there is a tag that matches the version number that passes its build.\r\n\r... | 66216b99b5d837d8f1262c507e6b2b41b24d4fe2 | {
"head_commit": "47465c1aaf7d51696cef86cd0b35d77175f89361",
"head_commit_message": "Temporary revert so we can see the build jobs fail\n\nRevert \"Update version and changelog\"\n\nThis reverts commit 98a3bae53d34030c89a9b131597ea9c27e80b5aa.",
"patch_to_review": "diff --git a/.travis.yml b/.travis.yml\nindex 83... | [
{
"diff_hunk": "@@ -0,0 +1,27 @@\n+#!/usr/bin/env python\n+\n+import os\n+import sys\n+\n+sys.path.append(os.path.dirname(__file__)) # noqa\n+\n+import hypothesistooling as tools\n+from datetime import datetime\n+\n+\n+if __name__ == '__main__':\n+ changelog = tools.changelog()\n+\n+ if \"\\n%s - \" % (to... | 7cf6d31d0e1dcfe12f63bdd415f869570c9cb5bc | diff --git a/.travis.yml b/.travis.yml
index 8303e9d54e..5706dc0208 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,6 +7,9 @@ env: PYTHONDONTWRITEBYTECODE=x
os:
- linux
+before_install:
+ - openssl aes-256-cbc -K $encrypted_39cb4cc39a80_key -iv $encrypted_39cb4cc39a80_iv -in deploy_key.enc -out deploy_key -d
... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Test Suite / CI Enhancements"
} |
Lightning-AI__pytorch-lightning-20913@e77cedf | Lightning-AI/pytorch-lightning | Python | 20,913 | Fabric: Enable "auto" for `devices` and `accelerator` as cli arguments | ## What does this PR do?
Fixes #20451
This PR adds support for the `auto` variable for `accelerator` and `devices` in the Fabric CLI.
- When `auto` is passed to `--accelerator` we now detect whether the machine has either `mps`, `cuda`, or `cpu` and dynamically runs on the available device, this is the sam... | 2025-06-17T09:52:42Z | Error: Invalid value for '--accelerator': 'auto' is not one of 'cpu', 'gpu', 'cuda', 'mps', 'tpu'.
### Bug description
when run this codes
```
fabric run ./path/to/train.py \
--devices=auto \
--accelerator=auto
```
get problem below
```
Error: Invalid value for '--accelerator': 'auto' is not one of 'cp... | hey @wkd88 that's correct, would you want to give it a shot in a quick PR?
here's the file that needs to be updated: https://github.com/Lightning-AI/pytorch-lightning/blob/master/src/lightning/fabric/cli.py
> hey @wkd88 that's correct, would you want to give it a shot in a quick PR?
>
> here's the file that needs... | [
{
"body": "### Bug description\n\nwhen run this codes\r\n```\r\nfabric run ./path/to/train.py \\\r\n --devices=auto \\\r\n --accelerator=auto\r\n```\r\nget problem below\r\n```\r\nError: Invalid value for '--accelerator': 'auto' is not one of 'cpu', 'gpu', 'cuda', 'mps', 'tpu'.\r\n```\n\n### What version ... | 313830527b9a9f42c3dea3c24f09a0433d5ef606 | {
"head_commit": "e77cedf7280c3b0d4c86f6cce8668c971fad48ec",
"head_commit_message": "use a provate method to avoid dependency errors",
"patch_to_review": "diff --git a/src/lightning/fabric/cli.py b/src/lightning/fabric/cli.py\nindex 2268614abb97b..0e419c8c03bcd 100644\n--- a/src/lightning/fabric/cli.py\n+++ b/src... | [
{
"diff_hunk": "@@ -34,7 +34,18 @@\n _CLICK_AVAILABLE = RequirementCache(\"click\")\n _LIGHTNING_SDK_AVAILABLE = RequirementCache(\"lightning_sdk\")\n \n-_SUPPORTED_ACCELERATORS = (\"cpu\", \"gpu\", \"cuda\", \"mps\", \"tpu\")\n+_SUPPORTED_ACCELERATORS = (\"cpu\", \"gpu\", \"cuda\", \"mps\", \"tpu\", \"auto\")\... | 4f882007786237f831711aca65191c3a3150571b | diff --git a/src/lightning/fabric/cli.py b/src/lightning/fabric/cli.py
index 2268614abb97b..594bb46f4b362 100644
--- a/src/lightning/fabric/cli.py
+++ b/src/lightning/fabric/cli.py
@@ -25,7 +25,7 @@
from lightning.fabric.plugins.precision.precision import _PRECISION_INPUT_STR, _PRECISION_INPUT_STR_ALIAS
from lightnin... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-20780@d844bf6 | Lightning-AI/pytorch-lightning | Python | 20,780 | Allow cross-device local checkpoints with `fsspec>=2025.5.0` | ## What does this PR do?
Cross-device transactions via fsspec (used for example in ModelCheckpoint) resulted in permission errors (#20270). The permission errors were caused by attempts to change file modes on different filesystem. This was fixed in fsspec 2025.5.0. This PR proposes to increase the minimum version t... | 2025-05-01T18:04:19Z | _atomic_save with transaction cause "Invalid cross-device link" error
### Bug description
I Upgraded my pl verison from 2.0.4 to 2.4. The same training code will have the error below
```
2024-09-06 23:01:53 [on_validation_epoch_end] collecting matched instance from 64 ranks
2024-09-06 23:02:17 [on_validation_epoc... | Same thing happening to me on 2.4.0 version, but it works fine on 2.3.1
> Same thing happening to me on 2.4.0 version, but it works fine on 2.3.1
Yes, same situation..
Same thing happening for me on version 2.4, but only occasionally, curious why we see this only sometimes?
Same thing happening for me on version 2.5... | [
{
"body": "### Bug description\r\n\r\nI Upgraded my pl verison from 2.0.4 to 2.4. The same training code will have the error below\r\n```\r\n2024-09-06 23:01:53 [on_validation_epoch_end] collecting matched instance from 64 ranks\r\n2024-09-06 23:02:17 [on_validation_epoch_end] end\r\nTraceback (most recent call... | e15cd6733a767cd8cb879aa29808e9fa83eaffcc | {
"head_commit": "d844bf677f08404d2539243e18b1a3fc919c5d5e",
"head_commit_message": "Merge branch 'bugfix/20270_invalid-cross-device-link' of https://github.com/siemdejong/pytorch-lightning into bugfix/20270_invalid-cross-device-link",
"patch_to_review": "diff --git a/requirements/fabric/base.txt b/requirements/f... | [
{
"diff_hunk": "@@ -118,6 +119,13 @@ def test_ckpt_for_fsspec():\n trainer.save_checkpoint(\"memory://test_ckpt_for_fsspec/hpc_ckpt_3.ckpt\")\n trainer.save_checkpoint(\"memory://test_ckpt_for_fsspec/hpc_ckpt_33.ckpt\")\n \n+ # Simulate the behavior of fsspec when writing to a local file system but o... | b46dbf1cbe36c5b24f663daf2d21e98d4d8978e6 | diff --git a/src/lightning/fabric/utilities/cloud_io.py b/src/lightning/fabric/utilities/cloud_io.py
index 9d0a33afd0b77..637dfcd9b1671 100644
--- a/src/lightning/fabric/utilities/cloud_io.py
+++ b/src/lightning/fabric/utilities/cloud_io.py
@@ -13,6 +13,7 @@
# limitations under the License.
"""Utilities related to da... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-20669@3b786c7 | Lightning-AI/pytorch-lightning | Python | 20,669 | fix: MLFlowLogger artifact_path | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2025-03-24T12:58:29Z | MLFlowLogger fails to log artifact on Windows
### Bug description
Error when training with "MLFlowLogger" and with `log_models="all"`, running on Windows:
```
mlflow.exceptions.MlflowException: Invalid artifact path: 'epoch=0-step=43654'. Names may be treated as files in certain cases, and must not resolve to other n... | [
{
"body": "### Bug description\n\nError when training with \"MLFlowLogger\" and with `log_models=\"all\"`, running on Windows:\n\n```\nmlflow.exceptions.MlflowException: Invalid artifact path: 'epoch=0-step=43654'. Names may be treated as files in certain cases, and must not resolve to other names when treated ... | 669486afdd524fb66c1afc36bf93955384ac1224 | {
"head_commit": "3b786c745f1f3cb61f4e18395de6a87deee18ae9",
"head_commit_message": "fix: MLFlowLogger artifact_path",
"patch_to_review": "diff --git a/src/lightning/pytorch/loggers/mlflow.py b/src/lightning/pytorch/loggers/mlflow.py\nindex 02396d8021633..4a89ec181d742 100644\n--- a/src/lightning/pytorch/loggers/... | [
{
"diff_hunk": "@@ -363,7 +363,7 @@ def _scan_and_log_checkpoints(self, checkpoint_callback: ModelCheckpoint) -> Non\n aliases = [\"latest\", \"best\"] if p == checkpoint_callback.best_model_path else [\"latest\"]\n \n # Artifact path on mlflow\n- artifact_path = Path(self._ch... | 429f732a0528c558e701da7ec01e51c1e2e4f32e | diff --git a/src/lightning/pytorch/loggers/mlflow.py b/src/lightning/pytorch/loggers/mlflow.py
index 02396d8021633..2c12c942f701e 100644
--- a/src/lightning/pytorch/loggers/mlflow.py
+++ b/src/lightning/pytorch/loggers/mlflow.py
@@ -363,7 +363,7 @@ def _scan_and_log_checkpoints(self, checkpoint_callback: ModelCheckpoin... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} | |
Lightning-AI__pytorch-lightning-20961@e8e8aef | Lightning-AI/pytorch-lightning | Python | 20,961 | Add dev env setup guide | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2025-07-03T18:25:00Z | Recommend dev setup / support uv
### 📚 Documentation
I read the CONTRIBUTING docs but I did not a see a recommended path to (a) get lightning with the right deps etc venv for devel or the recommended way to run the linter.
there is a pyproject.toml but it does not work with uv.
My ideal solution would be that e.g.
... | hello, you maybe looking for https://github.com/Lightning-AI/pytorch-lightning/blob/e91541894b83373e7e3c4963d16137c2af7bd0d1/Makefile#L31 so to run `make test`
and you are right we shall improve instruction in the Contributing guide
@jjh42 You can use the Lightning Studio for [development](https://www.youtube.com/watc... | [
{
"body": "### 📚 Documentation\n\nI read the CONTRIBUTING docs but I did not a see a recommended path to (a) get lightning with the right deps etc venv for devel or the recommended way to run the linter.\n\nthere is a pyproject.toml but it does not work with uv.\n\nMy ideal solution would be that e.g.\n`uv run... | e29a8cbb83b9041ff7b7d10f24d9274f39d2358d | {
"head_commit": "e8e8aef01dc9de18e189816654c1bd04ea002b83",
"head_commit_message": "fix venv path",
"patch_to_review": "diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md\nindex cfb03d220c99c..b09b3f646061a 100644\n--- a/.github/CONTRIBUTING.md\n+++ b/.github/CONTRIBUTING.md\n@@ -109,6 +109,42 @@ ___... | [
{
"diff_hunk": "@@ -9,8 +9,8 @@ To setup a local development environment, install both local and test dependenci\n \n ```bash\n # clone the repo\n-git clone https://github.com/Lightning-AI/lightning.git\n-cd lightning\n+git clone https://github.com/Lightning-AI/pytorch-lightning.git\n+cd pytorch-lightning",
... | e6d6acdc1ef583fb8ea01f771336c048a82fc4ac | diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index cfb03d220c99c..dcfc590a0fe23 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -109,6 +109,36 @@ ______________________________________________________________________
## Guidelines
+### Development environment
+
+To set up a ... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "Documentation Updates"
} |
Lightning-AI__pytorch-lightning-20474@5ebcaac | Lightning-AI/pytorch-lightning | Python | 20,474 | Add timeout to DeepSpeedStrategy | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2024-12-07T17:15:13Z | Allowing setting timeout in DeepSpeedStrategy
### Outline & Motivation
In DDPStrategy / FSDPStrategy, the `timeout=datetime.timedelta(seconds=1800)` flag is exposed and thus allowing user to tune. However, in DeepSpeedStrategy, which is a subclass of DDPStrategy, this flag is not exposed, which makes it hard to change... | Hey @jedyang97 definitely, do you want to send in a quick PR? | [
{
"body": "### Outline & Motivation\n\nIn DDPStrategy / FSDPStrategy, the `timeout=datetime.timedelta(seconds=1800)` flag is exposed and thus allowing user to tune. However, in DeepSpeedStrategy, which is a subclass of DDPStrategy, this flag is not exposed, which makes it hard to change the timeout behavior.\r\... | de7c28ae865b5c9fd3ff21debebb994605f7f420 | {
"head_commit": "5ebcaac03791904836ed4fa206b61651524947bb",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/src/lightning/fabric/strategies/deepspeed.py b/src/lightning/fabric/strategies/deepspeed.p... | [
{
"diff_hunk": "@@ -97,6 +97,7 @@ def __init__(\n load_full_weights: bool = False,\n precision: Optional[Precision] = None,\n process_group_backend: Optional[str] = None,\n+ **kwargs: Any,",
"line": null,
"original_line": 100,
"original_start_line": null,
"path": "... | dbc472665d3b8f7bc1a1a567428d892870f388f8 | diff --git a/examples/fabric/tensor_parallel/train.py b/examples/fabric/tensor_parallel/train.py
index 1435e5c2003e1..4a98f12cf6168 100644
--- a/examples/fabric/tensor_parallel/train.py
+++ b/examples/fabric/tensor_parallel/train.py
@@ -1,14 +1,13 @@
import lightning as L
import torch
import torch.nn.functional as F... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-20172@cd5f8b6 | Lightning-AI/pytorch-lightning | Python | 20,172 | Re-enable passing BytesIO as path in `.to_onnx()` | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2024-08-06T14:23:43Z | Inconsistent input io type between `to_onnx` and `torch.onnx.export`.
### Bug description
Currently the filetype supported in `torch.onnx.export` includes `io.BytesIO`, whereas in `lightning`, it only supports `str` and `PathLike` object. Before lightning `2.3.3` , passing a `BytesIO` wouldn't be a problem since `t... | [
{
"body": "### Bug description\r\n\r\nCurrently the filetype supported in `torch.onnx.export` includes `io.BytesIO`, whereas in `lightning`, it only supports `str` and `PathLike` object. Before lightning `2.3.3` , passing a `BytesIO` wouldn't be a problem since `to_onnx` did not do anything with `file_path`, bu... | a3e60ad420e4b1a31ec64c98fdc774b5549f0947 | {
"head_commit": "cd5f8b686ea85a101de46ac445215e86143d7a91",
"head_commit_message": "fix: change path to str if `file_path` is Path instance. (fix #20171)",
"patch_to_review": "diff --git a/src/lightning/pytorch/core/module.py b/src/lightning/pytorch/core/module.py\nindex 647f6e6e41af7..ef006b676e55a 100644\n--- ... | [
{
"diff_hunk": "@@ -1403,7 +1403,9 @@ def forward(self, x):\n input_sample = self._on_before_batch_transfer(input_sample)\n input_sample = self._apply_batch_transfer_handler(input_sample)\n \n- torch.onnx.export(self, input_sample, str(file_path), **kwargs)\n+ if isinstance(file_pa... | e858928d31b6d1ca5c1e4b7deff3050fc5c4ccee | diff --git a/src/lightning/pytorch/core/module.py b/src/lightning/pytorch/core/module.py
index 647f6e6e41af7..782fc40d928ef 100644
--- a/src/lightning/pytorch/core/module.py
+++ b/src/lightning/pytorch/core/module.py
@@ -17,6 +17,7 @@
import numbers
import weakref
from contextlib import contextmanager
+from io impor... | {
"difficulty": "medium",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} | |
Lightning-AI__pytorch-lightning-19942@eff729f | Lightning-AI/pytorch-lightning | Python | 19,942 | Replace usage of `grep -P` with `perl` in `run_standalone_tests.sh` | ## What does this PR do?
Fixes #19938, a "bug" where on macOS, which does not use GNU `grep` by default and does not recognize the `-P` flag, `run_standalone_tests.sh` errors out (earlier than expected).
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation ... | 2024-06-04T15:20:59Z | `grep: Invalid option -- P` when running `./tests/run_standalone_tests.sh` on macOS
### Bug description
BSD `grep` no longer supports the `-- P` option on macOS.
One fix would be to use GNU `grep` instead, as `ggrep`.
### What version are you seeing the problem on?
master
### How to reproduce the bug
_No respon... | Hey @Peiffap
You are welcome to send a PR for this if you'd like.
We don't have any tests in `run_standalone_tests.sh` that would run on macos, but for completeness, this fix would be good IMO. | [
{
"body": "### Bug description\n\nBSD `grep` no longer supports the `-- P` option on macOS.\r\n\r\nOne fix would be to use GNU `grep` instead, as `ggrep`.\n\n### What version are you seeing the problem on?\n\nmaster\n\n### How to reproduce the bug\n\n_No response_\n\n### Error messages and logs\n\n```\r\n# Erro... | fd86ea7356f842a32cd7eeca160f390e60ebca77 | {
"head_commit": "eff729f9354264afa97ae308c0ba4913970fee2d",
"head_commit_message": "Fix CI trigger",
"patch_to_review": "diff --git a/.azure/gpu-tests-pytorch.yml b/.azure/gpu-tests-pytorch.yml\nindex 156513d604210..dd1a3d4abcf6a 100644\n--- a/.azure/gpu-tests-pytorch.yml\n+++ b/.azure/gpu-tests-pytorch.yml\n@@ ... | [
{
"diff_hunk": "@@ -47,7 +46,7 @@ function show_batched_output {\n if [ -f standalone_test_output.txt ]; then # if exists\n cat standalone_test_output.txt\n # heuristic: stop if there's mentions of errors. this can prevent false negatives when only some of the ranks fail\n- if grep -iE 'error|exce... | 394051124f4a27dbaa508765eb24eea624be690c | diff --git a/.azure/gpu-tests-pytorch.yml b/.azure/gpu-tests-pytorch.yml
index 156513d604210..dd1a3d4abcf6a 100644
--- a/.azure/gpu-tests-pytorch.yml
+++ b/.azure/gpu-tests-pytorch.yml
@@ -31,6 +31,7 @@ pr:
- "src/lightning/pytorch/**"
- "src/pytorch_lightning/*"
- "tests/tests_pytorch/**"
+ -... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-19513@0b7345f | Lightning-AI/pytorch-lightning | Python | 19,513 | Adds more robust timer duration parsing | ## What does this PR do?
Failure to provide the timer duration string (e.g., via `--max_time`) in the appropriate format currently results in an uninformative IndexError. This uses a simple regex (and the built-in `re`) for more robust input validation and instead throws a misconfiguration exception.
I experiment... | 2024-02-22T15:54:41Z | Input validation for Trainer's `min_time` and `max_time` when passed as string
### Description & Motivation
The argument to the `Trainer`s min_time is expected to be a string of the form /(\d\d):(\d\d):(\d\d):(\d\d)/. One way in which parsing can fail (simple example: `--min_time 60`) throws an `IndexError` and prov... | @kylebgorman Would you like to contribute this suggestion?
> @kylebgorman Would you like to contribute this suggestion?
Sure, it seems like a small issue. (I need to clear OSS patches with my employer, but I'll do that now.) | [
{
"body": "### Description & Motivation\r\n\r\nThe argument to the `Trainer`s min_time is expected to be a string of the form /(\\d\\d):(\\d\\d):(\\d\\d):(\\d\\d)/. One way in which parsing can fail (simple example: `--min_time 60`) throws an `IndexError` and provides little context for what is wrong.\r\n\r\n##... | 0f4522cbde5b65c9f2622973d8e93f1cfab6404c | {
"head_commit": "0b7345f2048a00d900ee2a2436efd214b2fbe35e",
"head_commit_message": "precommit hooks",
"patch_to_review": "diff --git a/src/lightning/pytorch/callbacks/timer.py b/src/lightning/pytorch/callbacks/timer.py\nindex 7aa84c0ab5d8c..21f503b3ae748 100644\n--- a/src/lightning/pytorch/callbacks/timer.py\n++... | [
{
"diff_hunk": "@@ -86,9 +89,17 @@ def __init__(\n ) -> None:\n super().__init__()\n if isinstance(duration, str):\n- dhms = duration.strip().split(\":\")\n- dhms = [int(i) for i in dhms]\n- duration = timedelta(days=dhms[0], hours=dhms[1], minutes=dhms[2], s... | f478d733a3b5ac84847adb5f7060a980a2c2e77e | diff --git a/src/lightning/pytorch/CHANGELOG.md b/src/lightning/pytorch/CHANGELOG.md
index b8873f6978a9d..f971b3df00332 100644
--- a/src/lightning/pytorch/CHANGELOG.md
+++ b/src/lightning/pytorch/CHANGELOG.md
@@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `l... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-18951@17bd883 | Lightning-AI/pytorch-lightning | Python | 18,951 | Remember the eval mode of submodules when switching trainer stages | ## What does this PR do?
Fixes #18930
Part of #16827
A common issue users are facing is that the loop calls `train()` on the LightningModule despite the user having frozen certain layers. For example,
- user finetunes a model and freezes certain layers they don't want to train
- user's model has a feature extr... | 2023-11-05T16:58:20Z | Identify parts of the models that are set in '.eval()' mode during initialization and keep them in eval mode after validation epoch ends
### Description & Motivation
Currently, if I want a submodule of my model completely **frozen** during training, I cannot do so because even with
1. Setting this submodule in `... | [
{
"body": "### Description & Motivation\r\n\r\nCurrently, if I want a submodule of my model completely **frozen** during training, I cannot do so because even with \r\n\r\n1. Setting this submodule in `.eval()` mode in `__init__()`\r\n2. Setting all `required_grad` of all parameters in this submodule to `False`... | b80107e7ba5962c590dcea221495a4710286e88d | {
"head_commit": "17bd883e850b53fbf71f56bb7263fcd9445c5362",
"head_commit_message": "docstring",
"patch_to_review": "diff --git a/docs/source-pytorch/advanced/transfer_learning.rst b/docs/source-pytorch/advanced/transfer_learning.rst\nindex 102555b94a455..935bcd4bb8773 100644\n--- a/docs/source-pytorch/advanced/t... | [
{
"diff_hunk": "@@ -293,13 +294,21 @@ def _on_evaluation_model_eval(self) -> None:\n \"\"\"Sets model to eval mode.\"\"\"\n trainer = self.trainer\n hook_name = \"on_test_model_eval\" if trainer.testing else \"on_validation_model_eval\"\n- call._call_lightning_module_hook(trainer,... | e71ab688ac358b777e029aeb49481e578db8ee24 | diff --git a/docs/source-pytorch/advanced/transfer_learning.rst b/docs/source-pytorch/advanced/transfer_learning.rst
index 102555b94a455..935bcd4bb8773 100644
--- a/docs/source-pytorch/advanced/transfer_learning.rst
+++ b/docs/source-pytorch/advanced/transfer_learning.rst
@@ -66,13 +66,13 @@ Example: Imagenet (Computer... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} | |
LmeSzinc__AzurLaneAutoScript-1238@179b8f6 | LmeSzinc/AzurLaneAutoScript | Python | 1,238 | Improve docker deployment | - Migrate from anaconda3 to mambaforge:
- mambaforge is minimal (138MB image vs 1GB image from anaconda3)
- mamba is faster than conda in resolving dependecies -> faster build time
- Migrate to opencv-python-headless
- `cv2` indeed requires `libgl1` to run but that's only for GUI tools of openCV (which we don... | 2022-06-20T16:17:32Z | Better deployment experience on Linux
### Is your feature request related to a problem?
_No response_
### Describe the solution you'd like
Add a shell file to install Alas in one line of command. It's Alas server that need to be installed, emulator and AL are not included, Linux GUI is not required, Alas can be acce... | [
{
"body": "### Is your feature request related to a problem?\n\n_No response_\n\n### Describe the solution you'd like\n\nAdd a shell file to install Alas in one line of command. It's Alas server that need to be installed, emulator and AL are not included, Linux GUI is not required, Alas can be access via `127.0... | 0c9494ee10abdf2ce2dd49ae3f319ff42860b4f4 | {
"head_commit": "179b8f67b45eff6f3a2e818eeeb82c5fd2e8f89b",
"head_commit_message": "docker-compose for one-line deployment",
"patch_to_review": "diff --git a/dev_tools/Dockerfile b/dev_tools/Dockerfile\nindex 0ad040ce66..6fb82e9387 100644\n--- a/dev_tools/Dockerfile\n+++ b/dev_tools/Dockerfile\n@@ -1,4 +1,4 @@\n... | [
{
"diff_hunk": "@@ -1,7 +1,7 @@\n numpy==1.16.6\n scipy==1.4.1\n pillow\n-opencv-python\n+opencv-python-headless",
"line": null,
"original_line": 4,
"original_start_line": 4,
"path": "requirements-in.txt",
"start_line": null,
"text": "@user1:\nDon't change this. Some people is using `req... | 43e9ac29d86b4296663c996cc33d64132b2ca18e | diff --git a/config/deploy.template-docker-cn.yaml b/config/deploy.template-docker-cn.yaml
new file mode 100644
index 0000000000..08be4097c0
--- /dev/null
+++ b/config/deploy.template-docker-cn.yaml
@@ -0,0 +1,133 @@
+Deploy:
+ Git:
+ # URL of AzurLaneAutoScript repository
+ # [CN user] Use 'https://gitee.com/Lm... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} | |
Lightning-AI__pytorch-lightning-18722@157c2da | Lightning-AI/pytorch-lightning | Python | 18,722 | Handle edge case for `find_usable_cuda_devices(0)` | ## What does this PR do?
Fixes #18720
Handles an edge case for input validation in the `find_usable_cuda_devices` function.
<!-- readthedocs-preview pytorch-lightning start -->
----
:books: Documentation preview :books:: https://pytorch-lightning--18722.org.readthedocs.build/en/18722/
<!-- readthedocs-pre... | 2023-10-05T02:18:38Z | find_usable_cuda_devices always returns GPU 0
### Bug description
The function `find_usable_cuda_device` always returns the first GPU (index `0`), even though if it's being currently utilized and there exists another GPU (index `1`) with 0% utilization.
Reproducible example:
```python
>>>from pytorch_lightning.ac... | Hi @TheAeryan
The docstring says at the very beginning:
> A GPU is considered usable if we can successfully move a tensor to the device, and this is what this function
> tests for each GPU on the system until the target number of usable devices is found.
>
> A subset of GPUs on the system might b... | [
{
"body": "### Bug description\n\nThe function `find_usable_cuda_device` always returns the first GPU (index `0`), even though if it's being currently utilized and there exists another GPU (index `1`) with 0% utilization.\r\n\r\nReproducible example:\r\n```python\r\n>>>from pytorch_lightning.accelerators import... | fdae213dd1e8289b35d4ab52f2052ab563c38074 | {
"head_commit": "157c2daa951e94a3e1efb67ab272d6a82562757e",
"head_commit_message": "chlog",
"patch_to_review": "diff --git a/src/lightning/fabric/CHANGELOG.md b/src/lightning/fabric/CHANGELOG.md\nindex bdd59c40e5380..d47a281668a9b 100644\n--- a/src/lightning/fabric/CHANGELOG.md\n+++ b/src/lightning/fabric/CHANGE... | [
{
"diff_hunk": "@@ -90,6 +90,8 @@ def find_usable_cuda_devices(num_devices: int = -1) -> List[int]:\n both processes determine that the device is unoccupied, leading into one of them crashing later on.\n \n \"\"\"\n+ if num_devices == 0:\n+ raise ValueError(\"`num_devices=0` is not a valid... | af86c51357241ad23ecedc91e959d8bdbc0c91e3 | diff --git a/src/lightning/fabric/CHANGELOG.md b/src/lightning/fabric/CHANGELOG.md
index bdd59c40e5380..d47a281668a9b 100644
--- a/src/lightning/fabric/CHANGELOG.md
+++ b/src/lightning/fabric/CHANGELOG.md
@@ -221,6 +221,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed redund... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-18655@f438ebd | Lightning-AI/pytorch-lightning | Python | 18,655 | Bitsandbytes precision plugin | ## What does this PR do?
Fixes #18295
Closes #18559
Some minor improvements are added to the transformer engine integration. I thought about these as I was working on this plugin, since they work very similarly.
Before:
```python
import torch
import torch.nn as nn
import bitsandbytes as bnb
from bitsandb... | 2023-09-27T17:16:41Z | lightning usage with bitsandbytes
### Description & Motivation
currently lightning allows training with fp16 and bf16/bf16-mixed. can these settings be used for training with bitandbytes' NF4 precision?
### Pitch
if it's not possible to use lightning for NF4 finetuning, it would be nice to extend it to be able to a... | Thanks for the suggestion. @JustinGoheen is looking into this
@carmocca I will open a draft PR on this later today.
@JustinGoheen thanks for working on this! Would be perfect if this is "all supported dtypes by bitsandbytes" in general, not just NF4 as stated in the title. Ie. we'd be interested in 8-bit training, and ... | [
{
"body": "### Description & Motivation\n\ncurrently lightning allows training with fp16 and bf16/bf16-mixed. can these settings be used for training with bitandbytes' NF4 precision? \n\n### Pitch\n\nif it's not possible to use lightning for NF4 finetuning, it would be nice to extend it to be able to allow usin... | 02780f2cb3d259ca0637cef551441241c53b4bf7 | {
"head_commit": "f438ebd9ca51e916e328a2a572e154d216916093",
"head_commit_message": "Copy docstrings",
"patch_to_review": "diff --git a/docs/source-fabric/api/fabric_args.rst b/docs/source-fabric/api/fabric_args.rst\nindex b0c483d4684d4..b870f2dd013bd 100644\n--- a/docs/source-fabric/api/fabric_args.rst\n+++ b/do... | [
{
"diff_hunk": "@@ -0,0 +1,264 @@\n+# Copyright The Lightning AI team.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0... | f12b964f8a75be7e942173845d133061da7caa7d | diff --git a/docs/source-fabric/api/fabric_args.rst b/docs/source-fabric/api/fabric_args.rst
index b0c483d4684d4..b870f2dd013bd 100644
--- a/docs/source-fabric/api/fabric_args.rst
+++ b/docs/source-fabric/api/fabric_args.rst
@@ -131,7 +131,7 @@ Automatic mixed precision settings are denoted by a ``"-mixed"`` suffix, wh... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-19504@9c14afe | Lightning-AI/pytorch-lightning | Python | 19,504 | Flexible and easy to use HSDP setting | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2024-02-20T22:25:47Z | Allow flexible and easy to configure HSDP
### Description & Motivation
The `FSDPStrategy` can use hybrid sharding strategy to shard across smaller sets of ranks in the global dist group. However, it is not flexible enough to let user easily specify the sharding scale.
### Pitch
The `FSDPStrategy` can use hybrid sh... | I agree we need a better way to specify this. PyTorch 2.2 introduced the [device mesh](https://pytorch.org/tutorials/recipes/distributed_device_mesh.html), so we should probably use that to specify the size, rather than having the user construct the process group matrix themselves.
Having an argument like you sugg... | [
{
"body": "### Description & Motivation\n\nThe `FSDPStrategy` can use hybrid sharding strategy to shard across smaller sets of ranks in the global dist group. However, it is not flexible enough to let user easily specify the sharding scale.\r\n\n\n### Pitch\n\nThe `FSDPStrategy` can use hybrid sharding strategy... | 1a6786d682f0635ee87c171feefd967265028b45 | {
"head_commit": "9c14afedf6bee83bc3e1ad33ec5d7e890a707b12",
"head_commit_message": "add simple docs",
"patch_to_review": "diff --git a/src/lightning/fabric/strategies/fsdp.py b/src/lightning/fabric/strategies/fsdp.py\nindex 5679155380bea..fb4f033d61398 100644\n--- a/src/lightning/fabric/strategies/fsdp.py\n+++ b... | [
{
"diff_hunk": "@@ -125,10 +125,14 @@ class FSDPStrategy(ParallelStrategy, _Sharded):\n - ``\"SHARD_GRAD_OP\"``: Shards gradients and optimizer states only. Model parameters get replicated.\n - ``\"NO_SHARD\"``: No sharding (identical to regular DDP).\n - ``\"HYBRID_SHARD\"``... | 949d36fa1a9f4b871dc683e4610100e4de4029bf | diff --git a/src/lightning/fabric/CHANGELOG.md b/src/lightning/fabric/CHANGELOG.md
index ea595b2635138..2ee0243a0d5a5 100644
--- a/src/lightning/fabric/CHANGELOG.md
+++ b/src/lightning/fabric/CHANGELOG.md
@@ -19,6 +19,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added a call... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-18512@5475f39 | Lightning-AI/pytorch-lightning | Python | 18,512 | Make the batch_idx argument optional in all step methods | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2023-09-09T12:04:35Z | Make the batch_idx argument optional in all step methods
### Bug description
The training_step method does not require declaring a batch_idx argument:
```py
def training_step(self, batch, batch_idx):
pass
# or
def training_step(self, batch):
pass
```
But for validation/test/predict steps, the f... | Its neither intentional nor a bug. It was just never added to the other loops. You could consider it a missing feature there. The relevant piece of code is:
https://github.com/Lightning-AI/lightning/blob/a3f6e98e7c8a12e677bb9d10bd4f61ba716e0cad/src/lightning/pytorch/loops/training_epoch_loop.py#L449-L452
which is... | [
{
"body": "### Bug description\r\n\r\nThe training_step method does not require declaring a batch_idx argument:\r\n\r\n```py\r\ndef training_step(self, batch, batch_idx):\r\n pass\r\n\r\n# or\r\ndef training_step(self, batch):\r\n pass\r\n```\r\n\r\nBut for validation/test/predict steps, the following rai... | 4dfc09c2fe5cf4a66b6ec69e4189fe0ac2a92fb8 | {
"head_commit": "5475f397ca7ce3e2b36c212a377c47163040cf6a",
"head_commit_message": "update changelog",
"patch_to_review": "diff --git a/src/lightning/pytorch/CHANGELOG.md b/src/lightning/pytorch/CHANGELOG.md\nindex edc019115446b..0508f84db647e 100644\n--- a/src/lightning/pytorch/CHANGELOG.md\n+++ b/src/lightning... | [
{
"diff_hunk": "@@ -496,3 +496,28 @@ def test_step(self, batch, batch_idx):\n actual = trainer.num_val_batches if fn == \"validate\" else trainer.num_test_batches\n assert actual == [3, 2]\n assert seen == expected\n+\n+\n+def test_evaluation_loop_when_batch_idx_argument_is_not_given(tmpdir):\n+ ... | 2c0cc5a0fc43637ca3cfb1d35f1b76d3affdde68 | diff --git a/src/lightning/pytorch/CHANGELOG.md b/src/lightning/pytorch/CHANGELOG.md
index edc019115446b..9245ff1916af6 100644
--- a/src/lightning/pytorch/CHANGELOG.md
+++ b/src/lightning/pytorch/CHANGELOG.md
@@ -185,6 +185,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Due to l... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-18439@234a1da | Lightning-AI/pytorch-lightning | Python | 18,439 | Add `log_weight_decay` argument to `LearningRateMonitor` callback | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2023-08-30T13:35:27Z | Add `log_weight_decay` option to `LearningRateMonitor` callback
### Description & Motivation
In more sophisticated training settings, we usually apply a dedicated weight decay scheduler (for example DINO). Thus, it will be great to monitor these statistics, optionally, from the `LearningRateMonitor` callback.
### Pit... | Thanks @lobantseff for this suggestion. I don't see what could stand in the way of such an addition. A PR for this would be welcomed if you are interested to contribute the feature :) | [
{
"body": "### Description & Motivation\n\nIn more sophisticated training settings, we usually apply a dedicated weight decay scheduler (for example DINO). Thus, it will be great to monitor these statistics, optionally, from the `LearningRateMonitor` callback.\n\n### Pitch\n\nA solution should look something li... | c807bbb7ec0c11656647880beec1666c1b87f6b4 | {
"head_commit": "234a1da30b65ee1919f8e81ddef772b7a1ebe9cb",
"head_commit_message": "Merge branch 'master' into ioannis@add-log_weight_decay-option-to-LearningRateMonitor-callback",
"patch_to_review": "diff --git a/src/lightning/pytorch/callbacks/lr_monitor.py b/src/lightning/pytorch/callbacks/lr_monitor.py\ninde... | [
{
"diff_hunk": "@@ -202,20 +212,22 @@ def _extract_stats(self, trainer: \"pl.Trainer\", interval: str) -> Dict[str, floa\n \n return latest_stat\n \n- def _get_lr_momentum_stat(self, optimizer: Optimizer, names: List[str]) -> Dict[str, float]:\n- lr_momentum_stat = {}\n+ def _get_optimizer_... | 2eff8d949337f2d40f6f125185a233acdcf0a678 | diff --git a/src/lightning/pytorch/CHANGELOG.md b/src/lightning/pytorch/CHANGELOG.md
index e6017ba853ebb..551ca3a3cef8f 100644
--- a/src/lightning/pytorch/CHANGELOG.md
+++ b/src/lightning/pytorch/CHANGELOG.md
@@ -64,6 +64,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Updated `L... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-18154@c1faa52 | Lightning-AI/pytorch-lightning | Python | 18,154 | Only redirect imports when unpickling Lightning checkpoints | ## What does this PR do?
Fixes #18152
Moves the logic that was originally added in https://github.com/Lightning-AI/lightning/pull/15309
This PR avoids patching `pickle.Unpickler` globally. The patching now only happens when
1. Converting a legacy checkpoint explicitly using the utility script
2. When using th... | 2023-07-24T22:42:07Z | Importing lightning causes large slowdown in dataloading with pickle files
That issue is caused by `legacy_import_unpickler.py` that is setting `pickle.Unpickler = RedirectingUnpickler`.
For datasets that unpickle files, switching from the C unpickler to the Python unpickler creates a slowdown of `~4x`.
Here's mini... | The slowdown can be triggered by importing `lightning`, and it can be removed by overriding the Unpickler as `legacy_import_unpickler.py`, so it's definitely the RedirectingUnpickler that causes the issue:
```
old_unpickler = pickle.Unpickler
import lightning
pickle.Unpickler = old_unpickler
```
I saved rando... | [
{
"body": "That issue is caused by `legacy_import_unpickler.py` that is setting `pickle.Unpickler = RedirectingUnpickler`.\r\nFor datasets that unpickle files, switching from the C unpickler to the Python unpickler creates a slowdown of `~4x`.\r\n\r\nHere's minimal code to reproduce (minus of course the paths):... | df4ad1932b0ad9a5ffe9b335726e4d12f6820f23 | {
"head_commit": "c1faa522916092c9d79777711a5dd601e4210c21",
"head_commit_message": "remove old test",
"patch_to_review": "diff --git a/src/lightning/pytorch/_graveyard/__init__.py b/src/lightning/pytorch/_graveyard/__init__.py\nindex dffa45fdcb440..27f5992b2a309 100644\n--- a/src/lightning/pytorch/_graveyard/__i... | [
{
"diff_hunk": "@@ -13,5 +13,5 @@\n # limitations under the License.\n import lightning.pytorch._graveyard.hpu\n import lightning.pytorch._graveyard.ipu\n-import lightning.pytorch._graveyard.legacy_import_unpickler\n+import lightning.pytorch._graveyard.torchmetrics_",
"line": null,
"original_line": 16,
... | 6f669eedf9e917e309cb8d57a8810610657ed097 | diff --git a/src/lightning/pytorch/_graveyard/__init__.py b/src/lightning/pytorch/_graveyard/__init__.py
index dffa45fdcb440..1baadda1e0e1f 100644
--- a/src/lightning/pytorch/_graveyard/__init__.py
+++ b/src/lightning/pytorch/_graveyard/__init__.py
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eith... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Performance Optimizations"
} |
Lightning-AI__pytorch-lightning-18091@1f4e78a | Lightning-AI/pytorch-lightning | Python | 18,091 | Update deepspeed model-parallel docs | ## What does this PR do?
Updates docs for `configure_sharded_model` in DeepSpeed model-parallel docs. DeepSpeed recently changed how parameters get moved to the device in a breaking change (https://github.com/microsoft/DeepSpeed/pull/3611). From now on, all layers need to be defined in this hook.
Also fixes #1780... | 2023-07-16T19:09:08Z | DeepSpeed doesn't move tensors to GPU in deepspeed 0.9.3 and above
### Bug description
Lightning version (pytorch-lightning 2.0.2)
deepspeed version (0.9.4)
Trained chatglm, but got weight and input on different devices exception. Weight is on cpu, while input is on gpu. It works if deepspeed 0.9.2 is used. I no... | @calvinzhan This was a change introduced in deepspeed (perhaps breaking change since it was done in a minor release) https://github.com/microsoft/DeepSpeed/pull/3611. We had to update our tests too, see here: #17748
As of deepspeed 0.9.3, all model layers/parameters must be created under the `deepspeed.Init()` context... | [
{
"body": "### Bug description\r\n\r\nLightning version (pytorch-lightning 2.0.2)\r\ndeepspeed version (0.9.4)\r\n\r\nTrained chatglm, but got weight and input on different devices exception. Weight is on cpu, while input is on gpu. It works if deepspeed 0.9.2 is used. I noticed a difference in DeepSpeedEngine.... | 080eaf38fa9937b2458c4952e8a80ee69abee090 | {
"head_commit": "1f4e78a99930c008a10032fcf81a6794b92b967b",
"head_commit_message": "update configure_model docs",
"patch_to_review": "diff --git a/docs/source-pytorch/advanced/model_parallel.rst b/docs/source-pytorch/advanced/model_parallel.rst\nindex 2408ca937628a..4707c7eca1846 100644\n--- a/docs/source-pytorc... | [
{
"diff_hunk": "@@ -189,10 +189,11 @@ Here's an example using that uses ``wrap`` to create your model:\n class MyModel(pl.LightningModule):\n def __init__(self):\n super().__init__()",
"line": null,
"original_line": 191,
"original_start_line": 190,
"path": "docs/source-py... | 2005bf7dfe23bd0300390def36104d97cb9222c8 | diff --git a/docs/source-pytorch/advanced/model_parallel.rst b/docs/source-pytorch/advanced/model_parallel.rst
index 2408ca937628a..04f8fc2d2a714 100644
--- a/docs/source-pytorch/advanced/model_parallel.rst
+++ b/docs/source-pytorch/advanced/model_parallel.rst
@@ -187,12 +187,10 @@ Here's an example using that uses ``w... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-18402@49bcc12 | Lightning-AI/pytorch-lightning | Python | 18,402 | Better error message and instructions for handling custom batch samplers | ## What does this PR do?
Fixes #18391
Fixes #17793
Partially addresses #18023
<!-- Does your PR introduce any breaking changes? If yes, please list them. -->
<details>
<summary><b>Before submitting</b></summary>
- Was this **discussed/agreed** via a GitHub issue? (not for typos and docs)
- [ ] Did you... | 2023-08-26T11:05:00Z | Custom batch sampler leads to an error
### Bug description
I am using a custom batch sampler with variable batch sizes. Lightning tries to read `batch_sampler.batch_size` parameter and fails
### What version are you seeing the problem on?
v2.0
### How to reproduce the bug
```python
class BatchSamplerForPaddingHate... | Similar issue in 1.8.4 when I try to use a custom batch sampler in `predict_dataloader()`.
Interesting!
Did you fix this issue @vadim0x60 ?
Can I know what model your training it ? (Application)
I think No one is working on it !.
Can I work on this issue with LSTM model ?
@awaelchli should I open PR for... | [
{
"body": "### Bug description\n\nI am using a custom batch sampler with variable batch sizes. Lightning tries to read `batch_sampler.batch_size` parameter and fails\n\n### What version are you seeing the problem on?\n\nv2.0\n\n### How to reproduce the bug\n\n```python\nclass BatchSamplerForPaddingHaters(Sample... | 5f5d99eae6974edef756ce5b22a8f2cd0e16af1d | {
"head_commit": "49bcc122369db9c9bf4f5901326f3e9dca6dfcd7",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/src/lightning/fabric/CHANGELOG.md b/src/lightning/fabric/CHANGELOG.md\nindex 8ded9d4cb160e... | [
{
"diff_hunk": "@@ -196,7 +197,8 @@ def _dataloader_init_kwargs_resolve_sampler(\n )\n \n batch_sampler = _reinstantiate_wrapped_cls(batch_sampler, *args, **kwargs)\n- else:\n+ elif isinstance(batch_sampler, BatchSampler):\n+ # This is a PyTorch `BatchSampler... | c389fc01c22ed4e2c512b239968e8d31cf497db5 | diff --git a/src/lightning/fabric/CHANGELOG.md b/src/lightning/fabric/CHANGELOG.md
index 8ded9d4cb160e..ae35727286dff 100644
--- a/src/lightning/fabric/CHANGELOG.md
+++ b/src/lightning/fabric/CHANGELOG.md
@@ -118,6 +118,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added valida... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-18432@d62e18e | Lightning-AI/pytorch-lightning | Python | 18,432 | Raise exception when `load_from_checkpoint` called from instance | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2023-08-29T22:51:38Z | `load_from_checkpoint` should not be called as an instance method
### Outline & Motivation
Spent a while debugging :
```python
model.load_from_checkpoint(model_path)
```
which should be :
```python
model = LitModel.load_from_checkpoint(model_path)
```
there should be a warning when the instance method is cal... | Thanks for the suggestion @ganessh22
We already have an error message for this, but I think we could improve it to give some instructions what to do instead:
https://github.com/Lightning-AI/lightning/blob/df4ad1932b0ad9a5ffe9b335726e4d12f6820f23/src/lightning/pytorch/core/saving.py#L99
I see. Mistake from my side ... | [
{
"body": "### Outline & Motivation\n\nSpent a while debugging : \r\n```python\r\nmodel.load_from_checkpoint(model_path)\r\n```\r\nwhich should be : \r\n```python\r\nmodel = LitModel.load_from_checkpoint(model_path)\r\n```\r\nthere should be a warning when the instance method is called. \n\n### Pitch\n\n```pyth... | 13a479b214d44813cc3545319bc2b28b2304fb59 | {
"head_commit": "d62e18ec45a001e99b43e2efbf1169d49946455f",
"head_commit_message": "changed test for restricted_classmethod.",
"patch_to_review": "diff --git a/src/lightning/pytorch/core/datamodule.py b/src/lightning/pytorch/core/datamodule.py\nindex bda6dac711d06..fa081b6f9d8f3 100644\n--- a/src/lightning/pytor... | [
{
"diff_hunk": "@@ -0,0 +1,18 @@\n+import pytest\n+\n+from lightning.pytorch.utilities.restricted_classmethod import restricted_classmethod\n+\n+\n+class _C:",
"line": null,
"original_line": 6,
"original_start_line": null,
"path": "tests/tests_pytorch/utilities/test_restricted_classmethod.py",
... | 81fff5c73e18dc07b68e09d33836610b878089cb | diff --git a/src/lightning/pytorch/CHANGELOG.md b/src/lightning/pytorch/CHANGELOG.md
index 96c4840f7d33a..e4dc82e05c8be 100644
--- a/src/lightning/pytorch/CHANGELOG.md
+++ b/src/lightning/pytorch/CHANGELOG.md
@@ -199,6 +199,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
+- Th... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-18088@d465bcc | Lightning-AI/pytorch-lightning | Python | 18,088 | Fix Google Cloud Storage checkpointing | ## What does this PR do?
This PR fixes an issue when using Google Storage as the Trainer's root directory, which failed because `fs.makedirs` is a no-op with GCS.
Fixes #18044
<!-- Does your PR introduce any breaking changes? If yes, please list them. -->
<details>
<summary><b>Before submitting</b></summ... | 2023-07-15T01:56:35Z | Missing folder exception with Google Cloud Storage checkpointing
### Bug description
The training fails when a GCP bucket is chosen as the Trainer's `default_root_dir`. I am properly logged in using `gcloud auth application-default login` and the correct GCP project is set using `gcloud config set project <my-projec... | I managed to trace it back to [this issue](https://github.com/fsspec/gcsfs/issues/312) in gcsfs. Essentially, the first call to `fs.isdir` returns `False` even when the 'folder' exists, while the second call properly returns `True`. I also noticed that a similar behavior was observed and fixed in Lightning back in 2021... | [
{
"body": "### Bug description\r\n\r\nThe training fails when a GCP bucket is chosen as the Trainer's `default_root_dir`. I am properly logged in using `gcloud auth application-default login` and the correct GCP project is set using `gcloud config set project <my-project>`. I have no problem with reading or wri... | 04e2d800af7afb47ab534290a146514c678f7db6 | {
"head_commit": "d465bcc3ccf4b7027c17acaf36d1ab3440fe6ee9",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/src/lightning/fabric/loggers/csv_logs.py b/src/lightning/fabric/loggers/csv_logs.py\nindex... | [
{
"diff_hunk": "@@ -21,6 +21,7 @@\n import torch\n from fsspec.core import url_to_fs\n from fsspec.implementations.local import AbstractFileSystem\n+from lightning_utilities.core.imports import lazy_import",
"line": null,
"original_line": 24,
"original_start_line": null,
"path": "src/lightning/f... | 45a9674bde94572c6da017039c4235597d2e1c80 | diff --git a/src/lightning/fabric/loggers/csv_logs.py b/src/lightning/fabric/loggers/csv_logs.py
index 31756502e95f7..fd0c69c3ab439 100644
--- a/src/lightning/fabric/loggers/csv_logs.py
+++ b/src/lightning/fabric/loggers/csv_logs.py
@@ -21,7 +21,7 @@
from torch import Tensor
from lightning.fabric.loggers.logger imp... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-17662@cf29caa | Lightning-AI/pytorch-lightning | Python | 17,662 | Add Profiler table kwargs | ## What does this PR do?
Adds table_kwargs to the PyTorchProfiler class to expose more formatting options to the user directly.
Fixes #17367
<!-- Does your PR introduce any breaking changes? If yes, please list them. -->
<details>
<summary><b>Before submitting</b></summary>
- Was this **discussed/agre... | 2023-05-19T08:37:26Z | Expose more arguments for PyTorchProfiler
### Description & Motivation
There are only limited arguments for PyTorch profiler exposed to the user. Some other arguments might be useful, such as `max_name_column_width` when the path is long and truncated.
### Pitch
Expose more arguments of PyTorch profiler such as `ma... | The class definition accepts `**profiler_kwargs`. So you should be able to pass this already: https://github.com/Lightning-AI/lightning/blob/a5c43d3b2b80f5fc769d7ed0ea511c0bd6733c6b/src/lightning/pytorch/profilers/pytorch.py#L243
> The class definition accepts **profiler_kwargs. So you should be able to pass this alrea... | [
{
"body": "### Description & Motivation\n\nThere are only limited arguments for PyTorch profiler exposed to the user. Some other arguments might be useful, such as `max_name_column_width` when the path is long and truncated. \n\n### Pitch\n\nExpose more arguments of PyTorch profiler such as `max_name_column_wid... | e6b7f1383ccb75eb0ee108567f7ed4255feff73b | {
"head_commit": "cf29caadd6cbf0d72d7beb03bce1a97f34804b2c",
"head_commit_message": "Mark table_kwargs test for Python 3.10 and above",
"patch_to_review": "diff --git a/src/lightning/pytorch/profilers/pytorch.py b/src/lightning/pytorch/profilers/pytorch.py\nindex 1971646eeb81b..fe3ab1c18968c 100644\n--- a/src/lig... | [
{
"diff_hunk": "@@ -619,3 +620,37 @@ def test_profile_callbacks(tmpdir):\n e.name == \"[pl][profile][Callback]EarlyStopping{'monitor': 'train_loss', 'mode': 'min'}.on_validation_start\"\n for e in pytorch_profiler.function_events\n )\n+\n+\n+@pytest.mark.skipif(sys.version_info < (3, 10), re... | 7e50fd7f526d9482546a8b2682d5028c41cb8630 | diff --git a/src/lightning/pytorch/profilers/pytorch.py b/src/lightning/pytorch/profilers/pytorch.py
index 1971646eeb81b..fe3ab1c18968c 100644
--- a/src/lightning/pytorch/profilers/pytorch.py
+++ b/src/lightning/pytorch/profilers/pytorch.py
@@ -21,7 +21,7 @@
import torch
from torch import nn, Tensor
-from torch.aut... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-17986@eb3764d | Lightning-AI/pytorch-lightning | Python | 17,986 | Fix detection of next version in Fabric's CSVLogger | ## What does this PR do?
Fix detection of next version in Fabric's CSVLogger. The issue was not properly handled in #17139 because our tests were incorrect in the first place.
Fixes #17886
cc @awaelchli @borda @Blaizzy @carmocca @justusschock | 2023-07-04T19:34:48Z | Auto increment version for CSVLogger likeTensorBoardLogger in Fabric
### Description & Motivation
TensorBoardLogger auto increments next version, but CSVLogger doesn't, which I believe it's inconsistent.
```python
from lightning.fabric.loggers import TensorBoardLogger
logger = TensorBoardLogger("throw_away")
log... | @dinhanhx your pitch is also giving the same warnings when they run consecutive time.
After viewing the Implementation of csvlogger. I understood it's warning message that indicates previous version will be deleted and new version will be saved in that same directory.
@Borda what do you think this feature has ... | [
{
"body": "### Description & Motivation\n\nTensorBoardLogger auto increments next version, but CSVLogger doesn't, which I believe it's inconsistent.\r\n```python\r\nfrom lightning.fabric.loggers import TensorBoardLogger\r\n\r\nlogger = TensorBoardLogger(\"throw_away\")\r\nlogger.log_metrics({\"loss\": 0.235, \"... | 00496da92d9e7d17c81f51c9abfb54583ba2817f | {
"head_commit": "eb3764dbbf20fe498c2fda2bc6888357750627cb",
"head_commit_message": "stupid",
"patch_to_review": "diff --git a/src/lightning/fabric/loggers/csv_logs.py b/src/lightning/fabric/loggers/csv_logs.py\nindex 312e48e6c2e76..7c26d139c3cf6 100644\n--- a/src/lightning/fabric/loggers/csv_logs.py\n+++ b/src/l... | [
{
"diff_hunk": "@@ -91,11 +91,6 @@ def version(self) -> Union[int, str]:\n self._version = self._get_next_version()\n return self._version\n \n- @property\n- def root_dir(self) -> str:\n- \"\"\"Gets the save directory where the versioned CSV experiments are saved.\"\"\"\n- ... | bfff47d38b684c60d24fe5936e6222085e906163 | diff --git a/src/lightning/fabric/CHANGELOG.md b/src/lightning/fabric/CHANGELOG.md
index a064ccc9988da..e11b00ef97f3b 100644
--- a/src/lightning/fabric/CHANGELOG.md
+++ b/src/lightning/fabric/CHANGELOG.md
@@ -168,6 +168,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed an iss... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-17639@03d0d3d | Lightning-AI/pytorch-lightning | Python | 17,639 | avoid unnecessary workers with sequential `CombinedLoader ` | ## What does this PR do?
This PR relates to behavior exhibited when training with multiple validation dataloaders. In this scenario, Lightning wraps the multiple dataloaders with a `CombinedLoader`. This `CombinedLoader` currently initializes all of the dataloaders causing all of their workers to start up and prefetch... | 2023-05-16T00:34:28Z | potentially substantial overhead starting all dataloaders in CombinedLoader
### Bug description
When training with multiple validation dataloaders, Lightning simultaneously initializes all dataloaders causing each one to initialize a full set of workers and begin prefetching potentially introducing substantial overh... | [
{
"body": "### Bug description\r\n\r\nWhen training with multiple validation dataloaders, Lightning simultaneously initializes all dataloaders causing each one to initialize a full set of workers and begin prefetching potentially introducing substantial overhead. For example, if there are 100 dataloaders and ea... | cf14d624ae6d6d1770776d108b9ce3fe02e72d78 | {
"head_commit": "03d0d3d164504feb9e5ff0abb5209eb570925ff1",
"head_commit_message": "Merge branch 'master' into bugfix/combined_worker_overload",
"patch_to_review": "diff --git a/src/lightning/pytorch/utilities/combined_loader.py b/src/lightning/pytorch/utilities/combined_loader.py\nindex 96299126b4bd1..7ff0c8b11... | [
{
"diff_hunk": "@@ -131,19 +131,24 @@ def __next__(self) -> Tuple[Any, int, int]:\n return self.__next__()\n \n def __iter__(self) -> Self:\n- super().__iter__()\n self._iterator_idx = 0\n self._idx = 0\n+ self._load_current_iterator()\n return self\n \n ... | 1be73d66176b465d865af18fcb611a2264a2e93a | diff --git a/src/lightning/pytorch/CHANGELOG.md b/src/lightning/pytorch/CHANGELOG.md
index 1e3c905b7e1e1..67badc0d4b75b 100644
--- a/src/lightning/pytorch/CHANGELOG.md
+++ b/src/lightning/pytorch/CHANGELOG.md
@@ -108,6 +108,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Fixe... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Performance Optimizations"
} | |
Lightning-AI__pytorch-lightning-17926@e307638 | Lightning-AI/pytorch-lightning | Python | 17,926 | Fix `TensorBoardLogger.log_graph` not recording the graph | ## What does this PR do?
Fixes #17844
<details>
<summary><b>Before submitting</b></summary>
- Was this **discussed/agreed** via a GitHub issue? (not for typos and docs)
- [x] Did you read the [contributor guideline](https://github.com/Lightning-AI/lightning/blob/master/.github/CONTRIBUTING.md), **Pull... | 2023-06-26T01:47:02Z | `fabric.logger.log_graph()` seems to do nothing
### Bug description
fabric.logger.log_graph() seems to do nothing.
My code looks like below, but no graph record in tensorboard log.
```python
fabric = Fabric(loggers=TensorBoardLogger(root_dir="./logs", name=None))
model, optimizer = fabric.setup(model, optimizer)
... | Yes @shihaoyin
For Fabric it would make sense to move this outside the else block IMO. Contributions for this change are welcome :) | [
{
"body": "### Bug description\r\nfabric.logger.log_graph() seems to do nothing.\r\nMy code looks like below, but no graph record in tensorboard log.\r\n```python\r\nfabric = Fabric(loggers=TensorBoardLogger(root_dir=\"./logs\", name=None))\r\nmodel, optimizer = fabric.setup(model, optimizer)\r\nfabric.logger.l... | c21b6de3c732af85414060dc3a643801d89ba71b | {
"head_commit": "e30763869df2e7e494fbbb87611776b3da6dfbb2",
"head_commit_message": "fixes no graph recorded bug",
"patch_to_review": "diff --git a/src/lightning/fabric/loggers/tensorboard.py b/src/lightning/fabric/loggers/tensorboard.py\nindex 3a5b468f3a6b7..07724dfa17a74 100644\n--- a/src/lightning/fabric/logge... | [
{
"diff_hunk": "@@ -265,6 +265,11 @@ def log_graph(self, model: Module, input_array: Optional[Tensor] = None) -> None\n input_array = model._on_before_batch_transfer(input_array) # type: ignore[operator]\n input_array = model._apply_batch_transfer_handler(input_array) # type: ignore[op... | ed19120f857ed81b4d027f10f7725fbcc2debe90 | diff --git a/src/lightning/fabric/CHANGELOG.md b/src/lightning/fabric/CHANGELOG.md
index 750001f527954..a1b491528b7cd 100644
--- a/src/lightning/fabric/CHANGELOG.md
+++ b/src/lightning/fabric/CHANGELOG.md
@@ -150,6 +150,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed FSDP r... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-17424@bcf7b0c | Lightning-AI/pytorch-lightning | Python | 17,424 | Fix LightningModule step methods bypassing DDP wrapper in Fabric | ## What does this PR do?
Fixes #16856
Context:
In PyTorch, if you wrap your module into e.g. DistributedDataParallel
```py
model = ...
ddp_model = torch.nn.parallel.DistributedDataParallel(model, ...)
```
everything that you want to pass through that model **needs** to go through `ddp_model.forward`! Like s... | 2023-04-20T22:32:29Z | Calls to LightningModule's `*_step` methods in Fabric bypasses DDP wrapper
### Bug description
In Fabric, we wrap the model in DDP, but all inputs going through the model need to go through forward(). If you call other methods on the module, like `training_step` etc., it bypasses the DDP wrapper.
### How to reproduc... | What I've reported here has now also been seen by a user on Discord: https://discord.com/channels/1077906959069626439/1097919761100316832/1097923294180692090
It is not possible for the user to just know they need to pass everything through forward and so I'll brainstorm a solution for this. One possibility is to wra... | [
{
"body": "### Bug description\n\nIn Fabric, we wrap the model in DDP, but all inputs going through the model need to go through forward(). If you call other methods on the module, like `training_step` etc., it bypasses the DDP wrapper. \n\n### How to reproduce the bug\n\n```python\nfabric = Fabric(devices=2)\r... | 8dac2512733bae034f437334a71e4c114d458a7c | {
"head_commit": "bcf7b0cdc73b7fdac04f047acc832a5f4d911d09",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/src/lightning/fabric/fabric.py b/src/lightning/fabric/fabric.py\nindex 096131ada0f28..5ebb... | [
{
"diff_hunk": "@@ -353,3 +384,64 @@ def test_is_wrapped():\n assert not is_wrapped(dataloader)\n wrapped = _FabricDataLoader(dataloader)\n assert is_wrapped(wrapped)\n+\n+\n+def test_step_method_redirection():\n+ \"\"\"Test that the FabricModule redirects the special `LightningModule.*_step` met... | 4904d419fdfa145b1b5b97d0162c924259c256e6 | diff --git a/src/lightning/fabric/CHANGELOG.md b/src/lightning/fabric/CHANGELOG.md
index 50d4d7e51eb2b..b8ee77888f842 100644
--- a/src/lightning/fabric/CHANGELOG.md
+++ b/src/lightning/fabric/CHANGELOG.md
@@ -27,6 +27,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added support ... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-17380@627dfa7 | Lightning-AI/pytorch-lightning | Python | 17,380 | Add a warning to the `detect_anomaly` flag | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2023-04-14T16:24:16Z | Add a performance warning to pl.Trainer parameter detect_anomaly.
### Description & Motivation
This detect_anomaly parameter greatly affects performance and is usually only used in debugging.
Sometimes after debugging, user forget setting detect_anomaly to False, resulting in a performance loss during training.
... | I am not opposed to this. Since the flag is only meant for debugging stability.
@carmocca @justusschock any objection to this?
I agree. @One-sixth Would you like to contribute it?
@carmocca Yes, I opened a PR. | [
{
"body": "### Description & Motivation\n\nThis detect_anomaly parameter greatly affects performance and is usually only used in debugging. \r\nSometimes after debugging, user forget setting detect_anomaly to False, resulting in a performance loss during training. \r\nHope add a warning to notice user that d... | 8e7b949ef3825d84d9d4864ba8a20072a58124b6 | {
"head_commit": "627dfa71f3b150b38192612cd79ec0c9caa29387",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/src/lightning/pytorch/trainer/trainer.py b/src/lightning/pytorch/trainer/trainer.py\nindex... | [
{
"diff_hunk": "@@ -454,6 +454,10 @@ def __init__(\n GradClipAlgorithmType(gradient_clip_algorithm.lower()) if gradient_clip_algorithm is not None else None\n )\n \n+ if detect_anomaly:\n+ rank_zero_info(\n+ \"You have turned on detect_anomaly flag, which can... | a265dc16fb17671a34b7f7a9cc7f4e5bf90c7389 | diff --git a/src/lightning/pytorch/trainer/trainer.py b/src/lightning/pytorch/trainer/trainer.py
index c19598471c18b..b53ae5b2c75b9 100644
--- a/src/lightning/pytorch/trainer/trainer.py
+++ b/src/lightning/pytorch/trainer/trainer.py
@@ -454,6 +454,11 @@ def __init__(
GradClipAlgorithmType(gradient_clip_alg... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Performance Optimizations"
} |
Lightning-AI__pytorch-lightning-17391@79b60ff | Lightning-AI/pytorch-lightning | Python | 17,391 | Update Fabric CPU tests to work on GPU machines | ## What does this PR do?
Fix CPU tests to work on GPU machines
Fixes #17371
On testing on multi-GPU machines (the CI included) fails when running tests in `tests/tests_fabric` which were intended to run on the CPU due to the new `devices="auto"` and `accelerator="auto"` features in versions `2.0+`
This PR cha... | 2023-04-15T07:54:59Z | Update Fabric tests with devices=1 where necessary
### Outline & Motivation
In 2.0, the defaults for accelerator, devices, strategy were all switched to "auto". This causes a problem for many tests that instantiate fabric like so
```py
fabric = Fabric()
```
and previously were assuming this would run on the CP... | Hi @awaelchli, I can do this.
On my computer there is 1 failing in `tests/test_fabric`
```
FAILED tests/tests_fabric/test_fabric.py::test_backward_model_input_required -
RuntimeError: Expected all tensors to be on the same device, but found at least two devices,
cuda:0 and cpu! (when checking argument for ar... | [
{
"body": "### Outline & Motivation\n\nIn 2.0, the defaults for accelerator, devices, strategy were all switched to \"auto\". This causes a problem for many tests that instantiate fabric like so\r\n\r\n```py\r\nfabric = Fabric()\r\n```\r\n\r\nand previously were assuming this would run on the CPU (devices=1). H... | cf5e63dcfad19527d4310bc8c78199dbb08013cd | {
"head_commit": "79b60ff46c5e31864f8049a99ec3ee10e8826df4",
"head_commit_message": "standard tests all passing, set min gpus",
"patch_to_review": "diff --git a/tests/tests_fabric/parity/test_parity_simple.py b/tests/tests_fabric/parity/test_parity_simple.py\nindex 1e262d98f8cab..be070d45c92ec 100644\n--- a/tests... | [
{
"diff_hunk": "@@ -118,10 +118,10 @@ def train_fabric(fabric):\n \"precision, accelerator\",\n [\n (32, \"cpu\"),\n- pytest.param(32, \"cuda\", marks=RunIf(min_cuda_gpus=1)),\n+ pytest.param(32, \"cuda\", marks=RunIf(min_cuda_gpus=1, standalone=True)),",
"line": null,
"ori... | a6515312109c228aea6d320232905f686c2dc627 | diff --git a/tests/tests_fabric/parity/test_parity_simple.py b/tests/tests_fabric/parity/test_parity_simple.py
index 1e262d98f8cab..33ca3f7c71c78 100644
--- a/tests/tests_fabric/parity/test_parity_simple.py
+++ b/tests/tests_fabric/parity/test_parity_simple.py
@@ -38,7 +38,7 @@ def train_torch(
precision_context,
... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Test Suite / CI Enhancements"
} |
Lightning-AI__pytorch-lightning-17007@5ab9266 | Lightning-AI/pytorch-lightning | Python | 17,007 | Error checking for non-iterables | ## What does this PR do?
Fixes https://github.com/Lightning-AI/lightning/issues/16912
cc @borda @justusschock @awaelchli | 2023-03-09T02:06:02Z | CombinedLoader: NoneType object is not iterable
### Bug description
When the `LM.val_dataloader` method returns None, two unexpected behaviors take place:
1. There is a warning that shouldn't show:
```
UserWarning: Total length of `NoneType` across ranks is zero. Please make sure this was your intention.
```
... | @carmocca Do you agree that this was an unintended change from 1.9.x?
I believe the use case is valid: You may want to conditionally return a val loader from a DataModule or LightningModule depending on availability of validation data or not.
This breaking change was intended: https://github.com/Lightning-AI/lightnin... | [
{
"body": "### Bug description\n\nWhen the `LM.val_dataloader` method returns None, two unexpected behaviors take place:\r\n\r\n1. There is a warning that shouldn't show:\r\n\r\n```\r\nUserWarning: Total length of `NoneType` across ranks is zero. Please make sure this was your intention.\r\n```\r\n\r\n2. There ... | b09c0776bcb760c1c5b7545686db422fea9b834a | {
"head_commit": "5ab92665c37bf4527c7fd5f71a013de10939e26e",
"head_commit_message": "Fix test",
"patch_to_review": "diff --git a/src/lightning/pytorch/CHANGELOG.md b/src/lightning/pytorch/CHANGELOG.md\nindex 945f6380fad7b..1a258d24b352d 100644\n--- a/src/lightning/pytorch/CHANGELOG.md\n+++ b/src/lightning/pytorch... | [
{
"diff_hunk": "@@ -386,18 +374,30 @@ def get_instance(self, hook_name: str) -> Union[\"pl.LightningModule\", \"pl.Lightn\n return self.model\n \n \n-def _check_dataloader_none(\n- dataloader: Optional[Union[TRAIN_DATALOADERS, EVAL_DATALOADERS]],\n- dataloader_source: _DataLoaderSource,\n+def _che... | 7e2e4d88582aea73d3231f1f9dad8bdf6b02ae84 | diff --git a/src/lightning/pytorch/CHANGELOG.md b/src/lightning/pytorch/CHANGELOG.md
index 67fb44b41fd65..9ef3daa7456e6 100644
--- a/src/lightning/pytorch/CHANGELOG.md
+++ b/src/lightning/pytorch/CHANGELOG.md
@@ -62,6 +62,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `D... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-16485@c80fe89 | Lightning-AI/pytorch-lightning | Python | 16,485 | Enable more shorthand strategy names in the Fabric CLI | ## What does this PR do?
Fixes #16479
For example, this is now possible:
```
lightning run model --strategy=deepspeed_stage_3 train.py
```
## Before submitting
- [x] Was this discussed/approved via a GitHub issue? (not for typos and docs)
- [x] Did you read the [contributor guideline](https://github.com... | 2023-01-24T12:22:27Z | Expose available strategies from registry in Fabric CLI
### Description & Motivation
The Fabric CLI has the following options for strategy:
```
lightning run model --help
--strategy [ddp|dp|deepspeed] Strategy for how to run across multiple
devices.
```
But special key... | [
{
"body": "### Description & Motivation\n\nThe Fabric CLI has the following options for strategy:\r\n\r\n```\r\nlightning run model --help\r\n\r\n --strategy [ddp|dp|deepspeed] Strategy for how to run across multiple\r\n devices.\r\n```\r\n\r\nBut special keywords like `deeps... | 7603dd09cb5ba91baedf2559812f42ea4209a4f3 | {
"head_commit": "c80fe897225bb87c9f8b69ed5fe89c84e959fde4",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/src/lightning_fabric/CHANGELOG.md b/src/lightning_fabric/CHANGELOG.md\nindex 4c5c406db5747... | [
{
"diff_hunk": "@@ -54,7 +56,7 @@ def test_cli_env_vars_accelerator(_, accelerator, monkeypatch, fake_script):\n assert os.environ[\"LT_ACCELERATOR\"] == accelerator\n \n \n-@pytest.mark.parametrize(\"strategy\", [\"dp\", \"ddp\", \"deepspeed\"])\n+@pytest.mark.parametrize(\"strategy\", [\"dp\", \"ddp\", \"... | 82109c98d69ddb096103df5c127ebdd6abe5d1a8 | diff --git a/src/lightning_fabric/CHANGELOG.md b/src/lightning_fabric/CHANGELOG.md
index 3319362b79790..f2378c7c20e16 100644
--- a/src/lightning_fabric/CHANGELOG.md
+++ b/src/lightning_fabric/CHANGELOG.md
@@ -22,6 +22,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
* `Fabric.load... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} | |
Lightning-AI__pytorch-lightning-16953@0599a3b | Lightning-AI/pytorch-lightning | Python | 16,953 | Add `is_wrapped` utility function for Fabric | ## What does this PR do?
Method to check whether a Fabric model was set up already #16484
Fixes #16484
<!-- Does your PR introduce any breaking changes? If yes, please list them. -->
<details>
<summary><b>Before submitting</b></summary>
- Was this **discussed/agreed** via a GitHub issue? (not for ... | 2023-03-05T03:50:48Z | Method to check whether a Fabric model was set up already
### Description & Motivation
Currently, if you pass a model to Fabric.setup() that has already been wrapped/set up, you get an error. This is currently expected, because there are several reasons and edge cases where this would be invalid usage. However, the ... | Would a property work too?
Do we need separate `is_*_setup` functions for the different components that can be set-up?
A property wouldn't work. You wouldn't be able to check `model.is_setup()` if model is an nn.Module (and therefore not set up). It would either have to be a function
```py
def is_setup(module) -... | [
{
"body": "### Description & Motivation\r\n\r\nCurrently, if you pass a model to Fabric.setup() that has already been wrapped/set up, you get an error. This is currently expected, because there are several reasons and edge cases where this would be invalid usage. However, the only way to check whether a model i... | a8c4d1f552cebde1051b17a7718844281923b1ef | {
"head_commit": "0599a3b6ac2e2783e196c5029d59119438ee2d2e",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/src/lightning/fabric/__init__.py b/src/lightning/fabric/__init__.py\nindex c7084388528a8..... | [
{
"diff_hunk": "@@ -799,5 +799,13 @@ def _is_using_cli() -> bool:\n return bool(int(os.environ.get(\"LT_CLI_USED\", \"0\")))\n \n \n+def is_wrapped(module: Union[nn.Module, _FabricModule]) -> bool:",
"line": null,
"original_line": 802,
"original_start_line": null,
"path": "src/lightning/fabr... | 576a5e3b13882a871921e165b95631d50b11deb9 | diff --git a/docs/source-fabric/api/utilities.rst b/docs/source-fabric/api/utilities.rst
index fe58e14000d0d..9437317c8ee22 100644
--- a/docs/source-fabric/api/utilities.rst
+++ b/docs/source-fabric/api/utilities.rst
@@ -67,3 +67,22 @@ Avoid duplicated print statements in the logs in distributed training by using F
... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-17005@7469d86 | Lightning-AI/pytorch-lightning | Python | 17,005 | Adding non-layer param count to summary | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2023-03-09T00:33:18Z | ModelSummary ignores nn.Parameter
## 🐛 Bug
I don't know if this is a bug of a feature, but currently ModelSummary only reports member `nn.Module`s and ignores `nn.Parameter`s that are directly created. I believe these parameters are an important part (and sometimes, a big part in terms of the number of weights) of ... | Hey @ZhaofengWu
Happy to see you find the model summary useful!
I looked at this very briefly now. With the following code I get:
```py
import torch
from pytorch_lightning import LightningModule
from pytorch_lightning.utilities.model_summary import ModelSummary
class BoringModel(LightningModule):
... | [
{
"body": "## 🐛 Bug\r\n\r\nI don't know if this is a bug of a feature, but currently ModelSummary only reports member `nn.Module`s and ignores `nn.Parameter`s that are directly created. I believe these parameters are an important part (and sometimes, a big part in terms of the number of weights) of the model s... | d7b668eb94b3d224e0e6d1fb396b1f3159d6bcc3 | {
"head_commit": "7469d86cb36e1224fac4d024a2244ea7efb405f2",
"head_commit_message": "remove commented code",
"patch_to_review": "diff --git a/src/lightning/pytorch/utilities/model_summary/model_summary.py b/src/lightning/pytorch/utilities/model_summary/model_summary.py\nindex 15437ec913d3b..9f960594a114e 100644\n... | [
{
"diff_hunk": "@@ -292,8 +301,24 @@ def _get_summary_data(self) -> List[Tuple[str, List[str]]]:\n arrays.append((\"In sizes\", [str(x) for x in self.in_sizes]))\n arrays.append((\"Out sizes\", [str(x) for x in self.out_sizes]))\n \n+ total_leftover_params = self.total_parameters ... | 517f54cf30419d213db9dbdfeb6c1b1a3725865b | diff --git a/src/lightning/pytorch/CHANGELOG.md b/src/lightning/pytorch/CHANGELOG.md
index 4b3aaf256cf88..9d7bda17a0fbe 100644
--- a/src/lightning/pytorch/CHANGELOG.md
+++ b/src/lightning/pytorch/CHANGELOG.md
@@ -51,6 +51,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added CLI ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-16657@bffbcc4 | Lightning-AI/pytorch-lightning | Python | 16,657 | Use base version when comparing torch versions | ## What does this PR do?
Fixes #16644
## Before submitting
- [x] Was this discussed/approved via a GitHub issue? (not for typos and docs)
- [x] Did you read the [contributor guideline](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/.github/CONTRIBUTING.md), **Pull Request** section?
- [x] Di... | 2023-02-06T21:33:13Z | TypeError: cannot create weak reference to 'weakcallableproxy' object after upgrading to 1.9.0
### Bug description
With the new pip package pytorch-lightning==1.9.0 I am unable to instantiate any PL module:
```python
import pytorch_lightning as pl
pl.LightningModule()
```
getting error: `TypeError: cannot ... | @radek555 This is reproducible. Thanks for pointing to the docker image.
I found out what's causing this issue. We run the following code conditionally:
https://github.com/Lightning-AI/lightning/blob/accd2b9e61063ba3c683764043030545ed87c71f/src/lightning/pytorch/core/module.py#L1635-L1641
You are using torch ver... | [
{
"body": "### Bug description\r\n\r\nWith the new pip package pytorch-lightning==1.9.0 I am unable to instantiate any PL module:\r\n\r\n```python\r\nimport pytorch_lightning as pl\r\npl.LightningModule()\r\n```\r\n\r\ngetting error: `TypeError: cannot create weak reference to 'weakcallableproxy' object`\r\n\r... | da572d7ccafee45f081a94f9b7cad04bd72059d3 | {
"head_commit": "bffbcc41b2b111a8ac09513d3ccd2f9f6fa216d7",
"head_commit_message": "changelog",
"patch_to_review": "diff --git a/src/lightning/fabric/utilities/imports.py b/src/lightning/fabric/utilities/imports.py\nindex b5b1441781640..85be277f35bb9 100644\n--- a/src/lightning/fabric/utilities/imports.py\n+++ b... | [
{
"diff_hunk": "@@ -22,7 +22,7 @@\n _PYTHON_GREATER_EQUAL_3_10_0 = (sys.version_info.major, sys.version_info.minor) >= (3, 10)\n _PYTHON_GREATER_EQUAL_3_11_0 = (sys.version_info.major, sys.version_info.minor) >= (3, 11)\n # duplicated from fabric because HPU is patching it below",
"line": null,
"origina... | 10ea001eda0b6b29eda0313c68b7856d103d03ff | diff --git a/src/lightning/fabric/utilities/imports.py b/src/lightning/fabric/utilities/imports.py
index b5b1441781640..85be277f35bb9 100644
--- a/src/lightning/fabric/utilities/imports.py
+++ b/src/lightning/fabric/utilities/imports.py
@@ -25,7 +25,10 @@
# 2. The inspection mode via `python -i`: https://stackoverflow... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-16808@7d9d467 | Lightning-AI/pytorch-lightning | Python | 16,808 | Allow sys.argv and args in LightningCLI | ## What does this PR do?
Currently this just changes an error into a warning. An alternative would be to let the user specify a flag that changed the error into a warning, but my thought is that might just be more clutter than what it's worth, raising the warning might be good enough.
Fixes #16807
<details>
... | 2023-02-19T18:25:29Z | Allow sys.argv and args with LightningCLI for testing
### Outline & Motivation
I currently am forced to inherit from `LightningCLI` and overload `parse_arguments` to disable an error when you call LightningCLI with `args` and `sys.argv` is populated.
```python
class LightningCLI_Extension(LightningCLI):
...
... | [
{
"body": "### Outline & Motivation\n\nI currently am forced to inherit from `LightningCLI` and overload `parse_arguments` to disable an error when you call LightningCLI with `args` and `sys.argv` is populated.\r\n\r\n```python\r\nclass LightningCLI_Extension(LightningCLI):\r\n ...\r\n\r\n def parse_argu... | 63b90349853a1e3713e22ab94e4ba9ab31b9f7a5 | {
"head_commit": "7d9d4675a01e96d30d26699ecc5320f268cba239",
"head_commit_message": "Allow sys.argv and args",
"patch_to_review": "diff --git a/src/lightning/pytorch/cli.py b/src/lightning/pytorch/cli.py\nindex 1942ce6d156e5..ac612a87ec528 100644\n--- a/src/lightning/pytorch/cli.py\n+++ b/src/lightning/pytorch/cl... | [
{
"diff_hunk": "@@ -483,9 +483,9 @@ def link_optimizers_and_lr_schedulers(parser: LightningArgumentParser) -> None:\n def parse_arguments(self, parser: LightningArgumentParser, args: ArgsType) -> None:\n \"\"\"Parses command line arguments and stores it in ``self.config``.\"\"\"\n if args is... | 8e8274ea5495628aceaa7827597ed55e380e163b | diff --git a/src/lightning/pytorch/cli.py b/src/lightning/pytorch/cli.py
index 1942ce6d156e5..73525f748ce07 100644
--- a/src/lightning/pytorch/cli.py
+++ b/src/lightning/pytorch/cli.py
@@ -483,9 +483,9 @@ def link_optimizers_and_lr_schedulers(parser: LightningArgumentParser) -> None:
def parse_arguments(self, pars... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "New Feature Additions"
} | |
Lightning-AI__pytorch-lightning-16168@95afcd0 | Lightning-AI/pytorch-lightning | Python | 16,168 | Check broken links | ## What does this PR do?
Fixes #8107
This checks for broken links in all markdown files.
- [x] For markdown files, I have created a new workflow based on [this](https://github.com/gaurav-nelson/github-action-markdown-link-check)
- [x] Skips checks on links of the form, `^https://github.com/Lightning-AI/lightning/... | 2022-12-21T23:26:33Z | Testing URL links in docs & readme
## 🚀 Feature
it may easily happen that some external links are not valid anymore so we shall test them all...
### Motivation
detect broken links in the process
### Alternatives
load the URLs via bs4? (a web scraping tool)
assert that the text you get back contains an ... | Is [CheckExternalLinksBuilder](https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.linkcheck.CheckExternalLinksBuilder) what you're looking for? It only checks links in the docs though.
I can take this up! | [
{
"body": "## 🚀 Feature\r\n\r\nit may easily happen that some external links are not valid anymore so we shall test them all...\r\n\r\n### Motivation\r\n\r\ndetect broken links in the process\r\n\r\n### Alternatives\r\n\r\nload the URLs via bs4? (a web scraping tool)\r\nassert that the text you get back contai... | bd521813e23d781be822669f0ace17aef458f825 | {
"head_commit": "95afcd0c37bb8f9abedc2a42d2acc272f03fdcda",
"head_commit_message": "Merge branch 'master' into check-dead-links",
"patch_to_review": "diff --git a/.github/workflows/docs-checks.yml b/.github/workflows/docs-checks.yml\nindex 03cf7fb4e6497..8c18a5c5a3f58 100644\n--- a/.github/workflows/docs-checks.... | [
{
"diff_hunk": "@@ -0,0 +1,28 @@\n+name: Check Markdown links\n+# https://github.com/gaurav-nelson/github-action-markdown-link-check\n+\n+on:\n+ push:\n+ branches: [master, \"release/*\"]\n+ pull_request:\n+ branches: [master, \"release/*\"]\n+ types: [opened, reopened, ready_for_review, synchronize]... | c8378c4836b2a6088aab1d2f04954f3b35d83204 | diff --git a/.github/workflows/check-md-links.yml b/.github/workflows/check-md-links.yml
new file mode 100644
index 0000000000000..1d411a6a16fe0
--- /dev/null
+++ b/.github/workflows/check-md-links.yml
@@ -0,0 +1,22 @@
+name: Check Markdown links
+# https://github.com/gaurav-nelson/github-action-markdown-link-check
+
+... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Test Suite / CI Enhancements"
} |
Lightning-AI__pytorch-lightning-15886@12c74f1 | Lightning-AI/pytorch-lightning | Python | 15,886 | Fix `action_name` usage in `XLAProfiler` | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2022-12-02T00:58:06Z | `XLAProfiler` on TPU not working
### Bug description
It seems the changes in `action_name` is preventing it from starting the profiler server or logging any steps. This patch fixes the bug:
```
diff --git a/src/pytorch_lightning/profilers/xla.py b/src/pytorch_lightning/profilers/xla.py
index ef103a9a4..958e8de3... | Hey @@Liyang90,
Would you be interested into turning this patch into a PR ?
Best,
T.C | [
{
"body": "### Bug description\n\nIt seems the changes in `action_name` is preventing it from starting the profiler server or logging any steps. This patch fixes the bug:\r\n\r\n\r\n```\r\ndiff --git a/src/pytorch_lightning/profilers/xla.py b/src/pytorch_lightning/profilers/xla.py\r\nindex ef103a9a4..958e8de3f ... | 346e93665102f4faebce388a8e556f9394b7804f | {
"head_commit": "12c74f134e4db63aa2f114fa539f1b45c721a1b8",
"head_commit_message": "Fix `action_name` usage in `XLAProfiler`",
"patch_to_review": "diff --git a/src/pytorch_lightning/profilers/xla.py b/src/pytorch_lightning/profilers/xla.py\nindex ef103a9a45842..958e8de3f7e18 100644\n--- a/src/pytorch_lightning/p... | [
{
"diff_hunk": "@@ -50,7 +50,7 @@ def __init__(self, port: int = 9012) -> None:\n def start(self, action_name: str) -> None:\n import torch_xla.debug.profiler as xp\n \n- if action_name in self.RECORD_FUNCTIONS:\n+ if action_name.split(\".\")[-1] in self.RECORD_FUNCTIONS:",
"line":... | af2a290e45405185ceb66791fa70561ba2f18609 | diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md
index 82d80d2cbfda9..6f6e1f156d169 100644
--- a/src/pytorch_lightning/CHANGELOG.md
+++ b/src/pytorch_lightning/CHANGELOG.md
@@ -86,6 +86,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Enhanced `... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-15876@0d25961 | Lightning-AI/pytorch-lightning | Python | 15,876 | CI: parameterize TPU tests | ## What does this PR do?
Fixes https://github.com/Lightning-AI/lightning/issues/15788
### Does your PR introduce any breaking changes? If yes, please list them.
<!-- FILL IN or None -->
## Before submitting
- [ ] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [x] Did you ... | 2022-11-30T15:03:57Z | TPU workflow fails to clone
## Proposed refactor
The error is:
```python
2022-11-23T13:30:38.5417880Z /usr/lib/git-core/git-remote-https: /root/miniconda3/envs/lightning/lib/libffi.so.7: version `LIBFFI_BASE_7.0' not found (required by /usr/lib/x86_64-linux-gnu/libp11-kit.so.0)
2022-11-23T13:30:38.5418856Z /usr/l... | Looks like this error wasn't caused by any PR. It started failing in master after aef94ce52bd13c370225875dc5466503cff4b70e | [
{
"body": "## Proposed refactor\r\n\r\nThe error is:\r\n```python\r\n2022-11-23T13:30:38.5417880Z /usr/lib/git-core/git-remote-https: /root/miniconda3/envs/lightning/lib/libffi.so.7: version `LIBFFI_BASE_7.0' not found (required by /usr/lib/x86_64-linux-gnu/libp11-kit.so.0)\r\n2022-11-23T13:30:38.5418856Z /usr/... | e7917492cd0361c3d8c675f3f6e1e2e54e831cc8 | {
"head_commit": "0d259616c313992c557ee6dbf0f7090b3510161c",
"head_commit_message": "path",
"patch_to_review": "diff --git a/.github/workflows/tpu-tests.yml b/.github/workflows/tpu-tests.yml\nindex 6ce21d0f9ebc7..d438afba4032a 100644\n--- a/.github/workflows/tpu-tests.yml\n+++ b/.github/workflows/tpu-tests.yml\n@... | [
{
"diff_hunk": "@@ -3,7 +3,7 @@ name: Test PyTorch - TPU\n on:\n push:\n branches: [master, \"release/*\"]\n- pull_request_target:\n+ pull_request: # FIXME: use `pull_request_target`",
"line": null,
"original_line": 6,
"original_start_line": null,
"path": ".github/workflows/tpu-tests.ym... | 68e6d81f40d28da793e2af84ddc4c09937f0c51f | diff --git a/.github/workflows/tpu-tests.yml b/.github/workflows/tpu-tests.yml
index 6ce21d0f9ebc7..24c5fa1a205d5 100644
--- a/.github/workflows/tpu-tests.yml
+++ b/.github/workflows/tpu-tests.yml
@@ -30,13 +30,22 @@ env:
GKE_CLUSTER: lightning-cluster
GKE_ZONE: us-central1-a
+defaults:
+ run:
+ shell: bash... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Dependency Updates & Env Compatibility"
} |
Lightning-AI__pytorch-lightning-16153@511557a | Lightning-AI/pytorch-lightning | Python | 16,153 | Error handling for `accelerator="mps"` and `ddp` strategy pairing | ## What does this PR do?
Fixes #16148
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
... | 2022-12-21T05:23:45Z | Error handling for `accelerator="mps"` and `strategy="ddp"`
### Bug description
The MPS backend does not support `torch.distributed`. We should fail early in the AcceleratorConnector and produce a user friendly error message.
### How to reproduce the bug
```python
import torch
from torch.utils.data import Da... | I'd like to take this up!
Perfect! Ping me here or on the PR if you have any questions | [
{
"body": "### Bug description\r\n\r\nThe MPS backend does not support `torch.distributed`. We should fail early in the AcceleratorConnector and produce a user friendly error message.\r\n\r\n### How to reproduce the bug\r\n\r\n```python\r\nimport torch\r\nfrom torch.utils.data import DataLoader, Dataset\r\n\r\n... | 428844d01d8a2cb07bd810a1c719d0548b1f4680 | {
"head_commit": "511557aae93580034401a9ed59fd4375d4a69aff",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/src/pytorch_lightning/trainer/connectors/accelerator_connector.py b/src/pytorch_lightning/... | [
{
"diff_hunk": "@@ -283,6 +283,24 @@ def _check_config_and_set_final_flags(\n f\" Available names are: {', '.join(self._accelerator_types)}.\"\n )\n \n+ # mps accelerator incompatible with ddp-family\n+ ddp_classes = (\n+ DDPStrategy,\n+ DDPSpawnSh... | fdcb87ff4cc319fe2c4bb62130835e2c7423adba | diff --git a/src/pytorch_lightning/trainer/connectors/accelerator_connector.py b/src/pytorch_lightning/trainer/connectors/accelerator_connector.py
index f43f9fb96fce7..2e74ff45fe105 100644
--- a/src/pytorch_lightning/trainer/connectors/accelerator_connector.py
+++ b/src/pytorch_lightning/trainer/connectors/accelerator_... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-15598@5b0efcd | Lightning-AI/pytorch-lightning | Python | 15,598 | FCCV Docs | ## What does this PR do?
Adds docs for custom data iterables
Fixes #11538
### Does your PR introduce any breaking changes? If yes, please list them.
<!-- FILL IN or None -->
## Before submitting
- [x] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [x] Did you read the [... | 2022-11-09T09:42:49Z | enable ffcv with PL
A team introduced ffcv which does optimizations in the dataloader level.
As long as it can be a drop in replacement for dataloader it should add the benefits to any PyTorch and Lightning script.
ie:
```python
# current
data = Dataloader(...)
trainer.fit(..., data)
# 10x faster with ffcv... | @ethanwharris This could be built-in within Flash.
https://github.com/libffcv/ffcv/issues/72
This is related to #10696.
When we support arbitrary iterables, ffcv should be supported automatically. Maybe not all features we support with basic torch loaders (haven't looked at ffcv details so far), but definitely usabl... | [
{
"body": "A team introduced ffcv which does optimizations in the dataloader level.\r\nAs long as it can be a drop in replacement for dataloader it should add the benefits to any PyTorch and Lightning script.\r\n\r\nie:\r\n```python\r\n# current\r\ndata = Dataloader(...)\r\n\r\ntrainer.fit(..., data)\r\n\r\n# 1... | 61ee3fabc3ca4fbc63d5c294c0b3f91f686d23cd | {
"head_commit": "5b0efcdd26a0ccdfb5e6258837453b41f5fa9710",
"head_commit_message": "nit",
"patch_to_review": "diff --git a/docs/source-pytorch/data/custom_data_iterables.rst b/docs/source-pytorch/data/custom_data_iterables.rst\nnew file mode 100644\nindex 0000000000000..2b793b6b79f8f\n--- /dev/null\n+++ b/docs/s... | [
{
"diff_hunk": "@@ -0,0 +1,109 @@\n+.. _dataiters:\n+\n+##################################\n+Injecting 3rd Party Data Iterables\n+##################################\n+\n+When training a model on a specific task, data loading and preprocessing might become a bottleneck.\n+Lightning does not enforce a specific da... | 880dc7caeca68f2fc463fc5cc42d600d3109be14 | diff --git a/docs/source-pytorch/data/custom_data_iterables.rst b/docs/source-pytorch/data/custom_data_iterables.rst
new file mode 100644
index 0000000000000..3b124c1356aee
--- /dev/null
+++ b/docs/source-pytorch/data/custom_data_iterables.rst
@@ -0,0 +1,122 @@
+.. _dataiters:
+
+##################################
+Inj... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-15818@2ca1710 | Lightning-AI/pytorch-lightning | Python | 15,818 | Introduce `{Work,Flow}.lightningignore` | ## What does this PR do?
Fixes https://github.com/Lightning-AI/lightning/issues/15797
### Does your PR introduce any breaking changes? If yes, please list them.
None
## Before submitting
- [x] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [x] Did you read the [contributo... | 2022-11-25T14:23:02Z | Programatic lightningignore
## 🚀 Feature
Support that flows and works define a `lightningignore: List[str]` attribute that can be customized. The app recursively merges all present before uploading files to the cloud
### Motivation
When the user copies an `app.py` snippet from the docs and writes it to a new ... | [
{
"body": "## 🚀 Feature\r\n\r\nSupport that flows and works define a `lightningignore: List[str]` attribute that can be customized. The app recursively merges all present before uploading files to the cloud\r\n\r\n### Motivation\r\n\r\nWhen the user copies an `app.py` snippet from the docs and writes it to a n... | 53ceb156c42ff9c2b2704996fdbbc91d8861d5d9 | {
"head_commit": "2ca1710b22317e451e0469cb1715ecbaa61cb120",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/docs/source-app/workflows/run_app_on_cloud/cloud_files.rst b/docs/source-app/workflows/run... | [
{
"diff_hunk": "@@ -493,24 +507,34 @@ def _ensure_cluster_project_binding(self, project_id: str, cluster_id: str):\n @staticmethod\n def _check_uploaded_folder(root: Path, repo: LocalSourceCodeDir) -> None:\n \"\"\"This method is used to inform the users if their folder files are large and how t... | 10f0e3f3ae5d89ad738ac83408bf91de5f1bd156 | diff --git a/docs/source-app/workflows/run_app_on_cloud/cloud_files.rst b/docs/source-app/workflows/run_app_on_cloud/cloud_files.rst
index 3130cd0f336b3..dfef0dc1c13aa 100644
--- a/docs/source-app/workflows/run_app_on_cloud/cloud_files.rst
+++ b/docs/source-app/workflows/run_app_on_cloud/cloud_files.rst
@@ -30,7 +30,6 ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} | |
Lightning-AI__pytorch-lightning-15748@cb98589 | Lightning-AI/pytorch-lightning | Python | 15,748 | Multinode on MPS | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2022-11-21T11:01:26Z | Multinode standalone not working on mps
### Bug description
When running on MPS capable devices, the multinode component sets accelerator="auto", devices="auto" and strategy="ddp" which will result in MPSAccelerator.
Since distributed on MPS is not supported, it has to be run on CPU for all apple silicon platforms ... | [
{
"body": "### Bug description\n\nWhen running on MPS capable devices, the multinode component sets accelerator=\"auto\", devices=\"auto\" and strategy=\"ddp\" which will result in MPSAccelerator. \r\nSince distributed on MPS is not supported, it has to be run on CPU for all apple silicon platforms instead.\n\... | b8c70183a9c2756260a2f30d356d62e1ea140ecc | {
"head_commit": "cb98589c78c9ad76d25f21ab734b8219b5cb4dfa",
"head_commit_message": "update skip reasons",
"patch_to_review": "diff --git a/src/lightning_app/CHANGELOG.md b/src/lightning_app/CHANGELOG.md\nindex dd4a638a76765..eafdccaa0e6ba 100644\n--- a/src/lightning_app/CHANGELOG.md\n+++ b/src/lightning_app/CHAN... | [
{
"diff_hunk": "@@ -72,23 +72,23 @@ jobs:\n uses: actions/cache@v3\n with:\n path: ${{ steps.pip-cache.outputs.dir }}\n- key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ matrix.pkg-name }}-${{ matrix.requires }}-${{ hashFiles('requirements/app/base.txt') }}\n+ ... | ee0f19a624f24bb50700ae926e53200508578091 | diff --git a/.github/workflows/ci-app-tests.yml b/.github/workflows/ci-app-tests.yml
index d19a408309bc4..b89e3145da12e 100644
--- a/.github/workflows/ci-app-tests.yml
+++ b/.github/workflows/ci-app-tests.yml
@@ -94,7 +94,7 @@ jobs:
- name: Adjust tests
if: ${{ matrix.pkg-name == 'lightning' }}
- ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
Lightning-AI__pytorch-lightning-15637@6086d44 | Lightning-AI/pytorch-lightning | Python | 15,637 | Remove `pytorch_lightning.profiler.{AbstractProfiler,BaseProfiler}` deprecated since v1.6 | ## What does this PR do?
Closes #15618.
Missed in #14404.
resolves #12106
### Does your PR introduce any breaking changes? If yes, please list them.
Removes these two deprecated classes:
```python
pytorch_lightning.profiler.base.AbstractProfiler
pytorch_lightning.profiler.base.BaseProfiler
```
in favor of:
... | 2022-11-11T06:03:39Z | Remove deprecated APIs that should've been removed in the past releases
## Proposed refactor
Here's a quick list of APIs to remove (there can be false negative).
```console
$ git grep -n "deprecated::"|egrep -v "1.7|1.8|1.9"
src/pytorch_lightning/profiler/base.py:28: .. deprecated:: v1.6
src/pytorch_lightning... | [
{
"body": "## Proposed refactor\r\n\r\nHere's a quick list of APIs to remove (there can be false negative).\r\n```console\r\n$ git grep -n \"deprecated::\"|egrep -v \"1.7|1.8|1.9\"\r\nsrc/pytorch_lightning/profiler/base.py:28: .. deprecated:: v1.6\r\nsrc/pytorch_lightning/profiler/base.py:56: .. deprecate... | 952b64b35878b66706d34907e3eca17434890922 | {
"head_commit": "6086d4431b1331b8108d109d3f14ed6f169305a7",
"head_commit_message": "update changelog",
"patch_to_review": "diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md\nindex d6726f985d5d6..235edeb582d79 100644\n--- a/src/pytorch_lightning/CHANGELOG.md\n+++ b/src/pytorch_l... | [
{
"diff_hunk": "@@ -0,0 +1,36 @@\n+# Copyright The PyTorch Lightning team.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE... | fae8214d314a59bf22f22fadcfcc070006150b6e | diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md
index 0e9d7922360c8..7109737d9a55f 100644
--- a/src/pytorch_lightning/CHANGELOG.md
+++ b/src/pytorch_lightning/CHANGELOG.md
@@ -59,6 +59,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Temporari... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "Code Refactoring / Architectural Improvement"
} | |
Lightning-AI__pytorch-lightning-15496@58b6ecf | Lightning-AI/pytorch-lightning | Python | 15,496 | load_from_checkpoint returns the expected type | ## What does this PR do?
- `Self`/`self` cannot be used since it requires python 3.11 AFAIK
- Since it looks like the tests are not type checked, I added a folder under `tests` for type checking (maybe more will be added)
<!--
Please include a summary of the change and which issue is fixed.
Please also include... | 2022-11-03T07:35:59Z | `MyNet.load_from_checkpoint` should return an instance of type `MyNet`
## Proposed refactor
`MyNet.load_from_checkpoint` currently returns an instance of type `LightningModule`.
It would be nice if it would return an instance of type `MyNet`.
### Motivation
<!-- Please outline the motivation for the proposal.... | @dyollb This can be achieved with typing.TypeVar. Here is a quick sketch:
```py
from typing import TypeVar
LM = TypeVar("LM")
@classmethod
def load_from_checkpoint(cls: LM, ...) -> LM:
```
Would you be interested to investigate and contribute this?
I had a quick try but didn't figure out how to do it,... | [
{
"body": "## Proposed refactor\r\n\r\n`MyNet.load_from_checkpoint` currently returns an instance of type `LightningModule`.\r\nIt would be nice if it would return an instance of type `MyNet`.\r\n\r\n### Motivation\r\n\r\n<!-- Please outline the motivation for the proposal. If this is related to another GitHub ... | ee8a57da0fbd5d61e1f43cb212cbe35f084e1c1a | {
"head_commit": "58b6ecf001fa35a63d86b8a4c7335892648612a6",
"head_commit_message": "attempt to fix mypy errors for py37",
"patch_to_review": "diff --git a/src/pytorch_lightning/core/datamodule.py b/src/pytorch_lightning/core/datamodule.py\nindex 5cd1713e2ffba..2e2bd7cbd506d 100644\n--- a/src/pytorch_lightning/co... | [
{
"diff_hunk": "@@ -63,7 +64,7 @@ def load_from_checkpoint(\n hparams_file: Optional[str] = None,\n strict: bool = True,\n **kwargs: Any,\n- ) -> Union[\"pl.LightningModule\", \"pl.LightningDataModule\"]:\n+ ) -> Self: # type: ignore [valid-type]",
"line": null,
"original_... | e066ba75279bf26f017905e42e0122fbfed4440f | diff --git a/src/pytorch_lightning/core/datamodule.py b/src/pytorch_lightning/core/datamodule.py
index 5cd1713e2ffba..894adeb797a9c 100644
--- a/src/pytorch_lightning/core/datamodule.py
+++ b/src/pytorch_lightning/core/datamodule.py
@@ -17,6 +17,7 @@
from typing import Any, Dict, IO, List, Mapping, Optional, Sequence,... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Code Refactoring / Architectural Improvement"
} |
Lightning-AI__pytorch-lightning-15319@bc307a8 | Lightning-AI/pytorch-lightning | Python | 15,319 | Fix pickling issues with rich progress bar | ## What does this PR do?
Fixes #15212
### Does your PR introduce any breaking changes? If yes, please list them.
No.
## Before submitting
- [x] Was this discussed/approved via a GitHub issue? (not for typos and docs)
- [x] Did you read the [contributor guideline](https://github.com/PyTorchLightning/pytorc... | 2022-10-25T23:26:44Z | Unable to pickle (dump) LightningModule object if RichProgressBar callback is added to Trainer
### Bug description
Adding `RichProgressBar` callback to the `Trainer` initialization, and then attempting to save the `LightningModule` object gives a `TypeError`:
```bash
Traceback (most recent call last):
File "/ho... | [
{
"body": "### Bug description\n\nAdding `RichProgressBar` callback to the `Trainer` initialization, and then attempting to save the `LightningModule` object gives a `TypeError`:\r\n\r\n```bash\r\nTraceback (most recent call last):\r\n File \"/home/krshrimali/bug.py\", line 12, in <module>\r\n pickle.dumps(... | d1263f5d7476d158222a240a2cebec9b3f00e882 | {
"head_commit": "bc307a856f6684ca892757a7775b1f78ad105483",
"head_commit_message": "Merge remote-tracking branch 'origin/bugfix/rich-picklable' into bugfix/rich-picklable",
"patch_to_review": "diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md\nindex 5f687de11a8da..f1d663eaab63d... | [
{
"diff_hunk": "@@ -416,3 +417,17 @@ def test_rich_progress_bar_padding():\n train_description = progress_bar._get_train_description(current_epoch=0)\n assert \"Epoch 0/0\" in train_description\n assert len(progress_bar.validation_description) == len(train_description)\n+\n+\n+def test_rich_progress... | 41f8f7a3e5b205672840085228c2417bac61686d | diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md
index 5f687de11a8da..f1d663eaab63d 100644
--- a/src/pytorch_lightning/CHANGELOG.md
+++ b/src/pytorch_lightning/CHANGELOG.md
@@ -12,6 +12,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Changed
... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
Lightning-AI__pytorch-lightning-15327@0d789ed | Lightning-AI/pytorch-lightning | Python | 15,327 | Improve callback documentation for `outputs` and `accumulate_grad_batches` (Resolves #15315) | ## What does this PR do?
Adds brief documentation explaining the `outputs` parameter to callback hooks, and that potentially unexpected behavior occurs when using `accumulate_grad_batches` > 1
Fixes #15315
### Does your PR introduce any breaking changes? If yes, please list them.
None
## Before submitt... | 2022-10-26T13:26:45Z | Misleading outputs (loss) in callback when using `accumulate_grad_batches` > 1 in trainer
## 📚 Documentation
Some of the callback entry points/hooks (e.g. `on_train_batch_end`) have an `outputs` argument that contains the loss returned from the `training_step` and `validation_step`. This value does not match the lo... | [
{
"body": "## 📚 Documentation\r\n\r\nSome of the callback entry points/hooks (e.g. `on_train_batch_end`) have an `outputs` argument that contains the loss returned from the `training_step` and `validation_step`. This value does not match the loss in the trainer when `accumulate_grad_batches` > 1. I spoke with ... | c39c8eb2e4f49e35ef38a2ae6de2765ec71623db | {
"head_commit": "0d789eda2dd1304ae0ae5a7609831f783b19468b",
"head_commit_message": "Update src/pytorch_lightning/core/module.py\n\nCo-authored-by: Rohit Gupta <rohitgr1998@gmail.com>",
"patch_to_review": "diff --git a/docs/source-pytorch/extensions/callbacks.rst b/docs/source-pytorch/extensions/callbacks.rst\nin... | [
{
"diff_hunk": "@@ -138,6 +138,11 @@ Callback API\n ************\n Here is the full API of methods available in the Callback base class.\n \n+.. note::\n+\n+ Outputs: Hooks that occur on batch end (e.g. ``on_train_batch_end``) will receive any values returned from that step (such as the loss) in the form of ... | c3db86d239067b665a449b5efc67ce4439a86099 | diff --git a/src/pytorch_lightning/callbacks/callback.py b/src/pytorch_lightning/callbacks/callback.py
index 2f2ee174144c9..400d45d3b6e55 100644
--- a/src/pytorch_lightning/callbacks/callback.py
+++ b/src/pytorch_lightning/callbacks/callback.py
@@ -82,7 +82,12 @@ def on_train_batch_start(
def on_train_batch_end(
... | {
"difficulty": "low",
"estimated_review_effort": 1,
"problem_domain": "Documentation Updates"
} | |
Lightning-AI__pytorch-lightning-14945@5659743 | Lightning-AI/pytorch-lightning | Python | 14,945 | Close profiler when `StopIteration` is raised | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2022-09-29T13:34:02Z | Profiler doesn't stop action upon epoch end when using IterableDataset with no __len__
### First check
- [X] I'm sure this is a bug.
- [X] I've added a descriptive title to this bug.
- [X] I've provided clear instructions on how to reproduce the bug.
- [X] I've added a code sample.
- [X] I've provided any other ... | [
{
"body": "### First check\r\n\r\n- [X] I'm sure this is a bug.\r\n- [X] I've added a descriptive title to this bug.\r\n- [X] I've provided clear instructions on how to reproduce the bug.\r\n- [X] I've added a code sample.\r\n- [X] I've provided any other important info that is required.\r\n\r\n### Bug descript... | d7af8ce2a5fd0aa3c0d69fedb5fbabd0e1be09f5 | {
"head_commit": "5659743ba6547dd7c1f678dd57fa9776af113b0d",
"head_commit_message": "removed diskcache import",
"patch_to_review": "diff --git a/src/pytorch_lightning/utilities/fetching.py b/src/pytorch_lightning/utilities/fetching.py\nindex 5dd068af5340d..912ba08f55ec4 100644\n--- a/src/pytorch_lightning/utiliti... | [
{
"diff_hunk": "@@ -276,14 +276,18 @@ def fetching_function(self) -> Any:\n \n def _fetch_next_batch(self, iterator: Iterator) -> None:\n start_output = self.on_fetch_start()\n- batch = next(iterator)\n- self.fetched += 1\n- if not self.prefetch_batches and self._has_len:\n- ... | 2119a187c1d0043c3ab9322dbadfeaad86b0f36e | diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md
index b8c042058bb24..65e6210b8d0f3 100644
--- a/src/pytorch_lightning/CHANGELOG.md
+++ b/src/pytorch_lightning/CHANGELOG.md
@@ -300,6 +300,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- `SaveCo... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
Lightning-AI__pytorch-lightning-14857@1137f33 | Lightning-AI/pytorch-lightning | Python | 14,857 | Update precision input type annotations | ## What does this PR do?
Requested by @carmocca in #14792
The changes can't be carried out just in Lite, because PL imports the precision classes and requires them to be consistent in the types.
Fixes #16011
## Before submitting
- [x] Was this discussed/approved via a GitHub issue? (not for typos and docs... | 2022-09-22T23:19:35Z | precision parameter in Trainer does not accept "16" passed as str
### Bug description
When you try to create Trainer with wrong value for `precision` it provides correct values as:
```
MisconfigurationException("Precision '<wrong value>' is invalid. Allowed precision values: ('16', '32', '64', 'bf16')")
```
Th... | I guess this is due to this line:
https://github.com/Lightning-AI/lightning/blob/6aaac8b910e6c101ea3d62e3f2a5576c07a214b6/src/pytorch_lightning/trainer/connectors/accelerator_connector.py#L708
```
if self._precision_flag in (16, "bf16"):
```
It should probably be something like:
```
if str(self._precision_fl... | [
{
"body": "### Bug description\r\n\r\nWhen you try to create Trainer with wrong value for `precision` it provides correct values as:\r\n```\r\nMisconfigurationException(\"Precision '<wrong value>' is invalid. Allowed precision values: ('16', '32', '64', 'bf16')\")\r\n```\r\n\r\nThis indicate that the values are... | 6bf6540ee5e3503e8a93abbae4756f131b400496 | {
"head_commit": "1137f33f9c8288c717b47db6a31d18399d923e1c",
"head_commit_message": "Apply the same changes to PL",
"patch_to_review": "diff --git a/src/lightning_fabric/connector.py b/src/lightning_fabric/connector.py\nindex 9fb4fe09f6ec3..80c1fd46f173c 100644\n--- a/src/lightning_fabric/connector.py\n+++ b/src/... | [
{
"diff_hunk": "@@ -30,7 +30,7 @@ class Precision:\n The class attribute precision must be overwritten in child classes. The default value reflects fp32 training.\n \"\"\"\n \n- precision: _PRECISION_INPUT = \"32\"\n+ precision: \"lf.connector._PRECISION_INPUT\" = \"32\"",
"line": null,
"o... | 72dd3015494ea9aff367cafecd1ab94583129259 | diff --git a/src/lightning_fabric/connector.py b/src/lightning_fabric/connector.py
index 9fb4fe09f6ec3..aa09d58f9d477 100644
--- a/src/lightning_fabric/connector.py
+++ b/src/lightning_fabric/connector.py
@@ -13,10 +13,10 @@
# limitations under the License.
import os
from collections import Counter
-from typing impo... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-14282@23f9789 | Lightning-AI/pytorch-lightning | Python | 14,282 | adding CI for e2e on Azure | ## What does this PR do?
REsolves #13927
## Before submitting
- [x] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [x] Did you read the [contributor guideline](https://github.com/Lightning-AI/lightning/blob/master/.github/CONTRIBUTING.md), **Pull Request** section?
- [x] Did y... | 2022-08-18T12:41:51Z | Run app cloud CI e2e tests on PRs from forks
## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->
Run app cloud CI e2e tests on PRs from forks.
### Motivation
Currently, the cloud e2e tests require secrets to run and because the secrets (e.g. lightning_user_id/ lightning_api_key) a... | Let's do it! We would like to start merging community PRs as soon as possible. Example: https://github.com/Lightning-AI/lightning/pull/13531 | [
{
"body": "## 🚀 Feature\r\n\r\n<!-- A clear and concise description of the feature proposal -->\r\n\r\nRun app cloud CI e2e tests on PRs from forks.\r\n\r\n### Motivation\r\n\r\nCurrently, the cloud e2e tests require secrets to run and because the secrets (e.g. lightning_user_id/ lightning_api_key) are not sha... | 4c47619f38331e4a2c13c0562e5c46500cfd3d70 | {
"head_commit": "23f978917cc7a4c506b57ae5e07a182de8c0d833",
"head_commit_message": "cache",
"patch_to_review": "diff --git a/.azure/app-cloud-e2e.yml b/.azure/app-cloud-e2e.yml\nnew file mode 100644\nindex 0000000000000..dba64eba28a12\n--- /dev/null\n+++ b/.azure/app-cloud-e2e.yml\n@@ -0,0 +1,127 @@\n+# Python p... | [
{
"diff_hunk": "@@ -0,0 +1,127 @@\n+# Python package\n+# Create and test a Python package on multiple Python versions.\n+# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:\n+# https://docs.microsoft.com/azure/devops/pipelines/languages/python\n+\n+t... | 71ebb238c887ef67a31300cffcfa753769498baa | diff --git a/.azure/app-cloud-e2e.yml b/.azure/app-cloud-e2e.yml
new file mode 100644
index 0000000000000..d5aeee88c020a
--- /dev/null
+++ b/.azure/app-cloud-e2e.yml
@@ -0,0 +1,140 @@
+# Python package
+# Create and test a Python package on multiple Python versions.
+# Add steps that analyze code, save the dist with th... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Test Suite / CI Enhancements"
} |
Lightning-AI__pytorch-lightning-15246@c21398b | Lightning-AI/pytorch-lightning | Python | 15,246 | Add support for logging the model checkpoints to MLFlowLogger | ## What does this PR do?
This PR adds a log_model parameter to MLFlowLogger as the one in WandbLogger (#9138).
The log_model parameter can be set to:
- "all": checkpoints are logged during training.
- True: checkpoints are logged at the end of training, except when
`:paramref: '~pytorch_lightning.callbacks.mode... | 2022-10-22T12:56:47Z | Add the WandbLogger log_model parameter to MLFLowLogger
## 🚀 Feature
At the moment I am using both MLFlowLogger and WandbLogger, and I realized that MLFlowLogger is missing the log_model parameter (I also quickly checked the other loggers and it seems that WandbLogger is the only one having this parameter). Will it... | haven't tried, but mlflow does support logging artifacts/models, so this seems like a good addition.
https://www.mlflow.org/docs/latest/python_api/mlflow.pytorch.html
https://www.mlflow.org/docs/latest/python_api/mlflow.html#mlflow.log_artifact (with lightning example)
Dear @AlessioQuercia,
Would you be interested... | [
{
"body": "## 🚀 Feature\r\n\r\nAt the moment I am using both MLFlowLogger and WandbLogger, and I realized that MLFlowLogger is missing the log_model parameter (I also quickly checked the other loggers and it seems that WandbLogger is the only one having this parameter). Will it be possible to add the log_model... | 1a31d13521fb54a210b302e7bad2b9eb0b2b60b4 | {
"head_commit": "c21398bb5208b2f7fd6efbcb74ea3dbeb5175267",
"head_commit_message": "Updated CHANGELOG",
"patch_to_review": "diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md\nindex 5f687de11a8da..a6896c11b18bb 100644\n--- a/src/pytorch_lightning/CHANGELOG.md\n+++ b/src/pytorch_... | [
{
"diff_hunk": "@@ -108,6 +113,13 @@ def any_lightning_module_function_or_hook(self):\n save_dir: A path to a local directory where the MLflow runs get saved.\n Defaults to `./mlflow` if `tracking_uri` is not provided.\n Has no effect if `tracking_uri` is provided.\n+ log_... | d561a7f2c0e6e4e9ad7c25180ba3e4f52ca39a57 | diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md
index 976ea6d056d7f..4f85b5223fcd5 100644
--- a/src/pytorch_lightning/CHANGELOG.md
+++ b/src/pytorch_lightning/CHANGELOG.md
@@ -21,6 +21,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Add an axe... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-13658@b2de2e6 | Lightning-AI/pytorch-lightning | Python | 13,658 | Add support for async checkpointing | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2022-07-14T16:37:16Z | Asynchronous checkpointing
## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->
The idea is to enable asynchronous model checkpointing during training.
### Motivation
I'm training thousands of small identical `gpytorch` models, each one is trained for 1000 epochs on a different 1d time seri... | I believe you would have a second process with a queue responsible to checkpoint the model weights. This could be done directly within a custom ModelCheckpoint.
When you say "saving the model" are you referring precisely to the IO operations to save and delete? If so, we could create a IO plugin that can work asynchron... | [
{
"body": "## 🚀 Feature\n\n<!-- A clear and concise description of the feature proposal -->\nThe idea is to enable asynchronous model checkpointing during training.\n\n### Motivation\n\nI'm training thousands of small identical `gpytorch` models, each one is trained for 1000 epochs on a different 1d time serie... | 6a9d626e189038f09a0cf7157f61e75300ea99cc | {
"head_commit": "b2de2e67dfb646c5b310ac20610bd733af567823",
"head_commit_message": "update docs",
"patch_to_review": "diff --git a/docs/source-pytorch/api_references.rst b/docs/source-pytorch/api_references.rst\nindex 96a061a941b57..db4fc1e2c4cf8 100644\n--- a/docs/source-pytorch/api_references.rst\n+++ b/docs/s... | [
{
"diff_hunk": "@@ -0,0 +1,68 @@\n+# Copyright The PyTorch Lightning team.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE... | c12920686b8561b503a88f5c5d0572b69cd709a9 | diff --git a/docs/source-pytorch/api_references.rst b/docs/source-pytorch/api_references.rst
index 96a061a941b57..db4fc1e2c4cf8 100644
--- a/docs/source-pytorch/api_references.rst
+++ b/docs/source-pytorch/api_references.rst
@@ -210,6 +210,7 @@ io
:nosignatures:
:template: classtemplate.rst
+ AsyncCheckp... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-14976@82a50db | Lightning-AI/pytorch-lightning | Python | 14,976 | Fix LightningCLI docs after overhaul of the documentation | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2022-10-03T11:02:59Z | Suggestions to improve LightningCLI documentation
## 📚 Documentation
With the recent complete overhaul of the documentation where things were split into expertise levels, some parts now seem misplaced or even incorrect. Here are a few suggestions to improve the documentation related to LightningCLI.
- The first... | The proposed changes look good to me. You can go ahead and open a PR
This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team! | [
{
"body": "## 📚 Documentation\r\n\r\nWith the recent complete overhaul of the documentation where things were split into expertise levels, some parts now seem misplaced or even incorrect. Here are a few suggestions to improve the documentation related to LightningCLI. \r\n\r\n- The first issue that I see is th... | 324705406728d957e2e9ef09803b5a448efdb6f4 | {
"head_commit": "82a50dbb031ff4791e636a8f496483b86da968e0",
"head_commit_message": "- Fix diverse issues introduced when the documentation was restructured.\n- Change the docs to be focused on configure hyperparameters instead of reduction of bolierplate.",
"patch_to_review": "diff --git a/docs/source-pytorch/cl... | [
{
"diff_hunk": "@@ -122,39 +111,37 @@ The Lightning CLI can convert every possible CLI flag into an environment variab\n \n .. code:: python\n \n- LightningCLI(env_parse=True)\n+ cfg = LightningCLI(DemoModel, run=False, env_parse=True)",
"line": null,
"original_line": 114,
"original_start_line... | 7ced43114d0b44e8deadda56b5918f613eed50aa | diff --git a/docs/source-pytorch/cli/lightning_cli.rst b/docs/source-pytorch/cli/lightning_cli.rst
index a0933b447ad31..5b0bf73754db3 100644
--- a/docs/source-pytorch/cli/lightning_cli.rst
+++ b/docs/source-pytorch/cli/lightning_cli.rst
@@ -2,9 +2,25 @@
.. _lightning-cli:
-############################
-Eliminate c... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Documentation Updates"
} |
Lightning-AI__pytorch-lightning-13154@4b3e3fc | Lightning-AI/pytorch-lightning | Python | 13,154 | Avoid changing the current cudnn.benchmark value | ## What does this PR do?
Re-land of https://github.com/PyTorchLightning/pytorch-lightning/pull/12020
Fixes https://github.com/PyTorchLightning/pytorch-lightning/issues/12713
### Does your PR introduce any breaking changes? If yes, please list them.
Benchmark now defaults to `False`, as it was in v1.5
## Be... | 2022-05-25T17:06:02Z | v1.6 is slower than v1.5
## 🐛 Bug
### 1.6.0 is 5 times slower than 1.5.0
I used the same code and parameters on version 1.5.0 and version 1.6.0.
1.6.0 is 5 times slower than 1.5.0.
### To Reproduce
#### 1.6.0
```
> pip install pytorch-lightning==1.6.0
...
> python run.py
{'optimizers': {'lr': 0.001, 'w... | I found that the loss received backward func on 1.6.0 was 2^16 times the loss returned by training_step func.
This is not the case in 1.5.0, the loss received backward func is equal to the loss returned by training_step func.
is it possible for you to share the script?
https://github.com/flyinghu123/pvnet-pl
> is i... | [
{
"body": "## 🐛 Bug\r\n\r\n### 1.6.0 is 5 times slower than 1.5.0\r\n\r\nI used the same code and parameters on version 1.5.0 and version 1.6.0.\r\n1.6.0 is 5 times slower than 1.5.0.\r\n\r\n### To Reproduce\r\n#### 1.6.0\r\n```\r\n> pip install pytorch-lightning==1.6.0\r\n...\r\n> python run.py\r\n{'optimizer... | 37804078bb9a882ac9947a6e99f3dc9f6167a989 | {
"head_commit": "4b3e3fc34638d86431ceafe4f899d85d0887f0d0",
"head_commit_message": "Avoid changing current cudnn benchmark",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex cbc513279f27a..cfbf076e4e189 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -97,7 +97,10 @@ The format is based on [... | [
{
"diff_hunk": "@@ -642,12 +642,15 @@ def test_trainer_max_steps_accumulate_batches(tmpdir):\n @pytest.mark.parametrize(\n [\"benchmark_\", \"deterministic\", \"expected\"],\n [\n- (None, False, True),\n+ (None, False, None),\n (None, True, False),\n+ (None, None, None),\n ... | 177752c584b4a13b86cbb738e78275748a49994d | diff --git a/CHANGELOG.md b/CHANGELOG.md
index a8afc6ed53ef5..df5a630d4afd2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -97,7 +97,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Changed `pytorch_lightning.core.lightning` to `pytorch_lightning.core.module` ([#12740](https://g... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Performance Optimizations"
} |
Lightning-AI__pytorch-lightning-13892@c3cb366 | Lightning-AI/pytorch-lightning | Python | 13,892 | Validate the model input of trainer methods | ## What does this PR do?
Fixes #13355
Partially addresses #13981
When passing something other than a LightningModule to the Trainer, we currently get a misleading error message that doesn't help the user find the issue. Now I'm adding a check to all the Trainer methods that need a LightningModule.
## Befor... | 2022-07-27T19:38:38Z | TypeError: Unwrapping the module did not yield a `LightningModule`
I am following the tutorial of MNIST, and I passed a pretrained model from timm, and I got this error.
I am using default strategy and backend.
```py
`Traceback (most recent call last):
File "train.py", line 172, in <module>
train(args)
... | @ychenZHANG thanks for the issue. Could you maybe update your snippet a bit? What I am looking for is the class of the model (e.g which timm model you used) as well as your instantiation of the trainer. This would make it significantly easier to debug this :)
I am having the same issue:
`model = BartForConditionalGen... | [
{
"body": "I am following the tutorial of MNIST, and I passed a pretrained model from timm, and I got this error.\r\n\r\nI am using default strategy and backend.\r\n\r\n```py\r\n`Traceback (most recent call last):\r\n File \"train.py\", line 172, in <module>\r\n train(args)\r\n File \"train.py\", line 163,... | 9651e420c8cbed025dd0629c9f347b6e7b9c0220 | {
"head_commit": "c3cb366e36d9b34607c980a22291fd3e6c0f18d3",
"head_commit_message": "Merge remote-tracking branch 'origin/bugfix/trainer-method-error' into bugfix/trainer-method-error",
"patch_to_review": "diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md\nindex baf01371fb8bc..3... | [
{
"diff_hunk": "@@ -170,6 +170,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).\n - Disallowed using `BatchSampler` when running on multiple IPUs ([#13854](https://github.com/PyTorchLightning/pytorch-lightning/pull/13854))\n \n \n+- The `Trainer.{fit,validate,test,tune}` meth... | b0e6906c37f5ce5b72ae85f03bb068b5885a3c6e | diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md
index a95a88a420840..05c7cda5d7242 100644
--- a/src/pytorch_lightning/CHANGELOG.md
+++ b/src/pytorch_lightning/CHANGELOG.md
@@ -16,7 +16,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Change... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-12915@21aa67d | Lightning-AI/pytorch-lightning | Python | 12,915 | [FIX] ShardedGradScaler should only be set for FP16 | ## What does this PR do?
Closes #12914
When running with sharded training + bf16, I noticed that the ShardedGradScaler was being passed. This is incorrect as BF16 does not require any scaling logic. Fixed this and added a unit test!
## Before submitting
- [x] Was this **discussed/approved** via a GitHub iss... | 2022-04-28T10:14:52Z | ShardedGradScaler should not be used in BF16
## 🐛 Bug
The ShardedGradScaler is being passed in when the precision is set to BF16.
```bash
from pytorch_lightning.plugins import ShardedNativeMixedPrecisionPlugin
plugin = ShardedNativeMixedPrecisionPlugin(precision="bf16", device="cuda")
Traceback (most rec... | [
{
"body": "## 🐛 Bug\r\n\r\nThe ShardedGradScaler is being passed in when the precision is set to BF16.\r\n\r\n```bash\r\nfrom pytorch_lightning.plugins import ShardedNativeMixedPrecisionPlugin\r\n\r\nplugin = ShardedNativeMixedPrecisionPlugin(precision=\"bf16\", device=\"cuda\")\r\n\r\nTraceback (most recent c... | 98b206e83638f5e0586883a87f053feb81d85a23 | {
"head_commit": "21aa67d91a087468c19c01f796251822561686cd",
"head_commit_message": "Add CHANGELOG.md",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex 9c4d8421ee95f..d91e142a7eed5 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -147,7 +147,7 @@ The format is based on [Keep a Changelog](htt... | [
{
"diff_hunk": "@@ -0,0 +1,42 @@\n+# Copyright The PyTorch Lightning team.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE... | e707d79f3f46ff8458b81437413a96aac8ebac45 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c4d8421ee95f..d91e142a7eed5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -147,7 +147,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed an issue to ensure all the checkpoint states are saved in a common filepath with `Deepspee... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
Lightning-AI__pytorch-lightning-13262@f626bca | Lightning-AI/pytorch-lightning | Python | 13,262 | Fix erroneous UserWarning for unset max_epochs | ## What does this PR do?
Fixes #13257. @akihironitta
Now the warning is raised only during `trainer.fit` call.
### Does your PR introduce any breaking changes? If yes, please list them.
None
## Before submitting
- [x] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [x] ... | 2022-06-09T17:46:45Z | Erroneous UserWarning for unset max_epochs
## 🐛 Bug
When I use:
```python
Trainer(fast_dev_run=True)
```
I see the following warning:
```
pytorch_lightning.utilities.warnings.PossibleUserWarning: `max_epochs` was not set. Setting it to 1000 epochs. To train without an epoch limit, set `max_epochs=-1`.
```
... | @adamjstewart Thank you for submitting the issue!
I don't have a strong preference, but I find it reasonable to raise the warning even when `fast_dev_run` is specified because one will have to deal with the warning anyway once `fast_dev_run` is disabled. :eyes:
In my case, this is inside a unit test, so `fast_dev_ru... | [
{
"body": "## 🐛 Bug\r\n\r\nWhen I use:\r\n```python\r\nTrainer(fast_dev_run=True)\r\n```\r\nI see the following warning:\r\n```\r\npytorch_lightning.utilities.warnings.PossibleUserWarning: `max_epochs` was not set. Setting it to 1000 epochs. To train without an epoch limit, set `max_epochs=-1`.\r\n```\r\nHowev... | ee4233b36cb70b19a13013371ada50875b429ef3 | {
"head_commit": "f626bca6e70ee5d73ef8c7d1d77adc79a4bcdd6f",
"head_commit_message": "Merge branch 'master' into fixes/fast-dev-run",
"patch_to_review": "diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md\nindex aa66df9b54a8b..bc8fa846c3e9e 100644\n--- a/src/pytorch_lightning/CHAN... | [
{
"diff_hunk": "@@ -1138,6 +1132,12 @@ def _run(\n # ----------------------------\n # TRAIN\n # ----------------------------\n+ if self.state.fn in (TrainerFn.FITTING, TrainerFn.TUNING):\n+ min_epochs, max_epochs = _parse_loop_limits(\n+ self.min_steps, s... | 686198f7be4e0f130485e7f264681abf0a3046a5 | diff --git a/src/pytorch_lightning/CHANGELOG.md b/src/pytorch_lightning/CHANGELOG.md
index 1ce0810e114f3..8676d3f44c54a 100644
--- a/src/pytorch_lightning/CHANGELOG.md
+++ b/src/pytorch_lightning/CHANGELOG.md
@@ -43,6 +43,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed the ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-12897@eef98b2 | Lightning-AI/pytorch-lightning | Python | 12,897 | Fix number of references to LightningModule | ## What does this PR do?
I know, this looks way too hacky, the proposal in bug report proposes to deal with it in `__del__` method. Problem is, the `__del__` method will never be called, exactly because of this issue, because there will always be an internal reference to self. There will be accompanying PR to pytorc... | 2022-04-27T09:19:19Z | sys.getrefcount() of a LightningModule
## 🐛 Bug
When creating a `LightningModule`, `sys.getrefcount()` returns 3 (vs. returning 2 for a conventional torch `Module`). In my particular case, for instance, this results in memory issues: even if I explicitly do `del <LightningModule>`, the memory is not released, and I... | This is caused by this call in the `__init__`: https://github.com/PyTorchLightning/pytorch-lightning/blob/de085f30f05512862d970e1675536b4c70199d27/pytorch_lightning/core/lightning.py#L115 concretely, this line where we call a sharded internal method: https://github.com/PyTorchLightning/pytorch-lightning/blob/de085f30f0... | [
{
"body": "## 🐛 Bug\r\n\r\nWhen creating a `LightningModule`, `sys.getrefcount()` returns 3 (vs. returning 2 for a conventional torch `Module`). In my particular case, for instance, this results in memory issues: even if I explicitly do `del <LightningModule>`, the memory is not released, and I believe this is... | 01df4543f602512a402eae4b8c15b93033de4ec4 | {
"head_commit": "eef98b2ff38478c7411cd8ab775321cc6daefdde",
"head_commit_message": "Update tests/core/test_lightning_module.py\n\nCo-authored-by: Rohit Gupta <rohitgr1998@gmail.com>",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex b84a24b71f3d9..41e434b0f6fa1 100644\n--- a/CHANGELOG.md\n+++ ... | [
{
"diff_hunk": "@@ -1976,4 +1977,6 @@ def _register_sharded_tensor_state_dict_hooks_if_available(self) -> None:\n from torch.distributed._sharded_tensor import pre_load_state_dict_hook, state_dict_hook\n \n self._register_state_dict_hook(state_dict_hook)\n- self._register_load_state_dict_... | 03bf773459505f1b7eef9921185f4769247bc7dd | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 78f3c812ef0ef..fdb5df837c09a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -200,6 +200,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed an issue with unsupported torch.inference_mode() on hpu backends by making it use no_grad ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-12377@cceaede | Lightning-AI/pytorch-lightning | Python | 12,377 | Fix _module_available to detect horovod.torch properly | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2022-03-19T16:58:23Z | _module_available does not correctly check child modules
## 🐛 Bug
I tried to use horovod accelerator which is correctly installed in my environment, as I can `import horovod.torch` without any problem but I get an error stating that horovod is not installed. I checked the source code to see how module availability ... | [
{
"body": "## 🐛 Bug\r\n\r\nI tried to use horovod accelerator which is correctly installed in my environment, as I can `import horovod.torch` without any problem but I get an error stating that horovod is not installed. I checked the source code to see how module availability was checked and was surprised to s... | ef8f49a6e09071dac50b689ef69375d8d5ad928d | {
"head_commit": "cceaede88c2b1331c7797e056d14981d27737633",
"head_commit_message": "Merge branch 'master' into simplify-module-checks",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex 0126950f2697b..864c8daee7133 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -923,6 +923,7 @@ The format i... | [
{
"diff_hunk": "@@ -45,3 +54,48 @@ def test_compare_version(monkeypatch):\n assert not _compare_version(\"torch\", operator.ge, \"1.10.0.rc0\")\n assert _compare_version(\"torch\", operator.ge, \"1.10.0\", use_base_version=True)\n assert not _compare_version(\"torch\", operator.ge, \"1.10.0\")\n+\n+... | 3fdff8f45467cbbbf05d97baa5a87c25d53a632e | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0126950f2697b..864c8daee7133 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -923,6 +923,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed initializing optimizers unnecessarily in `DDPFullyShardedStrategy` ([#12267](https://git... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
Lightning-AI__pytorch-lightning-13224@81fd4ad | Lightning-AI/pytorch-lightning | Python | 13,224 | DummyLogger can be called with unknown methods | ## What does this PR do?
This PR overrides the `__getattr__` method of the `DummyLogger` class, such that an unkown method calls due to external
loggers do not cause an `AttributeError` but return a dummy method and print information about the call to a non-existing method.
Fixes #13203
### Does your PR int... | 2022-06-03T16:08:58Z | DummyLogger AttributeError when calling WandbLogger methods with fast_dev_run
## 🐛 Bug
When using the `fast_dev_run` flag `pytorch-lightning` replaces the logger with a `DummyLogger` object. But with a WandbLogger I also log media with `self.logger.log_text` in my pl module. I therefore get an AttributeError that th... | This suggestion makes sense to me. But it should still print a warning that "The DummyLogger is being used and the method `log_text` was called on it but it does not exist."
I could take over this, if it is okay | [
{
"body": "## 🐛 Bug\r\nWhen using the `fast_dev_run` flag `pytorch-lightning` replaces the logger with a `DummyLogger` object. But with a WandbLogger I also log media with `self.logger.log_text` in my pl module. I therefore get an AttributeError that the DummyLogger does not have the attribute `log_text`. \r\... | c600f987c2f101ac7847dca61721923f109e0af1 | {
"head_commit": "81fd4ad8b3c81786734cc7d953346fedbadbaa06",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/pytorch_lightning/loggers/logger.py b/pytorch_lightning/loggers/logger.py\nindex e9f7c165d... | [
{
"diff_hunk": "@@ -346,6 +346,16 @@ def __iter__(self):\n # if DummyLogger is substituting a logger collection, pretend it is empty\n yield from ()\n \n+ def __getattr__(self, name):\n+ \"\"\"Allows the DummyLogger to be called with arbitrary methods, to avoid AttributeErrors.\"\"\"\n... | cf08c4fe391b221510916ae54ecb21159cdccc3c | diff --git a/CHANGELOG.md b/CHANGELOG.md
index d2590a70e021e..a296edccb324c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -74,6 +74,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
-
+
+- Added support for calling unknown methods with `DummyLogger` ([#13224](https://github.com... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-11711@8300d72 | Lightning-AI/pytorch-lightning | Python | 11,711 | Return the output of the optimizer step | ## What does this PR do?
Fixes #5235
### Does your PR introduce any breaking changes? If yes, please list them.
None
## Before submitting
- [x] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [x] Did you read the [contributor guideline](https://github.com/PyTorchLightning/... | 2022-02-03T05:01:47Z | Lighting wrapped optimizers do not allow return values
This is both a bug report /feature request:
Any optimizer.step function might have a return value. However, NO return values are currently handled by the optimizer.LightningOptimizer class in the "step" function. Optimizers with return values in their step func... | Hi! thanks for your contribution!, great first issue!
Dear @thoglu,
Thanks for reporting this bug :)
We will address it soon.
Best regards,
T.C
Hi I wanted to take a look at this but have a couple of questions.
1. What would be the typical use case for returning a value from the step function? Basic torch o... | [
{
"body": "This is both a bug report /feature request:\r\n\r\nAny optimizer.step function might have a return value. However, NO return values are currently handled by the optimizer.LightningOptimizer class in the \"step\" function. Optimizers with return values in their step function therefore do not operate ... | d43fd0d4d61cce149f655a3ceb4efdd98fcf04e1 | {
"head_commit": "8300d72b5ffb3020fbb1f09f896dec870ea3a890",
"head_commit_message": "Skip validaiton",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex c9d862bfe65c1..ac98ac375c4f4 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -75,6 +75,9 @@ The format is based on [Keep a Changelog](http:/... | [
{
"diff_hunk": "@@ -56,7 +56,7 @@ def state_dict(self) -> Dict[str, Tensor]:\n \n def step(self, closure: Optional[Callable] = None) -> None:",
"line": null,
"original_line": 57,
"original_start_line": null,
"path": "pytorch_lightning/lite/wrappers.py",
"start_line": null,
"text": "@... | ac87d9967a333228d8fc1ace1015d473c78410e0 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index c9d862bfe65c1..ac98ac375c4f4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -75,6 +75,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `opt_idx` to scheduler config if not assigned by user ([#11247](https://github.com/PyTorchLi... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-12088@6608293 | Lightning-AI/pytorch-lightning | Python | 12,088 | Fix `LightningModule.{un,}toggle_model` when only 1 optimizer is used | ## What does this PR do?
Fixes #12086.
### Does your PR introduce any breaking changes? If yes, please list them.
<!-- FILL IN or None -->
## Before submitting
- [x] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [ ] Did you read the [contributor guideline](https://github.c... | 2022-02-24T08:50:19Z | "object is not iterable" in lightning.toggle_optimizer when using single optimizer
## 🐛 Bug
Error thrown when calling optimizer.toggle_model(...) where only one optimizer is used in manual optimization mode.
This is caused by LightningModule.optimizers(...) trying to return the optimizer but not a list in this scena... | [
{
"body": "## 🐛 Bug\r\nError thrown when calling optimizer.toggle_model(...) where only one optimizer is used in manual optimization mode.\r\nThis is caused by LightningModule.optimizers(...) trying to return the optimizer but not a list in this scenario.\r\n\r\n### To Reproduce\r\n```\r\nimport torch\r\nimpor... | 1fa0639bcaf4a5ab058178b284c52ce5c13c1ca3 | {
"head_commit": "6608293189160e8946f399e81fc14ca86ca50367",
"head_commit_message": "Make optimizers iterable in toggle_optimizer and untoggle_optimizer",
"patch_to_review": "diff --git a/pytorch_lightning/core/lightning.py b/pytorch_lightning/core/lightning.py\nindex e9c129c09b57c..e4065ccaf69f4 100644\n--- a/py... | [
{
"diff_hunk": "@@ -1400,7 +1403,10 @@ def untoggle_optimizer(self, optimizer_idx: int) -> None:\n Args:\n optimizer_idx: The index of the optimizer to untoggle.\n \"\"\"\n- for opt_idx, opt in enumerate(self.optimizers(use_pl_optimizer=False)):\n+ opts = self.optimizer... | ff547b698009334cdb1976ba94031d9d51962506 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd552c8c42469..89db6d26d4c87 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -623,6 +623,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed the mid-epoch warning call while resuming training ([#11556](https://github.com/PyTorchLig... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
Lightning-AI__pytorch-lightning-11716@72d3d62 | Lightning-AI/pytorch-lightning | Python | 11,716 | WandbLogger's log_image can use step argument | ## What does this PR do?
Makes WandbLogger's log_image compatible with the step argument.
Fixes #11703
### Does your PR introduce any breaking changes? If yes, please list them.
None
## Before submitting
- [x] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [x] Did you ... | 2022-02-03T09:46:36Z | Using the step argument raises an error for WandbLogger's log_image
## 🐛 Bug
When using the WandbLogger log_image method, adding the step argument raises an error:
```
File "/home/nathan/work/these/engine/venv/lib/python3.8/site-packages/pytorch_lightning/loggers/wandb.py", line 417, in log_image
if len(v)... | hey @NathanGodey
good catch! mind send a PR? | [
{
"body": "## 🐛 Bug\r\n\r\nWhen using the WandbLogger log_image method, adding the step argument raises an error:\r\n```\r\n File \"/home/nathan/work/these/engine/venv/lib/python3.8/site-packages/pytorch_lightning/loggers/wandb.py\", line 417, in log_image\r\n if len(v) != n:\r\nTypeError: object of type '... | d132a9c3b73bad3e893f809a53401722087bec5e | {
"head_commit": "72d3d62b495365e4709326fc7180627b2d60fda4",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/pytorch_lightning/loggers/wandb.py b/pytorch_lightning/loggers/wandb.py\nindex ee1b1b9e948... | [
{
"diff_hunk": "@@ -413,11 +413,11 @@ def log_image(self, key: str, images: List[Any], **kwargs: str) -> None:\n \"\"\"\n if not isinstance(images, list):\n raise TypeError(f'Expected a list as \"images\", found {type(images)}')\n+ step = kwargs.pop(\"step\", None)",
"line... | 1af4641c7223f83fb1feb239d402f6fd32bfae8f | diff --git a/CHANGELOG.md b/CHANGELOG.md
index afb7c55dc9794..0d90c6dd3701d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -521,6 +521,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed an issue to avoid validation loop run on restart ([#11552](https://github.com/PyTorchLight... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-12653@d72bbd4 | Lightning-AI/pytorch-lightning | Python | 12,653 | Enforce eval shuffle warning only for default samplers | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2022-04-07T10:54:12Z | Even when val DataLoader has shuffle=False, Lightning gives an incorrect warning that val Dataloader has shuffle=True
## 🐛 Bug
Even when DataLoader(self.valid_data, shuffle=False, ...), Lightning gives the following message: UserWarning: Your `val_dataloader` has `shuffle=True`,.......
### To Reproduce
Assign s... | Can you reproduce it by modifying the following script?
https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pl_examples/bug_report/bug_report_model.py
.local/lib/python3.8/site-packages/pytorch_lightning/trainer/data_loading.py:659 has a code as follows:
> def _check_eval_shuffling(dataloader, m... | [
{
"body": "## 🐛 Bug\r\nEven when DataLoader(self.valid_data, shuffle=False, ...), Lightning gives the following message: UserWarning: Your `val_dataloader` has `shuffle=True`,.......\r\n\r\n### To Reproduce\r\nAssign shuffle=False in both the val and test dataloaders. Run the code and see the following two w... | 0e4c4424fd2aa9528a20db7873c9adb9b9ba7465 | {
"head_commit": "d72bbd42d1b07ddd7303432f6885979521e9560b",
"head_commit_message": "Merge branch 'master' into ref/eval_warning",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex 4037dd3632379..6995bba82e9ad 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -91,6 +91,9 @@ The format is based ... | [
{
"diff_hunk": "@@ -460,7 +460,12 @@ def replace_sampler(dataloader: DataLoader) -> DataLoader:\n \n @staticmethod\n def _check_eval_shuffling(dataloader, mode):\n- if _is_dataloader_shuffled(dataloader):\n+ # limit this warning only for samplers assigned automatically when shuffle is set\... | 968b5f4d68acac9e9c7f1b37bbcac29ceaf3311a | diff --git a/CHANGELOG.md b/CHANGELOG.md
index c8e34cbf40713..5356fec18cba5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -152,6 +152,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed an issue to ensure all the checkpoint states are saved in a common filepath with `Deepspee... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-12030@258f587 | Lightning-AI/pytorch-lightning | Python | 12,030 | Add support for pluggable Accelerators | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2022-02-21T09:58:23Z | Import error when trying to run TPU accelerator on CPU
## 🐛 Bug
<!-- A clear and concise description of the bug. -->
### To Reproduce
```py
import os
import torch
from torch.utils.data import DataLoader, Dataset
from pytorch_lightning import LightningModule, Trainer
class RandomDataset(Dataset)... | Likely a result of #11448 cc @four4fish
It would be fixed by the updates added in #12030, and I have moved the parsing logic to the accelerators.
But would do a quick PR for a fix for it
Yeah, this is the follow up item "Enable accelerator.is_available() check" in #11449
The proper way is to call `accelerator.is_av... | [
{
"body": "## 🐛 Bug\r\n\r\n<!-- A clear and concise description of the bug. -->\r\n\r\n### To Reproduce\r\n\r\n```py\r\n\r\nimport os\r\n\r\nimport torch\r\nfrom torch.utils.data import DataLoader, Dataset\r\n\r\nfrom pytorch_lightning import LightningModule, Trainer\r\n\r\n\r\nclass RandomDataset(Dataset):\r\... | 01c31ae434385d24c1a34b8fda63667f57b3e897 | {
"head_commit": "258f58786a95d37659296f7985bc7fa7e98002c3",
"head_commit_message": "Update pytorch_lightning/trainer/connectors/accelerator_connector.py\n\nCo-authored-by: Rohit Gupta <rohitgr1998@gmail.com>",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex 2a2abb489d6cb..7b14f895c8108 100644... | [
{
"diff_hunk": "@@ -22,3 +27,50 @@ def test_auto_device_count(device_count_mock):\n assert GPUAccelerator.auto_device_count() == 2\n assert TPUAccelerator.auto_device_count() == 8\n assert IPUAccelerator.auto_device_count() == 4\n+\n+\n+def test_pluggable_accelerator(tmpdir):\n+ class TestAcceler... | 190f7a8df8e76875a801f4172fd71e21f7eea474 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7034e9b0373f0..56ff447628c15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -137,6 +137,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `estimated_stepping_batches` property to `Trainer` ([#11599](https://github.com/PyTorchLig... | {
"difficulty": "high",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-11575@2be7be2 | Lightning-AI/pytorch-lightning | Python | 11,575 | Avoid enforcing `shuffle=False` for eval dataloaders | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2022-01-22T20:54:07Z | Setting `shuffle=True` for `val_dataloader` doesn't work when `ddp` enabled.
## 🐛 Bug
Setting `shuffle=True` for `val_dataloader` doesn't work when `ddp` enabled.
### To Reproduce
minimum snippet:
```python
from pytorch_lightning import LightningModule, Trainer
from torch import nn
from torch.optim impo... | Out of curiosity, could you describe why you need shuffling during validation?
> Out of curiosity, could you describe why you need shuffling during validation?
In training, I would like to construct random positive-negative pairs on the fly. In validation, I want to keep the same setting. Of course, I can construct... | [
{
"body": "## 🐛 Bug\r\n\r\nSetting `shuffle=True` for `val_dataloader` doesn't work when `ddp` enabled.\r\n\r\n### To Reproduce\r\n\r\nminimum snippet:\r\n\r\n```python\r\nfrom pytorch_lightning import LightningModule, Trainer\r\nfrom torch import nn\r\nfrom torch.optim import Adam\r\nfrom torch.utils.data imp... | 9ebd7df22acc6e0de4569edacd0ec8319ab4be21 | {
"head_commit": "2be7be22ee210446c8daf32f8b269d1b6462d872",
"head_commit_message": "chlog",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex aa7c4f9b056bc..85c499b992142 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -457,6 +457,9 @@ The format is based on [Keep a Changelog](http://keepach... | [
{
"diff_hunk": "@@ -435,7 +435,13 @@ def _reset_eval_dataloader(\n )\n \n # add samplers\n- dataloaders = [self._prepare_dataloader(dl, False, mode=mode) for dl in dataloaders if dl is not None]\n+ dataloaders = [\n+ self._prepare_dataloader(\n+ dl, sh... | 59852444c373837c05bc1c3c3581d8d75502f715 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9050d7576a48c..d9c2e189c12d9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -497,6 +497,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed `SimpleProfiler` summary ([#11414](https://github.com/PyTorchLightning/pytorch-lightning/p... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-11533@ca7b9ec | Lightning-AI/pytorch-lightning | Python | 11,533 | [CLI] Support shorthand for loggers | ## What does this PR do?
Fixes https://github.com/PyTorchLightning/pytorch-lightning/issues/10574
### Does your PR introduce any breaking changes? If yes, please list them.
Previous calls with `--trainer.logger=pytorch_lightning.loggers.WandbLogger` will need to update to `--trainer.logger=WandbLogger`
## B... | 2022-01-18T23:02:57Z | Add ability to pass logger to LightningCLI
## 🚀 Feature
```
python trainer. py fit --trainer.logger=WandbLogger
```
### Motivation
If I use LightningCLI, I don't want to abandon my favourite logger, WandbLogger 😏. With the new way to reference class names, this would be very nice.
### Pitch
Allow users to pass t... | This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team!
This issue has been automatically marked as stale because it hasn't had any recent activity. This iss... | [
{
"body": "## 🚀 Feature\n\n```\npython trainer. py fit --trainer.logger=WandbLogger\n```\n\n### Motivation\n\nIf I use LightningCLI, I don't want to abandon my favourite logger, WandbLogger 😏. With the new way to reference class names, this would be very nice.\n\n### Pitch\n\nAllow users to pass their favouri... | ec1379da2c9388b144adcb4b4cc751839f085f65 | {
"head_commit": "ca7b9ec37191870cd702244585ccef1dafe5ca26",
"head_commit_message": "whitespace",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex b203856de1ec4..679e0c6976e70 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -60,6 +60,9 @@ The format is based on [Keep a Changelog](http://keep... | [
{
"diff_hunk": "@@ -579,6 +586,7 @@ def add_core_arguments_to_parser(self, parser: LightningArgumentParser) -> None:\n \"\"\"Adds arguments from the core classes to the parser.\"\"\"\n parser.add_lightning_class_args(self.trainer_class, \"trainer\")\n parser.set_choices(\"trainer.callbac... | 2848be753d3bbbbb10562bd78f7763012e477dbb | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a2b32ac44cdf..992aa2f6239fb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -60,6 +60,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `console_kwargs` for `RichProgressBar` to initialize inner Console ([#10875](https://github... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-11078@ac3d135 | Lightning-AI/pytorch-lightning | Python | 11,078 | Teardown sync-batchnorm after training | ## What does this PR do?
Attempt to fix #11076
I'm checking whether https://github.com/pytorch/pytorch/issues/41081#issuecomment-783961547 is a viable solution. If it is, support for it could be added in upstream PyTorch.
## Before submitting
- [x] Was this discussed/approved via a GitHub issue? (not for typo... | 2021-12-15T14:03:45Z | model.to_torchscript can not process the model trained with sync_batchnorm
## 🐛 Bug
If I enable `sync_batchnorm` during training:
```Python
trainer = pl.Trainer(
checkpoint_callback=False,
gpus=2,
callbacks=callbacks,
max_steps=10000,
accelerator="ddp",
... | Hello, thanks for reporting this.
I tested this in pure Python and it fails there too, here is a reproducible example:
```python
import torch
import torch.distributed
import os
class BoringModel(torch.nn.Module):
def __init__(self):
super().__init__()
self.layer = torch.nn.Linear(3... | [
{
"body": "## 🐛 Bug\r\n\r\nIf I enable `sync_batchnorm` during training:\r\n\r\n```Python\r\n trainer = pl.Trainer(\r\n checkpoint_callback=False,\r\n gpus=2,\r\n callbacks=callbacks,\r\n max_steps=10000,\r\n accelerator=\"ddp\",\r\n sync_batchnorm=True,\r\n ... | 46d6fbf11b7c1d04edefa121675751db8ca02b18 | {
"head_commit": "ac3d135f0b76a65b14f5cef6e114d892d4523309",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex 0ad5733118758..8693dcca69f01 100644\n--- a/CHANGELOG.md... | [
{
"diff_hunk": "@@ -399,3 +399,37 @@ def _collect_states_on_rank_zero(state: Dict[str, Any]) -> Dict[int, Any]:\n if not distributed_available():\n return {0: state}\n return {rank: _broadcast_object_list(state, rank) for rank in range(torch.distributed.get_world_size())}\n+\n+\n+class _BatchNor... | c2e0ebd77c6095cb21a5aeb6008cb80bab8aefc1 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index a55b777cd1aae..1c6262225b2f4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -117,8 +117,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed duplicated file extension when uploading model checkpoints with `NeptuneLogger` ([#1101... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-11406@2e71684 | Lightning-AI/pytorch-lightning | Python | 11,406 | Fix environment variable order for global rank determination | This resolves the issue #11380 and the underlying root bug described here https://github.com/PyTorchLightning/pytorch-lightning/issues/11380#issuecomment-1009376167.
Fixes #11380
### Does your PR introduce any breaking changes? If yes, please list them.
<!-- FILL IN or None -->
## Before submitting
- [... | 2022-01-10T21:55:28Z | WandbLogger in DDP setting creates multiple runs in W&B
When using the `WandbLogger` in DDP mode with `n>1` GPUs, `n` runs in Weights&Biases will be created. Only the first run will have the actual logs, all other runs will be empty, essentially cluttering up the W&B project.
### Expected behavior
Only one run wi... | I *think* I can "fix" this by manually calling `wand.init` only on the `rank0` process once before creating the `WandbLogger`, but it would be much more in the spirit of pytorch-lightning if the user didn't have to think about these things.
EDIT: Some more information:
My WandbLogger looks like this and I am callin... | [
{
"body": "When using the `WandbLogger` in DDP mode with `n>1` GPUs, `n` runs in Weights&Biases will be created. Only the first run will have the actual logs, all other runs will be empty, essentially cluttering up the W&B project.\r\n\r\n### Expected behavior\r\n\r\nOnly one run will be created, even when usin... | 4cc05b2cf98e49168a5f5dc265647d75d1d3aae9 | {
"head_commit": "2e716842fc7f280997b7102d4f4223157a100549",
"head_commit_message": "Fix rank environment variable priority",
"patch_to_review": "diff --git a/pytorch_lightning/utilities/distributed.py b/pytorch_lightning/utilities/distributed.py\nindex 7e817b14c4325..884bcd157268c 100644\n--- a/pytorch_lightning... | [
{
"diff_hunk": "@@ -55,7 +55,7 @@ def wrapped_fn(*args: Any, **kwargs: Any) -> Optional[Any]:\n \n # TODO: this should be part of the cluster environment\n def _get_rank() -> int:\n- rank_keys = (\"RANK\", \"SLURM_PROCID\", \"LOCAL_RANK\")\n+ rank_keys = (\"RANK\", \"LOCAL_RANK\", \"SLURM_PROCID\")",
... | 5e7a2d694e471236dc7f04e355df1c3810ff4e0d | diff --git a/CHANGELOG.md b/CHANGELOG.md
index e5bf0c690f545..dfebe17f25a7b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -615,6 +615,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed an `AttributeError` when calling `save_hyperparameters` and no parameters need saving ([#1... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-10418@ecb1f24 | Lightning-AI/pytorch-lightning | Python | 10,418 | Raise exceptions when torch distributed is not available | ## What does this PR do?
Avoids init_dist_connection failing silently
If torch.distributed is not available, the process_group cannot be created. Later, the runtime will fail when wrapping model or after training steps (when call distributed_c10d). So we should fail faster at `init_dist_connection` step
<!--
Plea... | 2021-11-08T18:36:31Z | Module 'torch.distributed' has no attribute 'ProcessGroup' when importing PyTorch Lightning
## 🐛 Bug
When importing PyTorch Lightning, it throws an `AttributeError: module 'torch.distributed' has no attribute 'ProcessGroup'`. I guess it comes from the fact that I am on macOS (M1) and PyTorch does not provide `torch... | Hello @Riccorl
Thanks for reporting. Can you please show us the full error so we can check in which module it occurs?
I'm not sure why you get `torch.distributed.is_available() = False` on MacOS, it should be True. It is for me.
> Hello @Riccorl Thanks for reporting. Can you please show us the full error so we can ... | [
{
"body": "## 🐛 Bug\r\n\r\nWhen importing PyTorch Lightning, it throws an `AttributeError: module 'torch.distributed' has no attribute 'ProcessGroup'`. I guess it comes from the fact that I am on macOS (M1) and PyTorch does not provide `torch.distributed` with its pre-built package. Indeed, `torch.distributed.... | f9b9cdb0d1d4e26d25fe13f19f12ea88690aa0a8 | {
"head_commit": "ecb1f240b712116901890fc38530cd596b6e0d5a",
"head_commit_message": "Raise exceptions when torch distributed is not avalible",
"patch_to_review": "diff --git a/pytorch_lightning/utilities/distributed.py b/pytorch_lightning/utilities/distributed.py\nindex ef0f0b5ef3e97..d968f2eb46d1d 100644\n--- a/... | [
{
"diff_hunk": "@@ -381,7 +381,9 @@ def init_dist_connection(\n world_size = world_size if world_size is not None else cluster_environment.world_size()\n os.environ[\"MASTER_ADDR\"] = cluster_environment.main_address\n os.environ[\"MASTER_PORT\"] = str(cluster_environment.main_port)\n- if torch.d... | 786fdabc05a0b5612176a2a524d2128c52a63e4c | diff --git a/CHANGELOG.md b/CHANGELOG.md
index df7c34d627bcc..b54ee5313d75a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,7 +25,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Changed
--
+- Raise exception in `init_dist_connection()` when torch distibuted is not avail... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-10359@1a6dfbf | Lightning-AI/pytorch-lightning | Python | 10,359 | Only import PostLocalSGD related modules when it's needed | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2021-11-04T19:04:50Z | Module 'torch.distributed' has no attribute 'ProcessGroup' when importing PyTorch Lightning
## 🐛 Bug
When importing PyTorch Lightning, it throws an `AttributeError: module 'torch.distributed' has no attribute 'ProcessGroup'`. I guess it comes from the fact that I am on macOS (M1) and PyTorch does not provide `torch... | Hello @Riccorl
Thanks for reporting. Can you please show us the full error so we can check in which module it occurs?
I'm not sure why you get `torch.distributed.is_available() = False` on MacOS, it should be True. It is for me.
> Hello @Riccorl Thanks for reporting. Can you please show us the full error so we can ... | [
{
"body": "## 🐛 Bug\r\n\r\nWhen importing PyTorch Lightning, it throws an `AttributeError: module 'torch.distributed' has no attribute 'ProcessGroup'`. I guess it comes from the fact that I am on macOS (M1) and PyTorch does not provide `torch.distributed` with its pre-built package. Indeed, `torch.distributed.... | 939a861853059d4a632843dbbf83e9ab802ad424 | {
"head_commit": "1a6dfbfcad2a5b1ab20def7995b57e8082217078",
"head_commit_message": "Only import PostLocalSGD related modules when it's needed",
"patch_to_review": "diff --git a/pytorch_lightning/plugins/training_type/ddp.py b/pytorch_lightning/plugins/training_type/ddp.py\nindex ea4820f61ec7c..229cc3e3ef1f3 1006... | [
{
"diff_hunk": "@@ -323,7 +316,8 @@ def _register_ddp_hooks(self) -> None:\n ddp_comm_hook=self._ddp_comm_hook,\n ddp_comm_wrapper=self._ddp_comm_wrapper,\n )\n-\n+ if _TORCH_GREATER_EQUAL_1_10:\n+ import torch.distributed.algorithms.ddp_comm... | e70bab949b94f4dde825fcf8fc51461ef3c644eb | diff --git a/pytorch_lightning/plugins/training_type/ddp.py b/pytorch_lightning/plugins/training_type/ddp.py
index ea4820f61ec7c..fe10088b19944 100644
--- a/pytorch_lightning/plugins/training_type/ddp.py
+++ b/pytorch_lightning/plugins/training_type/ddp.py
@@ -63,11 +63,6 @@
from pytorch_lightning.utilities.seed impor... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-10247@0f152f1 | Lightning-AI/pytorch-lightning | Python | 10,247 | Add warning if multiple batch_sizes are found from ambiguous batch | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2021-10-29T13:18:29Z | `utilities.data.extract_batch_size` can silently fail -- maybe it needs to be less automatic?
## Motivation
Hey! So from what I understand `extract_batch_size` is used by `ResultCollection` to reduce/re-weight various logging metrics such as validation loss, etc.
We had an issue where our batch collation function... | Dear @ronif, if you provide the batch_size to self.log(..., batch_size=batch_size), it should alleviate this problem as it will override the auto-detected value. We are aware of this and we introduced the batch_size in `self.log` for this reason.
Thanks for the quick reply @tchaton. We're using `self.log` in `on_vali... | [
{
"body": "## Motivation\r\n\r\nHey! So from what I understand `extract_batch_size` is used by `ResultCollection` to reduce/re-weight various logging metrics such as validation loss, etc.\r\n\r\nWe had an issue where our batch collation function aggregated Tensors into a list instead of stacking them (needed be... | 828b5315aaebc535bde6ea735b0c14e81ea12898 | {
"head_commit": "0f152f11af5c2f41be0a43585faf7521aeecfad1",
"head_commit_message": "Update pytorch_lightning/utilities/data.py",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex 60702a2866c83..85385072aad57 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -125,6 +125,7 @@ The format is based... | [
{
"diff_hunk": "@@ -23,6 +23,22 @@ def test_extract_batch_size():\n batch = {\"test\": [{\"test\": [torch.zeros(11, 10)]}]}\n assert extract_batch_size(batch) == 11\n \n+ batch = {\"test\": [{\"test\": [torch.zeros(11, 10), torch.zeros(10, 10)]}]}\n+ with pytest.warns(UserWarning, match=\"Trying t... | 10b7d3169ecc4af5c960a5d5c0b4fe27b1fcd000 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 60702a2866c83..85385072aad57 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -125,6 +125,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added support for `devices="auto"` ([#10264](https://github.com/PyTorchLightning/pytorch-lightni... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-10035@95b89bb | Lightning-AI/pytorch-lightning | Python | 10,035 | Rerun flaky profiler tests on failure | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2021-10-20T03:38:28Z | fix flaky `test_simple_profiler_overhead`
## 🐛 Bug
A flaky profiler test blocks our auto-merge. Bad!
### To Reproduce
Test run `tests/profiler/test_profiler/test_simple_profiler_overhead`
or `test_simple_profiler_iterable_durations`
```bash
________________________ test_simple_profiler_overhead _______... | I had a look but this is really tricky because testing runtime is inherently flaky.
The only options I see are:
- Remove these tests.
- Mark them to be re-tried on failure (just reduces the flakiness but it's still there)
Thanks for taking a look. Let's try the second option and see if that helps. If not we can la... | [
{
"body": "## 🐛 Bug\r\n\r\nA flaky profiler test blocks our auto-merge. Bad!\r\n\r\n### To Reproduce\r\n\r\nTest run `tests/profiler/test_profiler/test_simple_profiler_overhead`\r\nor `test_simple_profiler_iterable_durations`\r\n\r\n\r\n```bash\r\n________________________ test_simple_profiler_overhead ________... | 53c62f63e8e9cf7724874ad0374841d141fc85fc | {
"head_commit": "95b89bb7cfcb3b527b8b5dc650c2adb0f1af87b0",
"head_commit_message": "Fix flaky profiler tests",
"patch_to_review": "diff --git a/requirements/test.txt b/requirements/test.txt\nindex 8d0e0712d7058..0e39d0821c63d 100644\n--- a/requirements/test.txt\n+++ b/requirements/test.txt\n@@ -1,6 +1,7 @@\n cov... | [
{
"diff_hunk": "@@ -52,6 +52,7 @@ def simple_profiler():\n return SimpleProfiler()\n \n \n+@pytest.mark.flaky(reruns=5)",
"line": null,
"original_line": 55,
"original_start_line": null,
"path": "tests/profiler/test_profiler.py",
"start_line": null,
"text": "@user1:\nI think we can lo... | 4c11ce382b1338afd5d6d97a76eece8455aa2548 | diff --git a/requirements/test.txt b/requirements/test.txt
index 8d0e0712d7058..0e39d0821c63d 100644
--- a/requirements/test.txt
+++ b/requirements/test.txt
@@ -1,6 +1,7 @@
coverage>5.2.0
codecov>=2.1
pytest>=6.0
+pytest-rerunfailures>=10.2
check-manifest
twine==3.2
mypy>=0.900
diff --git a/tests/profiler/test_pr... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-10927@fb376bb | Lightning-AI/pytorch-lightning | Python | 10,927 | Fix frozen dataclass instance error in `apply_to_collection` | ## What does this PR do?
changed the set_attribute function in in the apply_to_collection for recursively applying a function to all elements of a certain dtype in utilities/apply_func.py to Work with frozen dataclass Also now.
Fixes #10873
### Does your PR introduce any breaking changes? If yes, pleas... | 2021-12-03T17:26:21Z | Frozen Dataclasses as samples produce an error in 1.5+
## 🐛 Bug
When using a frozen dataclass to define a sample, an error is thrown.
```
File ".../python3.9/site-packages/pytorch_lightning/utilities/apply_func.py", line 146, in apply_to_collection
setattr(result, field_name, v)
File "<string>", line 4, in __... | Hey @olliethomas,
Would you be interested in making a contribution to fix this bug? I believe this problem is within the apply_to_collection function.
Best,
T.C
Hello! Can I try and contribute to fixing this bug ? @tchaton
Regards
Hey @abhi-rf,
Yes, go for it :)
Best
T.C
I have a more general question: ... | [
{
"body": "## 🐛 Bug\r\n\r\nWhen using a frozen dataclass to define a sample, an error is thrown.\r\n```\r\nFile \".../python3.9/site-packages/pytorch_lightning/utilities/apply_func.py\", line 146, in apply_to_collection\r\n setattr(result, field_name, v)\r\nFile \"<string>\", line 4, in __setattr__\r\ndatacla... | 21caff1f19448d0065c85835db0d1403083ec93b | {
"head_commit": "fb376bbd05c964df5ddae15c0688cb06fee0b07c",
"head_commit_message": "fix: remove unused imports",
"patch_to_review": "diff --git a/pytorch_lightning/utilities/apply_func.py b/pytorch_lightning/utilities/apply_func.py\nindex aeefc048fe5f4..eff1e6a12b744 100644\n--- a/pytorch_lightning/utilities/app... | [
{
"diff_hunk": "@@ -144,7 +144,10 @@ def apply_to_collection(\n )\n if not field_init or (not include_none and v is None): # retain old value\n v = getattr(data, field_name)\n- setattr(result, field_name, v)\n+ try:\n+ setattr(res... | 3089728f1654af893fe445ba07b37f242a0d3a04 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index c9991b028e181..c2bf09068ff61 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,6 +34,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Show a better error message when a custom `DataLoader` implementation is not well implemented and ... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-10438@661c4c1 | Lightning-AI/pytorch-lightning | Python | 10,438 | [DeepSpeed] Do not fail if batch size could not be inferred for logging | ## What does this PR do?
Closes #10437
Adds a try/catch and a check to ensure we only warn if needs be (if logging has been set lower than WARNING).
## Before submitting
- [x] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [x] Did you read the [contributor guideline](https:... | 2021-11-09T15:57:19Z | DeepSpeed should not fail if batch size cannot be inferred
## 🐛 Bug
Currently if DeepSpeed is not able to infer the batch size from the dataloader, this fails. To get around this, you need to instantiate the plugin and pass the batch size via `strategy=DeepSpeedPlugin(logging_batch_size_per_gpu=1)`.
The annoying... | [
{
"body": "## 🐛 Bug\r\n\r\nCurrently if DeepSpeed is not able to infer the batch size from the dataloader, this fails. To get around this, you need to instantiate the plugin and pass the batch size via `strategy=DeepSpeedPlugin(logging_batch_size_per_gpu=1)`.\r\n\r\nThe annoying thing is, this variable is only... | 4117028400d6db736ad661084f06e6177c93680d | {
"head_commit": "661c4c14f13e14e441adc37515a45b7cdd9a2512",
"head_commit_message": "Add CHANGELOG.md",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex a786af1c164e7..59667590441c4 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -28,7 +28,7 @@ The format is based on [Keep a Changelog](http:... | [
{
"diff_hunk": "@@ -462,9 +462,7 @@ def init_deepspeed(self):\n if self.zero_stage_3 and self.partition_module:\n # Ensure the entire model has been moved to the appropriate device\n dtype = torch.float16 if self.precision in (16, \"mixed\") else torch.float32\n- deeps... | 71d65a6937dc107be6a2d394ef428114c973e557 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb891ef031237..25afcc58e54f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,6 +31,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- The `monitor` argument in the `EarlyStopping` callback is no longer optional ([#10328](https://git... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} | |
Lightning-AI__pytorch-lightning-9895@d961df5 | Lightning-AI/pytorch-lightning | Python | 9,895 | Add support for `len(datamodule)` | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2021-10-11T16:50:02Z | support len(datamodule)
Let's add support for len(datamodule) so we can get the following:
```python
len(datamodule)
# prints:
# train_dataloder_1: 200 samples
# train_dataloader_2: 500 samples
# tval_dataloder_1: 200 samples
# val_dataloader_2: 500 samples
# test_dataloder_1: 200 samples
# t... | I think this is better suited for `__str__`, `__len__` should aways return an int
This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team!
@carmocca I'd like ... | [
{
"body": "Let's add support for len(datamodule) so we can get the following:\r\n\r\n```python\r\nlen(datamodule)\r\n\r\n# prints: \r\n# train_dataloder_1: 200 samples\r\n# train_dataloader_2: 500 samples\r\n# tval_dataloder_1: 200 samples\r\n# val_dataloader_2: 500 samples\r\n# test_dataloder_1: 2... | 6a0c47a01482fd0c1bed7e414e450a9339bb41f9 | {
"head_commit": "d961df5eae8d5aa1dcbb18fa4b5e05550015c3bd",
"head_commit_message": "Fix flake8 issue",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex fa206f3784c49..7515e9a40d980 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -177,6 +177,7 @@ The format is based on [Keep a Changelog](htt... | [
{
"diff_hunk": "@@ -481,3 +484,35 @@ def __getstate__(self) -> dict:\n for fn in (\"prepare_data\", \"setup\", \"teardown\"):\n del d[fn]\n return d\n+\n+ def __len__(self) -> int:\n+ \"\"\"Returns the total number of batches in all dataloaders defined in the datamodule.\"\... | 1f581eb07be99562be9126056969962fb5fa5e71 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa206f3784c49..7515e9a40d980 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -177,6 +177,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added support for `torch.autograd.set_detect_anomaly` through `Trainer` constructor argument `... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-9221@5f966ec | Lightning-AI/pytorch-lightning | Python | 9,221 | Add a warning to deepspeed when inferring batch size | ## What does this PR do?
Closes #8872
Adds a warning for users, as this may crash their code if they require setup to be called first.
## Before submitting
- [x] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [x] Did you read the [contributor guideline](https://github.com/P... | 2021-08-31T09:35:07Z | Deepspeed accelerator calls datamodule.train_dataloader() prior to setup()
## 🐛 Bug
Deepspeed accelerator calls datamodule.train_dataloader() prior to setup(). This does not happen with other accelerators.
### To Reproduce
```py
import os
import torch
from torch.utils.data import DataLoader, Dataset
f... | Dear @leezu,
The `DeepSpeed Plugin` is doing a hack to automatically resolved your batch_size, but won't actually use this dataloader for training.
And there is no simple way to improve this unless you provide the batch_size within the deepspeed config.
And, the DataLoader used for training will be defined with... | [
{
"body": "## 🐛 Bug\r\n\r\nDeepspeed accelerator calls datamodule.train_dataloader() prior to setup(). This does not happen with other accelerators.\r\n\r\n### To Reproduce\r\n\r\n```py\r\nimport os\r\n\r\nimport torch\r\nfrom torch.utils.data import DataLoader, Dataset\r\n\r\nfrom pytorch_lightning import Lig... | 6892d533ea1c743f7e05171846a28e685db85f51 | {
"head_commit": "5f966ec02c4eece0bdbfe13cdb6537261cb46200",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex aa3669c40ccf3..b39e4dab4a6f9 100644\n--- a/CHANGELOG.md... | [
{
"diff_hunk": "@@ -546,6 +546,11 @@ def _format_batch_size_and_grad_accum_config(self):\n \" as this will be set via accumulate_grad_batches=x argument passed via the Lightning Trainer.\"\n )\n if \"train_micro_batch_size_per_gpu\" not in self.config:\n+ rank_zero... | 7b1c15f10f8b9de4c1c87d9c06a2c7cd6e0288e2 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index aa3669c40ccf3..b39e4dab4a6f9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -106,6 +106,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `on_exception` callback hook ([#9183](https://github.com/PyTorchLightning/pytorch-lightn... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-10825@2f90f13 | Lightning-AI/pytorch-lightning | Python | 10,825 | Modify LSFEnvironment to use more reliable environment variable | The environment variable `LSB_HOSTS` was being used to determine node rank and master address. This is not always populated. This PR updates LSFEnvironment to use `LSB_DJOB_RANKFILE` instead.
Fix #10216
<!-- FILL IN or None -->
## Before submitting
- [x] Was this **discussed/approved** via a GitHub issue? ... | 2021-11-29T22:42:47Z | DDP initialization breaks on HPC system at larger scale
We are experiencing an issue with DDP at larger scales on our HPC system (Summit at OLCF - LSF scheduler). The specific threshold is at 14 nodes, where things suddenly aren't able to initialize anymore. It appears there is all of a sudden an inability to setup ran... | @proutrc Hi, thanks for reporting.
You mention LSF. Could you verify that `trainer.training_type_plugin.cluster_environment` prints LSFEnvironment? If that's the case, what will `trainer.training_type_plugin.cluster_environment.global_rank()` print for you? It should be determined by the env variable `JSM_NAMESPACE_... | [
{
"body": "We are experiencing an issue with DDP at larger scales on our HPC system (Summit at OLCF - LSF scheduler). The specific threshold is at 14 nodes, where things suddenly aren't able to initialize anymore. It appears there is all of a sudden an inability to setup ranks across nodes properly, as depicted... | a8bd7ac73f3e4afc0d53c2aad1b295ad4942201c | {
"head_commit": "2f90f13c2cc07bc0798a47fc1a865788e0f0a001",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex c2b50c1d41f5b..cfc8edbd60927 100644\n--- a/CHANGELOG.md... | [
{
"diff_hunk": "@@ -51,112 +54,152 @@ def __init__(self):\n )\n self._main_address = self._get_main_address()\n self._main_port = self._get_main_port()\n- log.debug(f\"MASTER_ADDR: {self._main_address}\")\n- log.debug(f\"MASTER_PORT: {self._main_port}\")\n-\n- @prope... | 630dd6f8f9bd7d77a662e0431c4aef7846ece065 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index c7950d2c57b8e..6e16edf4cd96f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -140,6 +140,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed duplicated file extension when uploading model checkpoints with `NeptuneLogger` ([#11015... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-9371@4961a98 | Lightning-AI/pytorch-lightning | Python | 9,371 | fix resuming from checkpoint for fault-tolerant in case of no failure | ## What does this PR do?
Fixes #8835
When saving the loop state dict on a failure (breaking in the middle of an epoch), we want to save the progress counters exactly as they are in order to resume on the failed batch. The same applies to runs that finish successfully and with the full epoch completed. If we resum... | 2021-09-08T11:05:07Z | resume_from_checkpoint broken when fault-tolerant feature enabled
## 🐛 Bug
A trainer with the resume from checkpoint option does not continue training and stops immediately, despite increased max_epoch settings.
### To Reproduce
```python
import os
import unittest.mock
import torch
from torch.utils.data... | issue starts with this line: https://github.com/PyTorchLightning/pytorch-lightning/blob/3096ab88ebb1d9c9c07c3230829171925c9e678a/pytorch_lightning/trainer/connectors/checkpoint_connector.py#L353 | [
{
"body": "## 🐛 Bug\r\n\r\nA trainer with the resume from checkpoint option does not continue training and stops immediately, despite increased max_epoch settings.\r\n\r\n### To Reproduce\r\n```python\r\n\r\nimport os\r\nimport unittest.mock\r\n\r\nimport torch\r\nfrom torch.utils.data import DataLoader, Datas... | 81687aade16163c9801ace80bef856cbe527ac60 | {
"head_commit": "4961a982ce4f67b245e3ad4c8747bf0646ec2329",
"head_commit_message": "[pre-commit.ci] auto fixes from pre-commit.com hooks\n\nfor more information, see https://pre-commit.ci",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex bb9a9f1db8be3..29f02aa44ecf3 100644\n--- a/CHANGELOG.md... | [
{
"diff_hunk": "@@ -65,8 +65,7 @@ def connect(self, **kwargs: \"Loop\") -> None:\n raise NotImplementedError(f\"{self.__class__.__name__} does not connect any child loops.\")\n \n def reset(self) -> None:\n- if not self.restarting:\n- self.optim_progress.optimizer_idx = 0\n+ ... | 8045fd596b3124b6b8d56f0c4ad61d4fa703618d | diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe8738266f8ba..c9cdc3d97d99d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,8 +23,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Progress tracking
- * Integrate `TrainingEpochLoop.total_batch_idx` ([#8598](https://github... | {
"difficulty": "medium",
"estimated_review_effort": 4,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-9150@37c429e | Lightning-AI/pytorch-lightning | Python | 9,150 | [bugfix] Changed CometLogger to stop modifying metrics in place | ## What does this PR do?
modified log_metrics() in comet.py to make a copy of metrics dictionary before calling val.cpu().detach(), hence preventing metrics from being changed in place.
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List a... | 2021-08-26T19:23:25Z | CometLogger can modify logged metrics in-place
When `logger.log_metrics(metrics)` is called with a `CometLogger`, `metrics` may be modified in-place. This can lead to confusing errors. E.g. if the user does
```python
def training_step(self, batch, batch_idx):
losses = self._get_losses(batch)
self.logger.... | PR on this is more than welcome! Great observation. Btw I believe we don't expect users to directly call `self.logger.log_metrics`, but we should still fix it :)
> val.cpu().detach() vs val.item()
Does Comet accept scalar tensors? If it can do the tensor->Python conversion (why wouldn't it), I would go with `val.cp... | [
{
"body": "When `logger.log_metrics(metrics)` is called with a `CometLogger`, `metrics` may be modified in-place. This can lead to confusing errors. E.g. if the user does\r\n\r\n```python\r\ndef training_step(self, batch, batch_idx):\r\n losses = self._get_losses(batch)\r\n self.logger.log_metrics(losses)... | 46b00a7de44d226a3da22b258c74cc2b3cd92bec | {
"head_commit": "37c429ef94bf1fa886b93074c7c7fa89e9d118d1",
"head_commit_message": "Update CHANGELOG.md\r\n\r\nremoved changes for tests from changelog, that should not be mentioned\n\nCo-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex 8... | [
{
"diff_hunk": "@@ -220,3 +221,14 @@ def test_comet_epoch_logging(comet, comet_experiment, tmpdir, monkeypatch):\n logger = CometLogger(project_name=\"test\", save_dir=tmpdir)\n logger.log_metrics({\"test\": 1, \"epoch\": 1}, step=123)\n logger.experiment.log_metrics.assert_called_once_with({\"test\... | 420d37c994e9569c3cd1502462d98fa44c13121d | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d3dcedbe003a..7155c85e20691 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -253,6 +253,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed not setting a default value for `max_epochs` if `max_time` was specified on the `Trainer... | {
"difficulty": "low",
"estimated_review_effort": 2,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-9072@9b8ece9 | Lightning-AI/pytorch-lightning | Python | 9,072 | Check `max_time` when setting defaults for min/max epochs | ## What does this PR do?
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
The followin... | 2021-08-24T05:21:45Z | Trainer should overwrite max_epoch when max_time is specified
## 🚀 Feature
Currently, the Trainer terminates at max_epoch (1000) even if the max_time is specified. Even if min_epoch is set to be greater than 1000, the Trainer should either overwrite the max_epoch value, or the documentation should state that min_epoc... | @awaelchli - should we pass `max_time` to the fit loop constructor and skip setting the default of `max_epochs` if `max_time is not None`?
https://github.com/PyTorchLightning/pytorch-lightning/blob/4af8eff0a13309b2e030c423db91156b1e869fac/pytorch_lightning/loops/fit_loop.py#L51
This also raises what the default s... | [
{
"body": "## 🚀 Feature\r\nCurrently, the Trainer terminates at max_epoch (1000) even if the max_time is specified. Even if min_epoch is set to be greater than 1000, the Trainer should either overwrite the max_epoch value, or the documentation should state that min_epoch is only applicable if early_stopping is... | 538e743f17c7da4624c902f762922e2837661818 | {
"head_commit": "9b8ece9d861783685f7920a727c1b78755a4c4be",
"head_commit_message": "Update CHANGELOG.md",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex 35404e85a5816..57e717a91b017 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -203,9 +203,13 @@ The format is based on [Keep a Changelog]... | [
{
"diff_hunk": "@@ -42,6 +42,10 @@ def on_fit_start(self):\n trainer.fit(TestModel())\n assert \"callbacks list already contains a Timer\" in caplog.text\n \n+ trainer = Trainer(max_time=dict(seconds=1337))",
"line": null,
"original_line": 45,
"original_start_line": null,
"path": ... | 5753d392c1aa8a074cab0040f4e07c08ae158b50 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35404e85a5816..57e717a91b017 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -203,9 +203,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed bug where data-loading functions where not getting the correct running stage passed ([#... | {
"difficulty": "low",
"estimated_review_effort": 3,
"problem_domain": "New Feature Additions"
} |
Lightning-AI__pytorch-lightning-9073@064b5a2 | Lightning-AI/pytorch-lightning | Python | 9,073 | LightningCLI save config multifile option required to support save to fsspec filesystem | ## What does this PR do?
jsonargparse now supports saving config to fsspec filesystem. This is a necessary change for it to work by default.
Fixes #8843
### Does your PR introduce any breaking changes? If yes, please list them.
<!-- FILL IN or None -->
## Before submitting
- [x] Was this **discussed/a... | 2021-08-24T05:28:08Z | SaveConfigCallback errors out when default_root_dir is an S3 path
## 🐛 Bug
Hi, when running PL Lightning using an S3 `default_root_dir` in the Trainer (while using the `LightningCLI`), I’m getting the following error:
```
Traceback (most recent call last):
File "train.py", line 56, in <module>
trainer_defaults=... | strange, in theory this should work since we have a makedirs call here with fsspec:
https://github.com/PyTorchLightning/pytorch-lightning/blob/b47e3ab7ce171ced7b9d807bbca6062cd6b5c97e/pytorch_lightning/utilities/cli.py#L187
I believe you need to install this extension:
```
pip install fsspec[s3]
```
Can... | [
{
"body": "## 🐛 Bug\r\n\r\nHi, when running PL Lightning using an S3 `default_root_dir` in the Trainer (while using the `LightningCLI`), I’m getting the following error:\r\n```\r\nTraceback (most recent call last):\r\nFile \"train.py\", line 56, in <module>\r\ntrainer_defaults=trainer_defaults\r\nFile \"/opt/c... | 856ed105819ab6ee9b2bee5b8bc52839b0cf521f | {
"head_commit": "064b5a247ac799170ccd421e54feb86db53a3750",
"head_commit_message": "Merge branch 'master' into cli_multifile_option",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex 169b63ed30173..2c223ef674e3a 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -187,6 +187,9 @@ The format is ... | [
{
"diff_hunk": "@@ -187,6 +187,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).\n - `Trainer.request_dataloader` now takes a `RunningStage` enum instance ([#8858](https://github.com/PyTorchLightning/pytorch-lightning/pull/8858))\n \n \n+- `LightningCLI` by default support sav... | 409be39c40d65881fb8292ba6c84a94502495841 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index c66330725d6a1..667c1ae8c8729 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -141,6 +141,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `PL_RECONCILE_PROCESS` environment variable to enable process reconciliation regardless of... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Lightning-AI__pytorch-lightning-8613@1a03fa5 | Lightning-AI/pytorch-lightning | Python | 8,613 | fix collecting training_step outputs | ## What does this PR do?
Fixes #8603
With git bisect found that https://github.com/PyTorchLightning/pytorch-lightning/pull/7891/ had introduced the issue by removing a "copy" of the training step output [here](https://github.com/PyTorchLightning/pytorch-lightning/pull/7891#discussion_r679001624).
Tests fail on... | 2021-07-29T09:41:12Z | outputs in training_epoch_end contain only outputs from last batch repeated
## 🐛 Bug
outputs in training_epoch_end contain only outputs from last batch repeated multiple times. I believe it got broken only in 1.4.0, but in 1.3.x it worked.
### To Reproduce
```python
import torch
from torch.utils.data import... | [
{
"body": "## 🐛 Bug\r\n\r\noutputs in training_epoch_end contain only outputs from last batch repeated multiple times. I believe it got broken only in 1.4.0, but in 1.3.x it worked.\r\n\r\n### To Reproduce\r\n\r\n```python\r\nimport torch\r\nfrom torch.utils.data import DataLoader, Dataset\r\nfrom pytorch_ligh... | 5789e9f5e4cb993753bed421bf2488dfdc73e0fa | {
"head_commit": "1a03fa5b2700828662a092bc5a4362c097e17891",
"head_commit_message": "add a comment for gc.collect()",
"patch_to_review": "diff --git a/CHANGELOG.md b/CHANGELOG.md\nindex a33cdd17031bd..5c320befec7b6 100644\n--- a/CHANGELOG.md\n+++ b/CHANGELOG.md\n@@ -71,7 +71,7 @@ The format is based on [Keep a Ch... | [
{
"diff_hunk": "@@ -982,6 +983,8 @@ def _post_dispatch(self):\n self.accelerator.teardown()\n self._active_loop.teardown()\n self.logger_connector.teardown()\n+ # force release any leftover memory, including CUDA tensors\n+ gc.collect()",
"line": null,
"original_lin... | 80471e74eca9e0c90c526abd470abdf476649f71 | diff --git a/CHANGELOG.md b/CHANGELOG.md
index eae5e5baae1cb..e8b9aba22a1d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -70,19 +70,22 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
-- Fixed horovod auto-detection when horovod is not installed and the launcher is `mpirun` ([... | {
"difficulty": "medium",
"estimated_review_effort": 3,
"problem_domain": "Bug Fixes"
} |
Subsets and Splits
Review Test Instances
Retrieves basic metadata about code review instances but doesn't provide any analytical insights or patterns beyond raw data access.