Delete NovelAILeaks_API_Backend-EN.ipynb

This commit is contained in:
JingShing 2022-10-16 15:52:13 +08:00 committed by GitHub
parent 3f5c1dca8c
commit 7946183f3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,134 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "KZ88G-iWCTs7"
},
"source": [
"Based on 4chan NovelAILeaks (naifu)[src](https://boards.4channel.org/g/thread/89095460#p89097704)\n",
"\n",
"Credit: https://t.me/StableDiffusion_CN https://t.me/exlolicon\n",
"\n",
"Thanks: Anonymous, 炼铜术士, 神楽坂早苗️, Jonathan, 咕 咕, 猫又逆变器, Gaein nidb\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "X5yF8TS1CR3L"
},
"outputs": [],
"source": [
"#@title ### 0. Check GPU working status\n",
"\n",
"!nvidia-smi"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "iqTO_Uf3F6VW"
},
"outputs": [],
"source": [
"#@title ### 1. Download Novel AI API backend, model\n",
"#@markdown If the download speed is too slow try restart\n",
"\n",
"%cd /content/\n",
"!apt install -y -qq aria2\n",
"!aria2c --summary-interval=5 -x 3 --allow-overwrite=true -Z \\\n",
" https://pub-2fdef7a2969f43289c42ac5ae3412fd4.r2.dev/naifu.tar \\\n",
" https://pub-2fdef7a2969f43289c42ac5ae3412fd4.r2.dev/animefull-latest.tar\n",
" \n",
"!echo \"Decompressing...\"\n",
"!tar xf naifu.tar && rm naifu.tar\n",
"!echo \"Done.\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "BysBfYRmGSo1"
},
"outputs": [],
"source": [
"#@title ### 2. Install dependencies\n",
"#@markdown Wait patiently for the installation to complete\n",
"\n",
"%cd /content/naifu\n",
"!pip install virtualenv && bash ./setup.sh\n",
"!curl -Ls https://github.com/ekzhang/bore/releases/download/v0.4.0/bore-v0.4.0-x86_64-unknown-linux-musl.tar.gz | tar zx -C /usr/bin\n",
"!curl -Lo /usr/bin/cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cloudflared"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "uQBR9zXQGJrn"
},
"outputs": [],
"source": [
"#@title ### 3. Start the model\n",
"#@markdown Just visit the output mapping address (end with `trycloudflare.com` / `bore.pub`).\n",
"#@markdown - Please wait until the model is loaded (`Application startup complete` appears) before accessing\n",
"#@markdown - The service provided by cloudflare occasionally has a request timeout, which can be replaced by bore tunnel\n",
"\n",
"%cd /content/naifu\n",
"!sed -i 's/# export SAVE_FILES=\"1\"/export SAVE_FILES=\"1\"/g' run.sh\n",
"!bash run.sh & cloudflared tunnel --url localhost:6969"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "B9j9thAby5_2"
},
"outputs": [],
"source": [
"#@title ### 4. (Optional) Run with `animefull-latest` model of 7G\n",
"#@markdown uses the 4G size animefull-final-pruned model by default. If you want to use the 7G animefull-latest model, run this\n",
"\n",
"%cd /content/\n",
"!tar xf animefull-latest.tar -C /content/naifu/models && rm animefull-latest.tar\n",
"!sed -i 's/map_location=\"cpu\"/map_location=\"cuda\"/g' /content/naifu/hydra_node/models.py\n",
"\n",
"%cd /content/naifu\n",
"%env DTYPE=float16\n",
"%env CLIP_CONTEXTS=3\n",
"%env AMP=1\n",
"%env MODEL=stable-diffusion\n",
"%env DEV=True\n",
"%env MODEL_PATH=models/animefull-latest\n",
"%env ENABLE_EMA=1\n",
"%env VAE_PATH=models/animevae.pt\n",
"%env PENULTIMATE=1\n",
"%env PYTHONDONTWRITEBYTECODE=1\n",
"%env SAVE_FILES=1\n",
"\n",
"!./venv/bin/python -m uvicorn --host 0.0.0.0 --port=6969 main:app & bore local 6969 --to bore.pub & cloudflared tunnel --url localhost:6969"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"collapsed_sections": [],
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}