Add a default PruningPolicy that filters out any layers not supported by the API
@lenscloth ya está trabajando en esto.
Desde el 4/10/2023.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Hi TFMOT team! I have created a workaround for an edge-case in my project, and in my head it should be possible to have it be the default behavior in the API. Creating this feature request as a suggestion - let me know what you think!
System information
Running on TF 2.11. Unfortunately, I currently don't have the bandwidth to contribute the feature request.
Motivation
This feature request is for an implementation of the PruningPolicy that allows pruning for layers that are supported by the PruningRegistry.
Short background. When calling the prune_low_magnitude or similar functions, it's possible to ignore certain layers according to a pruning policy. By implementing the abstract class PruningPolicy, you can check that the model and layers fulfill certain requirements. One built-in implementation of this already exists, namely the PruneForLatencyOnXNNPack. A call can look like this:
model = prune_low_magnitude(
keras.Sequential([
layers.Dense(10, activation='relu', input_shape=(100,)),
layers.Dense(2, activation='sigmoid')
]),
pruning_policy=PruneForLatencyOnXNNPack(),
**pruning_params)
Currently, since no pruning policy is default, the API will try and prune layers that are not compatible. In one of our use-cases, we had to implement a policy that checks if the layer is supported (to avoid trying to prune a TFOpLambda layer, as an example). Explicitly, we are safeguarding the API by skipping data that itself knows that it doesn't support. I'm suggesting to add another implementation to the API, which simply calls the supports function linked above. If possible, I'd also use it as a default value for the pruning_policy parameter (this part may come with additional issues for some use-cases, so that would be an optional part of this feature request).
I think it would help people using the API to avoid confusing bugs in edge-cases. If there's an existing way to do this that we have overlooked, I'm happy to get that feedback. Let me know if the suggestion needs elaboration.
Thank you for your time!
Annie
- Lenguaje dominante
- Python
- Estrellas
- 1.6k
- Forks
- 349
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tensorflow/model-optimization
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
tensorflow/model-optimization#1301 · 1 comentario ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
tensorflow/model-optimization#1272 ·
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 50/100
tensorflow/model-optimization#1270 · 2 comentarios ·
-
build from source fails on macosAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 48/100
tensorflow/model-optimization#1241 ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
tensorflow/model-optimization#1182 · 1 comentario ·
Todos los issues de tensorflow/model-optimization
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
solana-foundation/pay-kit#341 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nasa/python_cmr#123 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
EleutherAI/lm-evaluation-harness#4243 ·
Los mantenedores suelen responder en 1 día
-
area: dashboard bug perceived difficulty: 3
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Nitjsefnie-Harness-Commons/daedalus#1179 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
cusp-ai-oss/tojax#17 ·