Docker Installation

Build the Dockerfile and tag the created image as gpt-2:

docker build --tag gpt-2 -f Dockerfile.gpu . # or Dockerfile.cpu

Start an interactive bash session from the gpt-2 docker image.

You can opt to use the --runtime=nvidia flag if you have access to a NVIDIA GPU and a valid install of nvidia-docker 2.0.

docker run --runtime=nvidia -it gpt-2 bash

AttributeError: module ‘tensorflow’ has no attribute ‘xxxx’的错误,重新卸载和安装tensorflow即可。:

1,pip uninstall tensorflow

2,pip install tensorflow




python3 src/ | tee samples

这段命令行的意思是,| 这个通道符号之前是主要的调用代码,无限制生成文本片段,tee 是 linux 下的一个命令行工具,用于将产生的文本重定向到文件 samples 中。第二种运行模式是用几个参数改变无限制生成文本的特性,

python3 src/ --top_k 40 --temperature 0.7 | tee samples

其中最重要的那个参数可能是 temperature (温度), 这个参数调节输出的随机性,温度越高,随机性越强,越低,出现copy训练语料里说过的话的几率就越大。具体实现应该是从 logits 到字典中字的 index 计算的 softmax 函数中加入温度参数 T,


第三种运行模式, 交互式按照用户提示生成文本片段,这种模式最有意思,也是我们要调戏的对象。调用代码是,

python3 src/


Model prompt >>> Snow White and Transformers
======================================== SAMPLE 1 ========================================
: The Last Knight as the Bundles. Released in Japan in 1999 as The Predatory White, this manga Jamie appears to be made by Santa Claus.

In Friends: Firstly we find out that Jamie has successfully become an adult, despite being struggling with bankruptcy and all that, it seems. While young and seemingly used to working alone, he falls for the woman who treats her much better than other characters.

But wait no more, she fights after Jamie and soon falls in love with Daisy. It doesn’t take that long to make out even more love back in Nicholas Cage connection but it’s written in cadence so it’s not really that long back.

On Nicholas Cage, Jamie is finally embracing the role that he was actually engaged in as a teenager: He watched the Brown Brothers The Shawshank Redemption and that made him Titanite. It wasn’t until the same film that he completely succumbed to cowardice, rather in the way he said “Hey, this is why I have a skirt now, I’m not sure if it does any good. I’m starting to wonder if this is a animalistic mature woman. However, to serve men, they’re way too similar. It’s like a beautiful woman rather than the same bitch that had nothing to do with the man. Which being true, I’d never normally argue for this.”

Appear in Halloween 6th as a Regent of the Wardrobe, now standing in he saves Henry from being devastated by the title to Baby Belle.

Jamie in Space solves crises, saving Captain Race from mutated beasts throwing the latter super mutants into space.

In Uprising, in juxtaposing the monsters running through space to the drill that takes Charlie as the leader, Jamie sidesteps the danger through cryptic symbols by blending human emotions into his scattered messages—I ♡ A good way to pray. Boo Boo!

In Guys Who Wear Mini Hats, Jamie rescues rescuers: Jay McLean and Robbie Bar-Sotto.

In Moombaine’s Boarding Line of Asteroids, Jamie is found trying to figure out what’s going on behind the underground ship Icarus when Kitty Pope comes back. Initially the plot hinges on if “I cannot” being a signal to Cygnus with tubes coming in. However, one scene simply made sense, putting pressure on to Kitty by going back to Icarus. So why is the second handled the more foolish way.

Jamie is now raising Kitty Papillon up as a guide


电子邮件地址不会被公开。 必填项已用*标注