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

Key Error in Notebook '04-gpt2-sentiment-ppo-training.ipynb' #37

Closed
philn21 opened this issue Jun 20, 2022 · 3 comments
Closed

Key Error in Notebook '04-gpt2-sentiment-ppo-training.ipynb' #37

philn21 opened this issue Jun 20, 2022 · 3 comments

Comments

@philn21
Copy link

philn21 commented Jun 20, 2022

Hi Leandro,

I was running the notebook '04-gpt2-sentiment-ppo-training.ipynb' for the first time, and received a Key Error when running the training loop section. It was in this line:

rewards = torch.tensor([output[1]["score"] for output in pipe_outputs]).to(device)

I presume it is safe to omit the '[1]'?
rewards = torch.tensor([output["score"] for output in pipe_outputs]).to(device)

Thanks in advance and best,
Philip

@lvwerra
Copy link
Member

lvwerra commented Dec 7, 2022

Will have a look!

@22Mukesh22
Copy link

Hi @lvwerra Any fix on the above error ?

I was running the notebook '04-gpt2-sentiment-ppo-training.ipynb' for the first time, and received a Key Error when running the training loop section. It was in this line:

rewards = torch.tensor([output[1]["score"] for output in pipe_outputs]).to(device)

I presume it is safe to omit the '[1]'?
rewards = torch.tensor([output["score"] for output in pipe_outputs]).to(device)

@lvwerra
Copy link
Member

lvwerra commented Jan 30, 2023

It should be fixed now!

@lvwerra lvwerra closed this as completed Jan 30, 2023
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

3 participants