Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行yoloe离线量化失败 #1891

Open
Dimweaker opened this issue Aug 3, 2024 · 0 comments
Open

运行yoloe离线量化失败 #1891

Dimweaker opened this issue Aug 3, 2024 · 0 comments
Assignees

Comments

@Dimweaker
Copy link

Dimweaker commented Aug 3, 2024

利用example里yoloe的全量化代码,使用自己的数据集进行量化,遇到如下问题

I0803 17:00:04.758946  7608 program_interpreter.cc:212] New Executor is Running.
loading annotations into memory...
Done (t=0.01s)
creating index...
index created!
[08/03 17:00:04] ppdet.data.source.coco INFO: Load [1236 samples valid, 0 samples invalid] in file /root/autodl-tmp/voc_train.json.
W0803 17:00:04.825512  7608 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 8.9, Driver API Version: 12.4, Runtime API Version: 11.3
W0803 17:00:04.827611  7608 gpu_resources.cc:164] device: 0, cuDNN Version: 8.2.
Traceback (most recent call last):
  File "/root/miniconda3/lib/python3.8/site-packages/paddleslim-2.6.0-py3.8.egg/paddleslim/quant/quanter.py", line 617, in quant_post_static
  File "/root/miniconda3/lib/python3.8/site-packages/paddle/static/quantization/post_training_quantization.py", line 315, in __init__
    assert isinstance(
AssertionError: data_loader only accepts `paddle.io.DataLoader`.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "post_quant.py", line 107, in <module>
    main()
  File "post_quant.py", line 80, in main
    quant_post_static(
  File "/root/miniconda3/lib/python3.8/site-packages/paddleslim-2.6.0-py3.8.egg/paddleslim/quant/quanter.py", line 644, in quant_post_static
  File "/root/miniconda3/lib/python3.8/site-packages/paddle/static/quantization/post_training_quantization.py", line 315, in __init__
    assert isinstance(
AssertionError: data_loader only accepts `paddle.io.DataLoader`.

其中,我注意到实例代码里使用的数据加载写法是

def reader_wrapper(reader, input_list):
    def gen():
        for data in reader:
            in_dict = {}
            if isinstance(input_list, list):
                for input_name in input_list:
                    in_dict[input_name] = data[input_name]
            elif isinstance(input_list, dict):
                for input_name in input_list.keys():
                    in_dict[input_list[input_name]] = data[input_name]
            yield in_dict

    return gen

...

    train_loader = create('EvalReader')(reader_cfg['TrainDataset'],
                                        reader_cfg['worker_num'],
                                        return_list=True)

    train_loader = reader_wrapper(train_loader, global_config['input_list'])

最终得到是一个function,这是正确的数据载入写法吗?
是否有reader转为DataLoader的快捷方法?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants