Spaces:
Runtime error
Runtime error
Update retriever.py
Browse files- retriever.py +3 -4
retriever.py
CHANGED
|
@@ -22,12 +22,11 @@ def pruning():
|
|
| 22 |
Optimizes models by removing unnecessary components, such as certain weights in a neural network.
|
| 23 |
This function demonstrates how to apply pruning.
|
| 24 |
"""
|
| 25 |
-
model = apply_pruning(model, amount=0.3)
|
| 26 |
-
code = "model = apply_pruning(model, amount=0.3)"
|
| 27 |
return (
|
| 28 |
f"To apply pruning to a model, use the following code snippet: {code}. "
|
| 29 |
f"You should adapt it to your actual implementation. In particular, the 'amount' parameter "
|
| 30 |
-
f"can be increased or decreased depending on the initial number of weights and the complexity of your use case (minimu value: 0, maximum value: 1)."
|
| 31 |
)
|
| 32 |
|
| 33 |
def quantization():
|
|
@@ -36,5 +35,5 @@ def quantization():
|
|
| 36 |
"""
|
| 37 |
code = "model = torch.quantization.quantize_dynamic(model, dtype=torch.qint8)"
|
| 38 |
return (
|
| 39 |
-
f"To apply quantization to a model, use the following code snippet: {code}."
|
| 40 |
)
|
|
|
|
| 22 |
Optimizes models by removing unnecessary components, such as certain weights in a neural network.
|
| 23 |
This function demonstrates how to apply pruning.
|
| 24 |
"""
|
| 25 |
+
code = "model = apply_pruning(model, amount=0.3)""
|
|
|
|
| 26 |
return (
|
| 27 |
f"To apply pruning to a model, use the following code snippet: {code}. "
|
| 28 |
f"You should adapt it to your actual implementation. In particular, the 'amount' parameter "
|
| 29 |
+
f"can be increased or decreased depending on the initial number of weights and the complexity of your use case (minimu value: 0, maximum value: 1). You should give these information to the manager, you can not prune the model yourself."
|
| 30 |
)
|
| 31 |
|
| 32 |
def quantization():
|
|
|
|
| 35 |
"""
|
| 36 |
code = "model = torch.quantization.quantize_dynamic(model, dtype=torch.qint8)"
|
| 37 |
return (
|
| 38 |
+
f"To apply quantization to a model, use the following code snippet: {code}. You should give these information to the manager, you can not quantize the model yourself."
|
| 39 |
)
|