File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
src/lightning/pytorch/utilities/model_summary
tests/tests_pytorch/utilities Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -463,8 +463,9 @@ def _is_lazy_weight_tensor(p: Tensor) -> bool:
463
463
464
464
if isinstance (p , UninitializedParameter ):
465
465
warning_cache .warn (
466
- "A layer with UninitializedParameter was found. "
467
- "Thus, the total number of parameters detected may be inaccurate."
466
+ "The total number of parameters detected may be inaccurate because the model contains"
467
+ " an instance of `UninitializedParameter`. To get an accurate number, set `self.example_input_array`"
468
+ " in your LightningModule."
468
469
)
469
470
return True
470
471
return False
Original file line number Diff line number Diff line change @@ -345,11 +345,7 @@ def test_lazy_model_summary():
345
345
lazy_model = LazyModel ()
346
346
summary = ModelSummary (lazy_model )
347
347
348
- with pytest .warns (
349
- UserWarning ,
350
- match = r"A layer with UninitializedParameter was found. "
351
- r"Thus, the total number of parameters detected may be inaccurate." ,
352
- ):
348
+ with pytest .warns (UserWarning , match = "The total number of parameters detected may be inaccurate." ):
353
349
assert summary .total_parameters == 0
354
350
assert summary .trainable_parameters == 0
355
351
You can’t perform that action at this time.
0 commit comments