Skip to content

Commit

Permalink
replied to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsu52 committed Oct 25, 2023
1 parent 3056252 commit 8fce7a7
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import numpy as np
import onnx
import openvino.runtime as ov
import openvino as ov
import torch
from fastdownload import FastDownload
from fastdownload import download_url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from typing import Any, Dict, Iterable, List, Optional, Tuple

import numpy as np
import openvino.runtime as ov
import openvino as ov
import torch
from anomalib.data.mvtec import MVTec
from anomalib.data.utils import download
Expand Down Expand Up @@ -169,6 +169,10 @@ def transform_fn(data_item):
print(f"[1/7] Save FP32 model: {fp32_ir_path}")
fp32_size = get_model_size(fp32_ir_path, verbose=True)

# To avoid an accuracy drop when saving a model due to compression of unquantized
# weights to FP16, compress_to_fp16=False should be used. This is necessary because
# nncf.quantize_with_accuracy_control(...) keeps the most impactful operations within
# the model in the original precision to achieve the specified model accuracy.
int8_ir_path = f"{ROOT}/stfpm_int8.xml"
ov.save_model(ov_quantized_model, int8_ir_path, compress_to_fp16=False)
print(f"[2/7] Save INT8 model: {int8_ir_path}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from typing import List, Optional

import numpy as np
import openvino.runtime as ov
import openvino as ov
import torch
from fastdownload import FastDownload
from sklearn.metrics import accuracy_score
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import Any, Dict, Tuple

import numpy as np
import openvino.runtime as ov
import openvino as ov
import torch
from tqdm import tqdm
from ultralytics.cfg import get_cfg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from typing import Any, Dict, Tuple

import numpy as np
import openvino.runtime as ov
import openvino as ov
import torch
from tqdm import tqdm
from ultralytics.cfg import get_cfg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from typing import List, Optional

import numpy as np
import openvino.runtime as ov
import openvino as ov
import torch
from fastdownload import FastDownload
from openvino.tools import mo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import nncf
from nncf.torch import disable_tracing

import openvino.runtime as ov
import openvino as ov
import torch
import torchvision
from fastdownload import FastDownload
Expand Down

0 comments on commit 8fce7a7

Please sign in to comment.