Incorrect padding & cuda oom

when using agent with remote=True, I got error : Incorrect padding.
how could I fix it?
this is the code:

from transformers import OpenAiAgent
openai_api_key = ‘xxx’
agent = OpenAiAgent(model=“text-davinci-003”, api_key=openai_api_key)
agent.run(‘create a picture of rivers and lakes’, remote=True)

And how could I fix cuda oom, just give me the code?
I have tried this:

import torch
torch.cuda.empty_cache()

but it’s useless, if I don’t rebot the jupyter kernel.