median-research-group / LibMTL

A PyTorch Library for Multi-Task Learning
MIT License
1.95k stars 182 forks source link

trainer can't work #19

Closed Sakura4036 closed 1 year ago

Sakura4036 commented 1 year ago

when I try to run this trainer , .next() can't run

-> "AttributeError: 'dict_keyiterator' object has no attribute 'next'"

I use: python=3.7 torch=11.3

This method has been deleted in python 3? Why not use next(iter)?

or what should I do to fix it?

image image

Baijiong-Lin commented 1 year ago

Please change torch from version 1.13 to 1.8. It can run.

Sakura4036 commented 1 year ago

OK, thanks. I can try it later.

Sakura4036 commented 1 year ago

I change env to torch 1.8.0, still same error!

image image

Baijiong-Lin commented 1 year ago

What is your run command? Can you run the example like office-31 successfully?

Sakura4036 commented 1 year ago

No, I can't , same error

![Uploading image.png…]()

Sakura4036 commented 1 year ago

image

Baijiong-Lin commented 1 year ago

Office-31 is a multi-input MTL problem where each task has its own input data, thus multi_input should be set as True as follows: python train_office.py --multi_input

Please refer to Docs and README for more detail.

Sakura4036 commented 1 year ago

it can run!

I checked my Dataset and Dataloader, it's similar to the dataset used in LibMTL , it seems no problem

Then what other problems may cause this error?

Baijiong-Lin commented 1 year ago

Do you mean there is still an error when applying LibMTL to your own dataset? Have you defined your own Dataset and Dataloader correctly? Please refer to Docs for the detail about applying LibMTL to a new dataset.

Sakura4036 commented 1 year ago

OK,thanks, I will try it later