-
-
Save DGaffney/0f9bcd1fdef27bdf72f2b0740c2522a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import urllib | |
import pathlib | |
import requests | |
from aitextgen import aitextgen | |
manifest_url = "https://cdn.discordapp.com/attachments/810918431142576201/810936686250557511/manifest.json" | |
download_dir = "download" | |
pathlib.Path(download_dir).mkdir(parents=True, exist_ok=True) | |
def request(url, user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0"): | |
return requests.get(url, headers={'user-agent': user_agent}).text | |
manifest = json.loads(json.loads(request(manifest_url))) | |
for file in manifest["urls_to_download"]: | |
content = request(file['response']['attachments'][0]['url']) | |
with open(download_dir+"/"+file['filename'], "w") as f: | |
f.write(content) | |
commands = [f"cat {download_dir}/base64_gpt2_split* > base64_gpt2_unsplit.bin", "base64 -d base64_gpt2_unsplit.bin > pytorch_rebuilt.bin", f"base64 -d {download_dir}/config_base64.json > config.json"] | |
for command in commands: | |
os.popen(command).read() | |
from aitextgen import aitextgen | |
ai = aitextgen(model="pytorch_rebuilt.bin", config="config.json") | |
ai.generate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment