caption cog notebook

This commit is contained in:
Victor Hall 2024-03-24 09:30:23 -04:00
parent 056de840d0
commit 93659f3eb4
1 changed files with 37 additions and 10 deletions

View File

@ -23,10 +23,14 @@
"outputs": [],
"source": [
"# install dependencies\n",
"!pip install huggingface-hub\n",
"!pip install transformers\n",
"!pip install pynvml\n",
"!pip install colorama"
"!pip install huggingface-hub -q\n",
"!pip install transformers -q\n",
"!pip install pynvml -q\n",
"!pip install colorama -q\n",
"!pip install peft -q\n",
"!pip install bitsandbytes -q\n",
"!pip install einops -q\n",
"!pip install xformers -q"
]
},
{
@ -38,7 +42,8 @@
"# Colab only setup (do NOT run for docker/runpod/vast)\n",
"!git clone https://github.com/victorchall/EveryDream2trainer\n",
"%cd EveryDream2trainer\n",
"%mkdir -p /content/EveryDream2trainer/input"
"%mkdir -p /content/EveryDream2trainer/input\n",
"%cd /content/EveryDream2trainer"
]
},
{
@ -71,6 +76,17 @@
" tar_ref.extractall(input_folder)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"## Connect Gdrive (Optional, will popup a warning)\n",
"from google.colab import drive\n",
"drive.mount('/content/drive')"
]
},
{
"attachments": {},
"cell_type": "markdown",
@ -78,9 +94,8 @@
"source": [
"## Run captions.\n",
"\n",
"Place your images in \"input\" folder, or you can change the data_root to point to a Gdrive folder.\n",
"\n",
"Run either the 24GB or 16GB model or adjust settings on your own."
"Place your images in \"input\" folder, or you can change the image_dir to point to a Gdrive folder.\n",
"\n"
]
},
{
@ -92,7 +107,7 @@
"# 16GB GPU, must not use more than 1 beam\n",
"# 24GB GPU, can use 3 beams\n",
"%cd /content/EveryDream2trainer\n",
"%run caption_cog.py --image_dir \"input\" --num_beams 1 --prompt \"Write a description.\""
"%run caption_cog.py --image_dir \"input\" --num_beams 1 --prompt \"Write a description.\" --no_overwrite"
]
},
{
@ -103,8 +118,20 @@
"source": [
"# This is a fancier version of above with more options set\n",
"%cd /content/EveryDream2trainer\n",
"%run caption_cog.py --image_dir \"input\" --num_beams 1 --prompt \"Write a description.\" --starts_with \"An image of\" --remove_starts_with --temp 0.9 --top_p 0.9 --top_k 40 --bad_words \"depicts,showcases,appears,suggests\""
"%run caption_cog.py --image_dir \"input\" --num_beams 1 \\\n",
" --prompt \"Write a description.\" \\\n",
" --starts_with \"An image of\" --remove_starts_with \\\n",
" --temp 0.9 --top_p 0.9 --top_k 40 \\\n",
" --bad_words \"depicts,showcases,appears,suggests\" \\\n",
" --no_overwrite "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {