191 questions
Best practices
0
votes
4
replies
67
views
Ideal language for fast binary feature minimization + any other general advice
I am working on an optimized implementation of binary feature minimization, which I am familiar with as a computational linguistic task but I would imagine has other applications. Fundamentally, it is ...
1
vote
1
answer
94
views
Can't tell the difference between two python n-queens solutions
Reading up on backtracking led me to a page on geeksforgeeks.org about solutions to the n-queens problem. The first solution is introduced as the "naive approach" that generates all possible ...
1
vote
1
answer
158
views
How to perform global structured pruning in PyTorch
I am training on CIFAR10 the following simple CNN
class SimpleCNN(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(3, 32, kernel_size=3, padding=1)
...
0
votes
0
answers
139
views
Prune function for decision tree
I am creating a decision tree from scratch and implementing pruning. Currently I believe the problem in my code is that when I prune a tree, the new leaf node I create does not get placed into the ...
0
votes
1
answer
1k
views
How to properly prune a YOLO detection model
I am trying to prune a Yolov8 detection model, using this snippet. But when I load the pruned model, it still shows the same number of parameters (3,011,048 parameters). I'm not sure if I'm doing this ...
1
vote
1
answer
978
views
How can I prune this neural network I created in Python using TensorFlow?
I am creating a traditional neural network for PA behavioral modeling in Python using TensorFlow. The model takes in input I and Q values and predicts the amplifier output. So that's a .csv file with ...
1
vote
0
answers
57
views
issue in PostgrelSQL 15.3 with partition pruning
I have two tables partitioned by range on column day,(this is an oversimplification for a more complex design), tables appear similar but day field refers to completly different concept than day in ...
0
votes
1
answer
276
views
Why does my pruned model have a larger file size than my initial model?
I'm exploring pruning a neural network using this example. My pruning code, using a pre-trained model, looks like this:
prune_low_magnitude = tfmot.sparsity.keras.prune_low_magnitude
# Compute end ...
0
votes
1
answer
622
views
Pruned model size is the same of non-pruned model [PyTorch]
I'm trying to implement model pruning on PyTorch with a ResNet18. Given an instance of ResNet18, I run the following code to load a pre-trained model, prune it and save the pruned model:
def ...
0
votes
0
answers
296
views
Error when pruning a model: model = (ckpt.get("ema") or ckpt["model"]).to(device).float() # FP32 model
I am trying to prune a YOLOv8 detection model. Following is my code and it runs successfully and I see the saved pruned model. But when I want to train it or run prediction on it, I get the following ...
0
votes
1
answer
570
views
How to solve deepcopy error of a pruned model in pytorch
I am trying to build a RL model, where my actor network has some pruned connections.
When using the data collector SyncDataCollector from torchrl, the deepcopy fails (see error below).
This seems to ...
0
votes
0
answers
289
views
How to prune random forest regression in Optuna?
I am working on machine learning model and trying to tune hyperparameters with Optuna. I want to try pruning, but I dont know how to implement this feature. I am using random forest regressor and ...
0
votes
0
answers
168
views
Pruning Pretrained Neural Networks
I try to remove the neurons that was under the required threshold not to do them 0 but to delete it from the VGG neural network.
I did the follow:
import tensorflow as tf
Load the VGG16 model
model = ...
0
votes
4
answers
1k
views
Python: How to efficiently select a subset of a list of object instances based on conditions on their attributes?
The minimal demonstrative example what I am trying to do is as follows: Suppose I have a list of instances of a point class, resembling points in the xy-plane, defined by:
class point:
def ...
0
votes
1
answer
190
views
How to prune a classification decision tree based on classification thresholds
I'm using sklearn to try to train a binary classification decision tree to classify spam vs not spam. My classification threshold is 50% (i.e I'll flag it as Spam if I think there's a 50%+ chance that ...
0
votes
1
answer
262
views
behaviour of the partition filtering on a BigQuery table
Considering a table T with a date based partition named date_part.
SELECT * FROM T where date_part="2023-06-06"
obviously will show datas from 2023-06-06...
If I want datas from 7 days in ...
3
votes
1
answer
2k
views
Remove tokens from Hugging Face tokenizer and save
In the current implementation, what is the recommended way for removing tokens from a any Hugging Face PreTrainedTokenizer? Simply creating a new vocabulary.txt and loading it with from_pretrained is ...
0
votes
0
answers
112
views
The test accuracy remains the same after being pruned
I recently tried to run the offical code from the repository "Filter Pruning via Geometric Median for Deep Convolutional Neural Networks Acceleration" by Yang He. I found that everything ...
2
votes
0
answers
747
views
Tekton Pruning - Separate pipelineruns vs taskruns
I've installed Tekton Operator and Tekton Config as described here:
https://tekton.dev/docs/operator/tektonconfig/
In the tektonconfig, it has a block like this:
pruner:
resources:
- ...
0
votes
0
answers
393
views
How to prune a transformer?
I am trying to reduce memory and speed up my own fine-tuned transformer. I came across the tutorial for pruning on the huggingface site. I am referring to the following snippet. The trainer.train() is ...
0
votes
1
answer
504
views
AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'assign'
I am trying to optimize my machine learning model by using weight pruning. But no matter what I do I cant get rid of the error AttributeError:
'tensorflow.python.framework.ops.EagerTensor' object has ...
1
vote
1
answer
745
views
Access weights, biases in model - PyTorch pruning
To implement L1-norm, unstructured, layer-wise pruning with torch.nn.utils.prune l1_unstructured, radom_unstructured methods, I have a toy LeNet-300-100 dense neural network as-
class LeNet300(nn....
4
votes
0
answers
853
views
Partition pruning in Deltatable incremental merge
I want to merge a dataframe which contains incremental data to my base deltatable. I want to achieve partition pruning while doing it to avoid scanning a lot of files.
My data is partitioned based on ...
0
votes
1
answer
4k
views
Geth Node Not Syncing To The Blockchain Anymore
I'm running a node of an Ethereum side-chain. I started only getting "peer connected on snap without compatible eth support" error messages in the log a few days ago. It would not download ...
1
vote
0
answers
191
views
keras get_weights/set_weights take too long
I am running some code which repeatedly (every training iteration) calls layer.get_weights() and layer.set_weights(). The callback operation containing these calls takes 0.01ms compared to the 0.004ms ...
1
vote
0
answers
118
views
Decision Tree Depth?
I am trying to implement a Decision Tree model with depth equal 10. I am using the comand "max_depth=10" on the list of arguments (SciKitLearn), but when I print the max_depth of my model, ...
0
votes
1
answer
1k
views
Why this query does not trigger partition pruning in Postgres?
I just noticed Postgres (checked on version 13 and 14) behavior that surprised me. I have a simple table volume with id and unique text column name. Second table dir has 3 columns: id, volume_id and ...
3
votes
0
answers
317
views
How to prune an existing tensorflow/keras model trained on imagenet
I am trying to prune InceptionNetV3 from keras trained on imagenet, right now I am using a tensorflow-datasets which has a subset of imagenet which I use for pruning. Currently my pruned models do not ...
0
votes
1
answer
523
views
CNN Pruning Issue : 'weights' has to be pruned before pruning can be removed
I am new with Pruning using Pytorch. I had this error when training my model :
ValueError: Parameter 'weight' of module Conv2d(1, 4, kernel_size=(7, 7), stride=(3, 3)) has to be pruned before pruning ...
1
vote
0
answers
307
views
How does pessimistic error pruning in C4.5 algorithm working?
I'm studing C4.5 algorithm and trying to make it in java by myself, but in the part of pruning, I don't understand what it compute in book of C4.5.
In this book,it said:"When N training cases are ...
1
vote
2
answers
12k
views
HuggingFace - 'optimum' ModuleNotFoundError
I want to run the 3 code snippets from this webpage.
I've made all 3 one post, as I am assuming it all stems from the same problem of optimum not having been imported correctly?
Kernel: ...
1
vote
1
answer
452
views
How to get the original cp values from rpart object
My aim is to prune a deep tree according to a certain value of the cost-complexity parameter, say 3.
I like growing trees with rpart(), in particular for the possibility of customizing plots. However, ...
1
vote
1
answer
496
views
Tensorflow: show model FLOPs after prune_low_magnitude
is there a way to show the reduced number of FLOPs of a model after pruning (prune_low_magnitude with tensorflow_model_optimization).
I tried to compare the default an the pruned model, but I didn't ...
2
votes
1
answer
3k
views
How does pytorch L1-norm pruning works?
Lets see the result that I got first. This is one of a convolution layer of my model, and im only showing 11 filter's weight of it (11 3x3 filter with channel=1)
Left side is original weight Right ...
0
votes
1
answer
588
views
How to perform pruning on trained object detection model?
Hi I have trained object detection model using tensorflow 1.14 object detection API, my model is performing well. However, I want to reduce/optimize parameters of model to make it lighter. How can I ...
4
votes
1
answer
4k
views
Why doesn't torch pruning actually remove filters or weights?
I work with one architecture and trying to sparse it via prune. I wrote functions for pruning, here is one of them:
def prune_model_l1_unstructured(model, layer_type, proportion):
for module in ...
0
votes
1
answer
629
views
How to update a pretrained model after Pruning of filters in its conv layer in PyTorch?
I have a pretrained model LeNet5 defined from scratch. I am performing pruning over filters in the convolution layers present in the model shown below.
class LeNet5(nn.Module):
def __init__(self, ...
0
votes
1
answer
410
views
How to use pruned weight or model?
I'd like to use the pruned model and weight but,
whenever I load the model or weight, this error messages keep popping up... My weight and model's files:
Error messages
1
vote
1
answer
386
views
How to prune the k% lowest weight by pytorch? [closed]
Here I learn from the paper called Deep compression [Han et. al.] using resnet18
I also work the following code, the weight times the mask so that it is the after_weight pruned by the k% lowest weight ...
0
votes
1
answer
478
views
How to perform pruning with a transfer learning model?
Essentially, I want to perform pruning to my transfer learning model.
I used efficientnetb0 for classifying microorganisms.
import tensorflow_model_optimization as tfmot
prune_low_magnitude = tfmot....
1
vote
2
answers
820
views
How to use partition pruning in google big query without hardcoding the filter condition?
I have a big table in GBQ which is partitioned by date. and I want to use partition pruning to optimize my query. the problem is that filter condition is a value that is read from another table and I ...
2
votes
0
answers
726
views
Freeze certain weights - TensorFlow 2
I am using a Conv-6 CNN in TensorFlow 2.5 and Python3. The objective is to selectively set certain weights within any trainable layer. The Conv-6 CNN model definition is as follows:
def conv6_cnn():
...
1
vote
1
answer
888
views
Deploy a pruned Tron (TRC20) node
Tron main net (TRC20) is about 500GB nowadays and needs much server config!
I'm searching for a way to prune the network like the pruning method in Bitcoin nodes or light or fast sync modes in ...
0
votes
1
answer
273
views
How to achieve removing/pruning the near-zero parameters in neural network?
I need to remove the near-zero weights of the Neural network so that the distribution of parameters is far away from the zero point.
The distribution of weights after removing nearzero weights and ...
2
votes
1
answer
954
views
Pytorch pruning on LSTM increases model size?
I am applying pruning using pytorch's torch.nn.utils.prune on a model with LSTM layers. However, when I save the contents of the state_dict, the model is much larger than before pruning. I'm not sure ...
2
votes
0
answers
618
views
Can't use KerasSurgeon with Tensorflow 2.4.1 version
I'm using the library KerasSurgeon to prune a neural network. When I call the method delete_channels() I get the following error:
TypeError Traceback (most recent call ...
1
vote
2
answers
2k
views
InvalidArgumentError: Conv2DCustomBackpropFilterOp only supports NHWC - pruning neural network
Im having problems when I use the library tensorflow_model_optimization.
I am developing a code to prune an already trained neural network.
I imported the weights from an h5 file and so I use ...
0
votes
1
answer
445
views
Issue in removing layer from keras surgeon
I am trying to remove a layer using kerassurgeon however I am facing issue to do I tried different ways but none of themworking.
# delete layer_1 from a model
from kerassurgeon import Surgeon
surgeon =...
0
votes
1
answer
476
views
Tensorflow pruned model is the same size as original baseline model
I have a baseline TF functional model that I want to prune. I have tried following the code in the documentation, but the size the compressed pruned model is the same size as the compressed baseline ...
0
votes
2
answers
3k
views
Optuna catboost pruning
is there a way to have pruning with CatBoost and Optuna (in LightGBM it's easy but in Catboost I can't find any hint).
My code is like this
def objective(trial):
param = {
'iterations':...