keras icon indicating copy to clipboard operation
keras copied to clipboard

Mark layers with no state as built.

Open james77777778 opened this issue 1 year ago • 1 comments
trafficstars

There is an issue reported by Matt where the QLoRA tutorial failed due to unbuilt layers.

The root cause is that the line self.built = True was removed from __init__ in some layers, particularly in Dropout and Softmax. (This line was originally added in this commit: https://github.com/keras-team/keras/commit/7748a6aebba4bbc77a7866c44c1293c4bb9e0808)

This PR adds an assert_built_after_instantiation in the test case to prevent future breakages.

cc @mattdangerw

Note: there are still many stateless layers not included in this PR, but I want to keep this PR manageable for review. These can be addressed in the future.

james77777778 avatar Aug 28 '24 06:08 james77777778

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.38%. Comparing base (3de251d) to head (bdbe197). Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20175      +/-   ##
==========================================
+ Coverage   79.34%   79.38%   +0.03%     
==========================================
  Files         501      501              
  Lines       47325    47341      +16     
  Branches     8694     8692       -2     
==========================================
+ Hits        37550    37581      +31     
+ Misses       8017     8003      -14     
+ Partials     1758     1757       -1     
Flag Coverage Δ
keras 79.23% <100.00%> (+0.03%) :arrow_up:
keras-jax 62.50% <70.00%> (+0.03%) :arrow_up:
keras-numpy 57.67% <56.66%> (+0.03%) :arrow_up:
keras-tensorflow 63.89% <70.00%> (+0.03%) :arrow_up:
keras-torch 62.55% <100.00%> (+0.04%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Aug 28 '24 06:08 codecov-commenter