Unable to run PPLM potato example
Author: nagabudigam
Pull request: no

I am following the instructions mentioned in the below page to run PPLM examples. Unfortunately the code is throwing error. 

PPLM Page : https://github.com/huggingface/transformers/tree/master/examples/research_projects/pplm


**Environment:**
Python 3.9.7
pytorch-lightning==1.0.4


Error Log:
```
python run_pplm.py -B military --cond_text "The potato" --length 50 --gamma 1.5 --num_iterations 3 --num_samples 10 --stepsize 0.03 --window_length 5 --kl_scale 0.01 --gm_scale 0.99 --colorama --sample
= Prefix of sentence =

The potato

Using PPLM-BoW
  0%|                                                                                                                                                                                 | 0/50 [00:00<?, ?it/s
The potato has
  2%|###3                                                                                                                                                                     | 1/50 [00:00<00:29,  1.63it/s]
The potato has been
  4%|######7                                                                                                                                                                  | 2/50 [00:00<00:21,  2.28it/s]
The potato has been in
  6%|##########1                                                                                                                                                              | 3/50 [00:01<00:19,  2.39it/s]
The potato has been in the
  8%|#############5                                                                                                                                                           | 4/50 [00:01<00:16,  2.73it/s]
The potato has been in the news
 10%|################9                                                                                                                                                        | 5/50 [00:01<00:15,  2.89it/s]
The potato has been in the news lately
 12%|####################2                                                                                                                                                    | 6/50 [00:02<00:14,  2.99it/s]
The potato has been in the news lately for
 14%|#######################6                                                                                                                                                 | 7/50 [00:02<00:14,  3.01it/s]
The potato has been in the news lately for its
 16%|###########################                                                                                                                                              | 8/50 [00:02<00:13,  3.01it/s]
The potato has been in the news lately for its alleged
 18%|##############################4                                                                                                                                          | 9/50 [00:03<00:13,  3.01it/s]
The potato has been in the news lately for its alleged role
 20%|#################################6                                                                                                                                      | 10/50 [00:03<00:13,  3.00it/s]
The potato has been in the news lately for its alleged role in
 22%|####################################9                                                                                                                                   | 11/50 [00:03<00:13,  2.89it/s]
The potato has been in the news lately for its alleged role in a
 24%|########################################3                                                                                                                               | 12/50 [00:04<00:13,  2.83it/s]
The potato has been in the news lately for its alleged role in a deadly
 26%|###########################################6                                                                                                                            | 13/50 [00:04<00:13,  2.79it/s]
The potato has been in the news lately for its alleged role in a deadly plague
 28%|###############################################                                                                                                                         | 14/50 [00:05<00:13,  2.76it/s]
The potato has been in the news lately for its alleged role in a deadly plague that
 30%|##################################################4                                                                                                                     | 15/50 [00:05<00:12,  2.72it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed
 32%|#####################################################7                                                                                                                  | 16/50 [00:05<00:12,  2.70it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1
 34%|#########################################################1                                                                                                              | 17/50 [00:06<00:12,  2.64it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,
 36%|############################################################4                                                                                                           | 18/50 [00:06<00:12,  2.57it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400
 38%|###############################################################8                                                                                                        | 19/50 [00:07<00:12,  2.53it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people
 40%|###################################################################2                                                                                                    | 20/50 [00:07<00:11,  2.50it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across
 42%|######################################################################5                                                                                                 | 21/50 [00:07<00:11,  2.47it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe
 44%|#########################################################################9                                                                                              | 22/50 [00:08<00:11,  2.44it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe.
 46%|#############################################################################2                                                                                          | 23/50 [00:08<00:11,  2.36it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It
 48%|################################################################################6                                                                                       | 24/50 [00:09<00:11,  2.31it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's
 50%|####################################################################################                                                                                    | 25/50 [00:09<00:11,  2.25it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a
 52%|#######################################################################################3                                                                                | 26/50 [00:10<00:10,  2.23it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato
 54%|##########################################################################################7                                                                             | 27/50 [00:10<00:10,  2.21it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with
 56%|##############################################################################################                                                                          | 28/50 [00:11<00:10,  2.19it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an
 58%|#################################################################################################4                                                                      | 29/50 [00:11<00:09,  2.14it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate
 60%|####################################################################################################8                                                                   | 30/50 [00:12<00:09,  2.08it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history
 62%|########################################################################################################1                                                               | 31/50 [00:12<00:10,  1.83it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.
 64%|###########################################################################################################5                                                            | 32/50 [00:13<00:10,  1.73it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

 66%|##############################################################################################################8                                                         | 33/50 [00:13<00:09,  1.79it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.


 68%|##################################################################################################################2                                                     | 34/50 [00:14<00:09,  1.72it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In
 70%|#####################################################################################################################6                                                  | 35/50 [00:15<00:09,  1.61it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact
 72%|########################################################################################################################9                                               | 36/50 [00:15<00:08,  1.66it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact,
 74%|############################################################################################################################3                                           | 37/50 [00:16<00:08,  1.54it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes
 76%|###############################################################################################################################6                                        | 38/50 [00:17<00:07,  1.62it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were
 78%|###################################################################################################################################                                     | 39/50 [00:17<00:06,  1.66it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually
 80%|######################################################################################################################################4                                 | 40/50 [00:19<00:08,  1.21it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually bred
 82%|#########################################################################################################################################7                              | 41/50 [00:19<00:07,  1.18it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually bred to
 84%|#############################################################################################################################################1                          | 42/50 [00:21<00:07,  1.09it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually bred to kill
 86%|################################################################################################################################################4                       | 43/50 [00:22<00:06,  1.01it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually bred to kill people
 88%|###################################################################################################################################################8                    | 44/50 [00:22<00:05,  1.08it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually bred to kill people.
 90%|#######################################################################################################################################################2                | 45/50 [00:23<00:04,  1.06it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually bred to kill people. But
 92%|##########################################################################################################################################################5             | 46/50 [00:24<00:03,  1.12it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually bred to kill people. But in
 94%|#############################################################################################################################################################9          | 47/50 [00:25<00:02,  1.09it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually bred to kill people. But in the
 96%|#################################################################################################################################################################2      | 48/50 [00:26<00:01,  1.19it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually bred to kill people. But in the early
 98%|####################################################################################################################################################################6   | 49/50 [00:27<00:00,  1.17it/s]
The potato has been in the news lately for its alleged role in a deadly plague that killed 1,400 people across Europe. It's a potato with an unfortunate history.

In fact, potatoes were actually bred to kill people. But in the early 1800
100%|########################################################################################################################################################################| 50/50 [00:27<00:00,  1.79it/s]
  0%|                                                                                                                                                                                 | 0/50 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/Users/apple/PycharmProjects/streamlit-pplm/transformers/examples/research_projects/pplm/run_pplm.py", line 827, in <module>
    run_pplm_example(**vars(args))
  File "/Users/apple/PycharmProjects/streamlit-pplm/transformers/examples/research_projects/pplm/run_pplm.py", line 663, in run_pplm_example
    unpert_gen_tok_text, pert_gen_tok_texts, _, _ = full_text_generation(
  File "/Users/apple/PycharmProjects/streamlit-pplm/transformers/examples/research_projects/pplm/run_pplm.py", line 389, in full_text_generation
    pert_gen_tok_text, discrim_loss, loss_in_time = generate_text_pplm(
  File "/Users/apple/PycharmProjects/streamlit-pplm/transformers/examples/research_projects/pplm/run_pplm.py", line 499, in generate_text_pplm
    pert_past, _, grad_norms, loss_this_iter = perturb_past(
  File "/Users/apple/PycharmProjects/streamlit-pplm/transformers/examples/research_projects/pplm/run_pplm.py", line 115, in perturb_past
    grad_accumulator = [(np.zeros(p.shape).astype("float32")) for p in past]
  File "/Users/apple/PycharmProjects/streamlit-pplm/transformers/examples/research_projects/pplm/run_pplm.py", line 115, in <listcomp>
    grad_accumulator = [(np.zeros(p.shape).astype("float32")) for p in past]
AttributeError: 'tuple' object has no attribute 'shape'

```

Comments:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.