question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

assertion error in data loader while converting to int8

See original GitHub issue

I trained “faster_rcnn_fbnetv3g_fpn” on custom dataset. And model trained successfully. but receiving this error while converting to int8.

code I am using to convert:

import copy
from detectron2.data import build_detection_test_loader
from d2go.export.api import convert_and_export_predictor
from d2go.tests.data_loader_helper import create_fake_detection_data_loader
from d2go.export.d2_meta_arch import patch_d2_meta_arch

import logging

# disable all the warnings
previous_level = logging.root.manager.disable
logging.disable(logging.INFO)

patch_d2_meta_arch()

cfg_name = 'faster_rcnn_fbnetv3g_fpn.yaml'
pytorch_model = model_zoo.get(cfg_name, trained=True)
pytorch_model.cpu()

with create_fake_detection_data_loader(224, 320, is_train=False) as data_loader:
    predictor_path = convert_and_export_predictor(
            model_zoo.get_config(cfg_name),
            copy.deepcopy(pytorch_model),
            "torchscript_int8@tracing",
            './',
            data_loader,
        )

# recover the logging level
logging.disable(previous_level)

The error I am receiving:

WARNING [03/16 06:34:40 mobile_cv.arch.utils.helper]: Arguments ['width_divisor', 'dw_skip_bnrelu', 'zero_last_bn_gamma'] skipped for op Conv2d
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py:477: UserWarning: This DataLoader will create 4 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary.
  cpuset_checked))
/usr/local/lib/python3.7/dist-packages/torch/quantization/observer.py:123: UserWarning: Please use quant_min and quant_max to specify the range for observers.                     reduce_range will be deprecated in a future release of PyTorch.
  reduce_range will be deprecated in a future release of PyTorch."
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-19-46e25055929a> in <module>()
     23             "torchscript_int8@tracing",
     24             './',
---> 25             data_loader,
     26         )
     27 

/usr/local/lib/python3.7/dist-packages/d2go/export/api.py in convert_and_export_predictor(cfg, pytorch_model, predictor_type, output_dir, data_loader)
     98             pytorch_model = post_training_quantize(cfg, pytorch_model, data_loader)
     99             # only check bn exists in ptq as qat still has bn inside fused ops
--> 100             assert not fuse_utils.check_bn_exist(pytorch_model)
    101         logger.info(f"Converting quantized model {cfg.QUANTIZATION.BACKEND}...")
    102         if cfg.QUANTIZATION.EAGER_MODE:

AssertionError: 

I have changed the config file and included the newly registered custom dataset. what could be else wrong here?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
DhruvMakwanacommented, Mar 18, 2021

Thanks issue resolved, closing the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

DLA_STANDALONE error in forceToUseNvmIO
Hi, I'm trying to generate a DLA loadable alone for Resnet18.I get this error when I set config.engine_capability = trt.EngineCapability.
Read more >
Very high error after full integer quantization of a regression ...
You need to shift your data in the domain of the quantized set. In your case, convert your float32 data to int8 in...
Read more >
IO tools (text, CSV, HDF5, …) — pandas 1.5.2 documentation
The parser will raise one of ValueError/TypeError/AssertionError if the JSON is not parseable. If a non-default orient was used when encoding to JSON...
Read more >
C/C++ Assertions - Visual Studio (Windows) - Microsoft Learn
In this article​​ An assertion statement specifies a condition that you expect to be true at a point in your program. If that...
Read more >
Errors due to invalid IDs during Data Loader import and update
Visit the record in the Organization to verify the ID entered. Keep in mind that these IDs are case sensitive. · Manually convert...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found