Add TensorFlow implementation of EfficientFormer (#22620)
* Add tf code for efficientformer * Fix return dict bug - return last hidden state after last stage * Fix corresponding return dict bug * Override test tol * Change default values of training to False * Set training to default False X3 * Rm axis from ln * Set init in dense projection * Rm debug stuff * Make style; all tests pass. * Modify year to 2023 * Fix attention biases codes * Update the shape list logic * Add a batch norm eps config * Remove extract comments in test files * Add conditional attn and hidden states return for serving output * Change channel dim checking logic * Add exception for withteacher model in training mode * Revert layer count for now * Add layer count for conditional layer naming * Transpose for conv happens only in main layer * Make tests smaller * Make style * Update doc * Rm from_pt * Change to actual expect image class label * Remove stray print in tests * Update image processor test * Remove the old serving output logic * Make style * Make style * Complete test
This commit is contained in:
@@ -37,7 +37,7 @@ EfficientFormer-L7, obtains 83.3% accuracy with only 7.0 ms latency. Our work pr
|
||||
reach extremely low latency on mobile devices while maintaining high performance.*
|
||||
|
||||
This model was contributed by [novice03](https://huggingface.co/novice03) and [Bearnardd](https://huggingface.co/Bearnardd).
|
||||
The original code can be found [here](https://github.com/snap-research/EfficientFormer).
|
||||
The original code can be found [here](https://github.com/snap-research/EfficientFormer). The TensorFlow version of this model was added by [D-Roberts](https://huggingface.co/D-Roberts).
|
||||
|
||||
## Documentation resources
|
||||
|
||||
@@ -66,3 +66,18 @@ The original code can be found [here](https://github.com/snap-research/Efficient
|
||||
|
||||
[[autodoc]] EfficientFormerForImageClassificationWithTeacher
|
||||
- forward
|
||||
|
||||
## TFEfficientFormerModel
|
||||
|
||||
[[autodoc]] TFEfficientFormerModel
|
||||
- call
|
||||
|
||||
## TFEfficientFormerForImageClassification
|
||||
|
||||
[[autodoc]] TFEfficientFormerForImageClassification
|
||||
- call
|
||||
|
||||
## TFEfficientFormerForImageClassificationWithTeacher
|
||||
|
||||
[[autodoc]] TFEfficientFormerForImageClassificationWithTeacher
|
||||
- call
|
||||
|
||||
Reference in New Issue
Block a user