Skip to content

Commit 5d88dd6

Browse files
Avoid import matplotlib (#3720)
### Changes Import matplotlib inside function and under `skip_if_dependency_unavailable` decorator ### Reason for changes `matplotlib` is not main NNCF requirements, it's part of optional dependencies `nncf[plots]` Currently matplotlib installing with `pymoo` but it will be removed in the next release.
1 parent ef28179 commit 5d88dd6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/nncf/quantization/algorithms/weight_compression/lora_correction.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
from pathlib import Path
1212
from typing import Optional
1313

14-
import matplotlib.pyplot as plt
1514
import pandas as pd
1615

1716
import nncf
1817
from nncf.common.logging import nncf_logger
1918
from nncf.common.utils.debug import DEBUG_LOG_DIR
2019
from nncf.common.utils.debug import is_debug
20+
from nncf.common.utils.decorators import skip_if_dependency_unavailable
2121
from nncf.experimental.common.tensor_statistics.statistics import WCTensorStatistic
2222
from nncf.parameters import CompressWeightsMode
2323
from nncf.quantization.advanced_parameters import AdvancedLoraCorrectionParameters
@@ -43,7 +43,10 @@ def __init__(self):
4343
def add_noises(self, layer_name: str, value: float):
4444
self._noise_per_layer[layer_name] = value
4545

46+
@skip_if_dependency_unavailable(dependencies=["matplotlib.pyplot"])
4647
def dump_data(self):
48+
import matplotlib.pyplot as plt
49+
4750
if not self._noise_per_layer:
4851
return
4952
dump_dir = Path(DEBUG_LOG_DIR) / "lora"

0 commit comments

Comments
 (0)