How to Install OpenAI GPT-2 on Silicon Mac M1/M2.

Опубликовано: 29 Январь 2023
на канале: Carlos Cloud & Web Developer
3,060
45

#MacOs #Python #GPT-2 #M1
This is a tutorial that will show you how to install GPT-2 on Silicon Macs.

Commands used in this video:
To make a virtual environment in python 3.6 (it must be 3.6 for this tutorial to work):
python -m venv venv

Activate the Venv:
. venv/bin/activate

Upgrade Pip:
pip install --upgrade pip

Clone GPT-2 Repo:
git clone https://github.com/openai/gpt-2.git

Change requirements txt for regex in requirements.txt to:
regex == 2021.9.30

Install requirements:
pip install -r requirements.txt

Download your desired model (124M in this video but you can also choose 355M, 774M, and 1558M:
python3 download_model.py 124M

Install the special version of TensorFlow 1.5.0 for mac cpu. Careful, this link may be modified by youtube so refer to the pinned comment in the comments sections if you have problems.
pip install https://storage.googleapis.com/tensor...

Fix the sort command:
sudo sed -ie s/sort\(/contrib\.framework\.sort\(/g src/sample.py

By the way, this is a Linux command that uses the sed utility to modify the contents of a file. The -ie options tell sed to edit the file in-place and to use extended regular expressions. The s/sort\(/contrib\.framework\.sort\(/g argument is a search-and-replace operation, which will replace all occurrences of sort( with contrib.framework.sort( in the file src/sample.py.

Run GPT-2:
python3 src/interactive_conditional_samples.py --top_k 40

==
👍🏻 DON'T FORGET TO LIKE COMMENT AND SUBSCRIBE FOR FUTURE VIDEOS!
*********
📲💻Follow me on Twitter:
@CarlosCloudDev
📲💻Follow me on Instagram:
@CarlosSalazarDev
**********


Смотрите видео How to Install OpenAI GPT-2 on Silicon Mac M1/M2. онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Carlos Cloud & Web Developer 29 Январь 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,060 раз и оно понравилось 45 людям.