Skip to content

TypeError: __init__() missing 2 required positional arguments: 'doc' and 'pos' #483

@pushpalatha1405

Description

@pushpalatha1405

Notice

There are several common situations in the reimplementation issues as below

  1. Reimplement a model in the model zoo on other dataset (e.g., custom datasets)

when iam training the mmocr SDMGR model on the custom dataset, getting above error . I have created my custom dataset in the annotation form same as wildreceipt dataset annotation form.

Checklist

  1. I have searched related issues but cannot get the expected help.
    pls help me to resolve the above type error.I will be sending the train.txt and config file which iam using.Let me know where iam making mistake, as iam not able to train SDMGR model
    train.txt.txt
    model.txt
    on my custom dataset.

Describe the issue

A clear and concise description of what the problem you meet and what have you done.

Reproduction

  1. What command or script did you run?

python /disk2/mmocr/tools/train.py /disk2/mmocr/configs/kie/sdmgr/sdmgr_unet16_60e_wildinvoice.py --work-dir /disk2/mmocr/sdmgr_invoice --gpu-ids 0

  1. What config dir you run?

/configs/sdmgr_unet16_60e_wildinvoice.py , a bit modified script according to my custom dataset, similar to /configs/sdmgr_unet16_60e_wildreceipt.py.

  1. Did you make any modifications on the code or config? Did you understand what you have modified?
    yes i will be sharing the config file which i have modified to suite my custom dataset

  2. What dataset did you use?
    Invoice dataset

Error:
2021-09-07 14:51:07,611 - mmocr - INFO - workflow: [('train', 1)], max: 1 epochs
2021-09-07 14:51:10,040 - mmocr - INFO - Exp name: sdmgr_unet16_60e_wildinvoice.py
2021-09-07 14:51:10,040 - mmocr - INFO - Epoch [1][1/1] lr: 1.000e-03, eta: 0:00:00, time: 2.426, data_time: 2.115, memory: 677, loss_node: 2.6707, loss_edge: 0.7658, acc_node: 0.0000, acc_edge: 0.0000, loss: 3.4365
2021-09-07 14:51:10,065 - mmocr - INFO - Saving checkpoint at 1 epochs
[>>>>>>>>>>>>>>>>>>>>>>>>> ] 1/2, 5.3 task/s, elapsed: 0s, ETA: 0sTraceback (most recent call last):
File "/disk2/mmocr/tools/train.py", line 221, in
main()
File "/disk2/mmocr/tools/train.py", line 217, in main
meta=meta)
File "/disk2/mmocr/mmocr/apis/train.py", line 163, in train_detector
runner.run(data_loaders, cfg.workflow)
File "/disk2/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run
epoch_runner(data_loaders[i], **kwargs)
File "/disk2/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 54, in train
self.call_hook('after_train_epoch')
File "/disk2/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/base_runner.py", line 307, in call_hook
getattr(hook, fn_name)(self)
File "/disk2/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/hooks/evaluation.py", line 220, in after_train_epoch
self._do_evaluate(runner)
File "/disk2/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmdet/core/evaluation/eval_hooks.py", line 17, in _do_evaluate
results = single_gpu_test(runner.model, self.dataloader, show=False)
File "/disk2/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmdet/apis/test.py", line 25, in single_gpu_test
for i, data in enumerate(data_loader):
File "/disk2/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 363, in next
data = self._next_data()
File "/disk2/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 971, in _next_data
return self._process_data(data)
File "/disk2/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1014, in _process_data
data.reraise()
File "/disk2/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/_utils.py", line 395, in reraise
raise self.exc_type(msg)
TypeError: init() missing 2 required positional arguments: 'doc' and 'pos'

.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions