You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,14 +3,14 @@
3
3
## Prune and Quantize ML models
4
4
PQuant is a library for training compressed machine learning models, developed at CERN as part of the [Next Generation Triggers](https://nextgentriggers.web.cern.ch/t13/) project.
5
5
6
-
Installation via pip: ```pip install pquant-ml```.
6
+
Installation via pip: ```pip install pquant-ml```.
7
7
8
-
With TensorFlow ```pip install pquant-ml[tensorflow]```.
8
+
With TensorFlow ```pip install pquant-ml[tensorflow]```.
9
9
10
10
With PyTorch ```pip install pquant-ml[torch]```.
11
11
12
-
PQuant replaces the layers and activations it finds with a Compressed (in the case of layers) or Quantized (in the case of activations) variant. These automatically handle the quantization of the weights, biases and activations, and the pruning of the weights.
13
-
Both PyTorch and TensorFlow models are supported.
12
+
PQuant replaces the layers and activations it finds with a Compressed (in the case of layers) or Quantized (in the case of activations) variant. These automatically handle the quantization of the weights, biases and activations, and the pruning of the weights.
Copy file name to clipboardExpand all lines: docs/source/getting_started.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,13 +39,13 @@ def build_model(config):
39
39
classModel(torch.nn.Module):
40
40
def__init__(self):
41
41
super().__init__()
42
-
self.dense1 = PQDense(config, 16, 64,
42
+
self.dense1 = PQDense(config, 16, 64,
43
43
in_quant_bits= (1, 3, 3))
44
44
self.relu = PQActivation(config, "relu")
45
45
self.dense2 = PQDense(config, 64, 32)
46
46
self.dense3 = PQDense(config, 32, 32)
47
-
self.dense4 = PQDense(config, 32, 5,
48
-
quantize_output=True,
47
+
self.dense4 = PQDense(config, 32, 5,
48
+
quantize_output=True,
49
49
out_quant_bits=(1, 3, 3))
50
50
51
51
defforward(self, x):
@@ -78,18 +78,18 @@ def build_model():
78
78
x =self.relu(self.dense3(x))
79
79
x =self.dense4(x)
80
80
return x
81
-
81
+
82
82
83
83
return Model()
84
84
85
85
# Convert to PQuantML-compressed model
86
86
model = add_compression_layers(model, config)
87
87
```
88
88
89
-
### Fine-Tuning with PQuantML
89
+
### Fine-Tuning with PQuantML
90
90
PQuantML provides an automated fine-tuning and hyperparameter-optimization workflow through the `TuningTask API`. This allows you to search for optimal pruning, quantization, and training parameters using your own training, validation, and objective functions.
91
91
92
-
```python
92
+
```python
93
93
from pquant.core.finetuning import TuningTask, TuningConfig
94
94
95
95
# Convert defined yaml file into the object
@@ -142,13 +142,13 @@ Training is handled through the `train_model(...)` wrapper:
0 commit comments