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

fixed "TypeError: 'NoneType' object is not iterable" for reward model… #3587

Merged
merged 1 commit into from
Jul 21, 2023
Merged

Conversation

egg-west
Copy link
Contributor

During training the reward model using the oasst dataset, using the following command:

python trainer_rm.py --configs defaults_rm oasst-rm-1-pythia-1.4b

the data loader raises an error:
TypeError: 'NoneType' object is not iterable

│ Open-Assistant/model/model_training/custom_datasets/oasst_dataset.py:102 in leaf_filter│
│                                                                                        │
│    99   │   │   │   │   # their (ranked) replies as possible continuations.            │
│   100   │   │   │   │   return (                                                       │
│   101   │   │   │   │   │   thread[-1].role == "prompter"                              │
│ > 102   │   │   │   │   │   and len([r for r inthread[-1].replies if r.rank is not None]) > 1                     │
│   103   │   │   │   │   │   and thread_filter(thread)                                  │
│   104   │   │   │   │   )                                                              │
│   105   │   │   │   elif mode == "rl":                                                 │
╰────────────────────────────────────────────────────────────────────────────────────────╯

I inserted a condition in line 100 as below to fix this issue and submit this PR

if thread[-1].replies is None:
    return False

Copy link
Collaborator

@andreaskoepf andreaskoepf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@andreaskoepf andreaskoepf merged commit 11a1842 into LAION-AI:main Jul 21, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

OA dataloader raises an error when training the reward model
2 participants