question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GPT-2 models are unpickable

See original GitHub issue

🐛 Bug

Information

Model I am using (Bert, XLNet …): GPT-2

Language I am using the model on (English, Chinese …): English

The problem arises when using:

  • the official example scripts: (give details below)
  • my own modified scripts:

Hi,

I’m trying to train a GPT-2 Double Heads Model (based on your transfer-learning-conv-ai guide) using Pytorch Lightning. However I have a problem when trying to train the model on ddp distributed backend : the GPT2DoubleHeadsModel class seems to be unpickable and my training script fails with the following error : TypeError: can't pickle torch._C.ScriptFunction objects

To reproduce

Run :

from transformers import GPT2DoubleHeadsModel
import pickle
model = GPT2DoubleHeadsModel.from_pretrained("gpt2-medium")
pickle.dump(model,open("test.bin","wb"))

The problem does not occur when using bert-base-uncased for example. I tried to search which part of GPT-2 class contains torch._C.ScriptFunction objects without success. Do you have an idea to avoid this error ?

Thanks in advance.

  • transformers version: 2.8
  • Platform: Ubuntu 18.04
  • Python version: 3.7
  • PyTorch version (GPU?): 1.5 Cuda 10.2
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: Yes, ddp

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
LysandreJikcommented, Apr 28, 2020

I understand, this is indeed an issue. We’ve had other several issues due to this, I think it would be better to revert to picklable option. Will open a PR with this objective in a bit.

0reactions
LysandreJikcommented, May 1, 2020

@paramansh Do you mind opening an issue with your specific problem, your software versions and code sample so that we may debug on our side? Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenAI's GPT-2: the model, the hype, and the controversy
Last Thursday, OpenAI released a very large language model called GPT-2. This model can generate realistic text in a variety of styles, ...
Read more >
Why does GPT-2 Exclude the Transformer Encoder?
GPT-2 does not require the encoder part of the transformer architecture because the model uses a masked self-attention that can only look at ......
Read more >
[923] “Unpickable” Europa Disc Padlock Picked FAST (Model ...
[923] “ Unpickable ” Europa Disc Padlock Picked FAST ( Model P-370). 347K views 3 years ago. LockPickingLawyer. LockPickingLawyer.
Read more >
[1299] Unpickable Locks From Stuff Made Here - YouTube
http://www.covertinstruments.comStuff Made Here LinksChannel: https://youtube.com/c/StuffMadeHereLock #1: https://youtu.be/_7vPNcnYWQ4Lock ...
Read more >
AI Boxing (Containment) tag - LessWrong 2.0 viewer
Instead, objectives require the model to infill missing tokens in the ... Best of all, it's completely safe; the locks are unpickable and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found