tensorflow / tensorflow/model-optimization

Pruning error for transfer learning models from TF/Keras API

Open
#1,017 2 comments 0 reactions 1 assignee View on GitHub

@rino20 is already working on this.

Since Oct 15, 2022.

bug
Dominant language
Python
Stars
1.6k
Forks
349
Avg merge
3d 2h
Merged PRs (30d)
1

Description

System information

TensorFlow version (installed from source or binary): 2.10

TensorFlow Model Optimization version (installed from source or binary): 0.7.3

Python version: 3.8

Bug

Hi,

I have been experimenting with ILSVRC2012 lately, and tried pruning pre-trained models that I took from the Keras/TF API. I used the pruning examples from the tfmopt documentation and it worked well for my "homemade" NNs as well as Nasnet NNs. However, with all the other ones I tried (I did not try each and every one of them but still), I got the following error

ValueError: Please initialize Prunewith a supported layer. Layers should either be supported by the PruneRegistry (built-in keras layers) or should be aPrunableLayerinstance, or should has a customer definedget_prunable_weights method. You passed: <class 'keras.layers.preprocessing.image_preprocessing.Rescaling'>

It apparently should have been fixed by this PR, yet, well, here we are. It seems I am not the only one who had this problem.

You can find the code I used on this colab. I included an example that worked for reference's purpose.

Thank you for your time !

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.