<jupyter_start><jupyter_text>Github code test following the readme from:https://github.com/huggingface/pytorch-pretrained-BigGAN/<jupyter_code>!pip install pytorch-pretrained-biggan
!mkdir generated_images
import torch
from pytorch_pretrained_biggan import (BigGAN, one_hot_from_names, truncated_noise_sample,
                                       convert_to_images, save_as_images, display_in_terminal)
from IPython.display import Image
import nltk
nltk.download('wordnet')

img_size = 256 # 128, 256 or 512

# Load pre-trained model tokenizer (vocabulary)
model = BigGAN.from_pretrained('biggan-deep-{}'.format(img_size))

# Prepare a input
truncation = 0.4
class_vector = one_hot_from_names(['iPod', 'mountain bike', "jack-o'-lantern"], batch_size=3)
noise_vector = truncated_noise_sample(truncation=truncation, batch_size=3)

# All in tensors
noise_vector = torch.from_numpy(noise_vector)
class_vector = torch.from_numpy(class_vector)

# Generate an image
with torch.no_grad():
    output = model(noise_vector, class_vector, truncation)

# Save results as png images
save_as_images(output, 'generated_images/output')
# Display results
import matplotlib.pyplot as plt
import matplotlib.image as mpimg

for i in range(3):
  image = mpimg.imread("generated_images/output_%d.png" % i)
  plt.imshow(image)
  plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09792284866468842, 'fraction_numerical': 0.012611275964391691, 'mean_word_length': 5.678217821782178, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '514035', 'license': 'MIT', 'n_tokens_mistral': 487, 'n_tokens_neox': 454, 'n_words': 98, 'path': 'HuggingFace/BigGan_handsonai_1.ipynb', 'repo_name': 'numediart/ImageSynthesis', 'size': '1348'}