GPT-2M ecompasses an effort to turn OpenAI's GPT-2 developer example into something that can be used with more ease and further extend it's uses towards creative and artisitc means.
- Text based menu for controlling GPT-2M
- Support for importing starting samples from a file
- Support for exporting generated text to a file
- Introduce support for Tensor 2.*
- Provide a more user friendly installation process
Instructions adapted and corrected from a Medium article found here. See Developers.md for more information.
- Download this repo.
- Ensure you have Python 3.7 64bit installed.
- On Windows, it's helpful to check
Add Python (VERSION) to PATH
. - You should also check to see if your system is linked to use
python
orpython3
in the command line to use Python 3. - The version of each command can be checked with
python -V
orpython3 -V
.
- On Windows, it's helpful to check
- Open a command window in the GPT-2M Directory.
- Run
$ pip install -r .\requirements.txt
ensuring thatpip
relates to the one installed for Python 3.- An error can occur stating
Microsoft Visual C++ 14.0 is required
.- Scroll down to
Build Tools for Visual Studio 2019
here. - Download and run the installer.
- Check off
C++ build tools
under theWorkloads
top header. - Click
Install
in the bottom right. - Restart the computer when prompted and try this step's pip command again.
- Scroll down to
- You may also need to run
$ pip install --upgrade setuptools
after installing the C++ Build Tools.
- An error can occur stating
- Run
$ pip install tensorflow-gpu==1.15.0
to install the 1.15.0 (not the most recent) TensorFlow enviroment to your Python 3.7.* installation with GPU priority.- Remove the
-gpu
text to install without GPU priority.
- Remove the
- Run
$ python download_model.py 774M
to download the GPT-2 data model.- You should replace
python
withpython3
in all following inputs if that is how yourPATHS
are setup. - You can also replace
774M
with335M
or124M
if you want a smaller model download file size but reduced accuracy.
- You should replace
- Run
$ python \src\interactive_conditional_samples.py --model_name 774M --top_k 40 --tempurature 0.8
to test the output.- You will be prompted (after some warnings) with
Model prompt >>>
. Enter whatever text you want the system to finish here.- After hitting
Enter
the program will run for a while and eventually return a text sample to the console.
- After hitting
- Hit
CTRL+C
to exit the execution.
- You will be prompted (after some warnings) with
- Code and models from the paper "Language Models are Unsupervised Multitask Learners".
- GPT-2 was originally written under OpenAI.
- Released by OpenAI under the MIT License.