EveryDream2trainer/Train_Colab.ipynb

591 lines
27 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
},
"source": [
"<a href=\"https://colab.research.google.com/github/nawnie/EveryDream2trainer/blob/main/Train_Colab.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "blaLMSbkPHhG"
},
"source": [
"# EveryDream2 Colab Edition\n",
"\n",
"Check out documentation here: https://github.com/victorchall/EveryDream2trainer#docs\n",
"\n",
"And join the discord: https://discord.gg/uheqxU6sXN"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "WsYIcz9HY9lx"
},
"outputs": [],
"source": [
"#@title # Install python 3.10 \n",
"#@markdown # This will show a runtime error, it's ok, it's on purpose to restart the kernel to update python.\n",
"import os\n",
"import time\n",
"import sys\n",
"from IPython.display import clear_output\n",
"\n",
"\n",
"#@markdown Optional connect Gdrive But strongly recommended\n",
"#@markdown This will let you put all your training data and checkpoints directly on your drive. Much faster/easier to continue later, less setup time.\n",
"\n",
"#@markdown Creates /content/drive/MyDrive/everydreamlogs/ckpt\n",
"Mount_to_Gdrive = True #@param{type:\"boolean\"} \n",
"\n",
"if Mount_to_Gdrive:\n",
" from google.colab import drive\n",
" drive.mount('/content/drive')\n",
"\n",
" !mkdir -p /content/drive/MyDrive/everydreamlogs/ckpt\n",
"\n",
"# Define a custom function to display a progress bar\n",
"def display_progress_bar(progress, total, prefix=\"\"):\n",
" sys.stdout.write(f\"\\r{prefix}[{'=' * progress}>{' ' * (total - progress - 1)}] {progress + 1}/{total}\")\n",
" sys.stdout.flush()\n",
"\n",
"total_steps = 9\n",
"current_step = 0\n",
"\n",
"!pip install transformers==4.25.1 --progress-bar on --quiet\n",
"current_step += 1\n",
"display_progress_bar(current_step, total_steps, \"install progress:\")\n",
"\n",
"\n",
"!pip install watchdog --progress-bar on --quiet\n",
"current_step += 1\n",
"display_progress_bar(current_step, total_steps, \"install progress:\")\n",
"\n",
"!pip install matplotlib --progress-bar on --quiet\n",
"current_step += 1\n",
"display_progress_bar(current_step, total_steps, \"install progress:\")\n",
"\n",
"# Install the alive-package library\n",
"!pip install alive-progress --progress-bar on --quiet\n",
"current_step += 1\n",
"display_progress_bar(current_step, total_steps, \"install progress:\")\n",
"\n",
"\n",
"# Install the tqdm library\n",
"!pip install tqdm --progress-bar on --quiet\n",
"current_step += 1\n",
"display_progress_bar(current_step, total_steps, \"install progress:\")\n",
"\n",
"# Download the py310.sh script\n",
"!wget https://github.com/korakot/kora/releases/download/v0.10/py310.sh -q\n",
"current_step += 1\n",
"display_progress_bar(current_step, total_steps, \"install progress:\")\n",
"\n",
"# Run the py310.sh script\n",
"try:\n",
" output = os.popen('bash ./py310.sh -b -f -p /usr/local 2>&1').read()\n",
" total_lines = len(output.splitlines())\n",
" for i, line in enumerate(output.splitlines()):\n",
" clear_output(wait=True)\n",
" display_progress_bar(i, total_lines, \"install progress:\")\n",
"except Exception as e:\n",
" print(str(e))\n",
"\n",
"current_step += 1\n",
"display_progress_bar(current_step, total_steps, \"install progress:\")\n",
"\n",
"# Install the py310 kernel\n",
"!python -m ipykernel install --name \"py310\" --user > /dev/null 2>&1\n",
"current_step += 1\n",
"display_progress_bar(current_step, total_steps, \"install progress:\")\n",
"\n",
"# Clear output\n",
"!rm /content/py310.sh\n",
"current_step += 1\n",
"display_progress_bar(current_step, total_steps, \"install progress:\")\n",
"clear_output()\n",
"time.sleep(1) #needed to clear is before kill\n",
"os.kill(os.getpid(), 9)\n",
"print(\"\\nInstallation completed.\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "hAuBbtSvGpau"
},
"outputs": [],
"source": [
"#@markdown # Finish Install Dependencies into the new python\n",
"#@markdown This will take a couple minutes, be patient and watch the output for \"DONE!\"\n",
"from IPython.display import clear_output\n",
"import subprocess\n",
"from tqdm.notebook import tqdm\n",
"\n",
"packages = [\n",
" ('torch==1.13.1+cu117 torchvision==0.14.1+cu117', 'https://download.pytorch.org/whl/cu117'),\n",
" 'transformers==4.25.1',\n",
" 'diffusers[torch]==0.13.0',\n",
" 'pynvml==11.4.1',\n",
" 'bitsandbytes==0.35.0',\n",
" 'ftfy==6.1.1',\n",
" 'aiohttp==3.8.3',\n",
" 'tensorboard>=2.11.0',\n",
" 'protobuf==3.20.1',\n",
" 'wandb==0.13.6',\n",
" 'pyre-extensions==0.0.23',\n",
" 'xformers==0.0.16',\n",
" 'pytorch-lightning==1.6.5',\n",
" 'OmegaConf==2.2.3',\n",
" 'numpy==1.23.5',\n",
" 'colorama',\n",
" 'keyboard',\n",
" 'triton',\n",
" 'lion-pytorch',\n",
" 'compel'\n",
"]\n",
"\n",
"for package in tqdm(packages, desc='Installing packages', unit='package'):\n",
" if isinstance(package, tuple):\n",
" package_name, extra_index_url = package\n",
" cmd = f\"pip install -q {package_name} --extra-index-url {extra_index_url}\"\n",
" else:\n",
" cmd = f\"pip install -q {package}\"\n",
" \n",
" subprocess.run(cmd, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n",
"\n",
"clear_output()\n",
"\n",
"!git clone https://github.com/victorchall/EveryDream2trainer.git\n",
"%cd /content/EveryDream2trainer\n",
"!python utils/get_yamls.py\n",
"clear_output()\n",
"print(\"DONE! installing dependcies make sure we are using python 3.10.x\")\n",
"!python --version"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "unaffeqGP_0A"
},
"outputs": [],
"source": [
"#@title Get A Base Model\n",
"#@markdown Choose SD1.5, Waifu Diffusion 1.3, SD2.1, or 2.1(512) from the dropdown, or paste your own URL in the box\n",
"#@markdown * alternately you can link to a HF repo using NAME/MODEL\n",
"#@markdown * link to a set of diffusers on your Gdrive\n",
"#@markdown * paste a url, atm there is no support for .safetensors\n",
"\n",
"from IPython.display import clear_output\n",
"!mkdir input\n",
"%cd /content/EveryDream2trainer\n",
"MODEL_LOCATION = \"sd_v1-5+vae.ckpt\" #@param [\"sd_v1-5+vae.ckpt\", \"hakurei/waifu-diffusion-v1-3\", \"stabilityai/stable-diffusion-2-1-base\", \"stabilityai/stable-diffusion-2-1\"] {allow-input: true}\n",
"if MODEL_LOCATION == \"sd_v1-5+vae.ckpt\":\n",
" MODEL_LOCATION = \"panopstor/EveryDream\"\n",
"\n",
"import os\n",
"\n",
"download_path = \"\"\n",
"\n",
"if \".co\" in MODEL_LOCATION or \"https\" in MODEL_LOCATION or \"www\" in MODEL_LOCATION: #maybe just add a radio button to download this should work for now\n",
" print(\"Downloading \")\n",
" !wget $MODEL_LOCATION\n",
" clear_output()\n",
" print(\"DONE!\")\n",
" download_path = os.path.join(os.getcwd(), os.path.basename(MODEL_URL))\n",
"\n",
"else:\n",
" save_name = MODEL_LOCATION\n",
"\n",
"%cd /content/EveryDream2trainer\n",
"#@markdown * if you chose to link to a .ckpt Select the correct model version in the drop down menu for conversion\n",
"\n",
"inference_yaml = \" \"\n",
"\n",
"# Check if the downloaded or copied model is a .ckpt file\n",
"#@markdown is the model 1.5 or 2.1 based\n",
"if download_path.endswith(\".ckpt\"):\n",
" model_type = \"SD1x\" #@param [\"SD1x\", \"SD2_512_base\", \"SD21\"]\n",
" save_path = download_path\n",
" if \".ckpt\" in save_name:\n",
" save_name = save_name.replace(\".ckpt\", \"\")\n",
"\n",
" img_size = 512\n",
" upscale_attention = False\n",
" prediction_type = \"epsilon\"\n",
" if model_type == \"SD1x\":\n",
" inference_yaml = \"v1-inference.yaml\"\n",
" elif model_type == \"SD2_512_base\":\n",
" upscale_attention = True\n",
" inference_yaml = \"v2-inference.yaml\"\n",
" elif model_type == \"SD21\":\n",
" upscale_attention = True\n",
" prediction_type = \"v_prediction\"\n",
" inference_yaml = \"v2-inference-v.yaml\"\n",
" img_size = 768\n",
"\n",
" !python utils/convert_original_stable_diffusion_to_diffusers.py --scheduler_type ddim \\\n",
" --original_config_file $inference_yaml \\\n",
" --image_size $img_size \\\n",
" --checkpoint_path $save_path \\\n",
" --prediction_type $prediction_type \\\n",
" --upcast_attn False \\\n",
" --dump_path $save_name\n",
"\n",
" # Set the save path to the GDrive directory if cache_to_gdrive is True\n",
" if cache_to_gdrive:\n",
" save_name = os.path.join(\"/content/drive/MyDrive/everydreamlogs/ckpt\", save_name)\n",
"if inference_yaml != \" \":\n",
" print(\"Model saved to: \" + save_name + \". The \" + inference_yaml + \" was used!\")\n",
"print(\"Model \" + save_name + \" will be used!\")\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "EHyFzKWXX9kB"
},
"source": [
"# Training\n",
"\n",
"For a more indepth Explanation of each of these paramaters check out /content/EveryDream2trainer/doc.\n",
"\n",
"After youve tried a few models you will find /content/EveryDream2trainer/doc/ADVANCED_TWEAKING.md to be extremly helpful."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "j9pEI69WXS9w"
},
"outputs": [],
"source": [
"from google.colab import runtime\n",
"from IPython.display import clear_output\n",
"import time\n",
"from tqdm import tqdm\n",
"import re\n",
"import sys\n",
"import time\n",
"import shutil\n",
"\n",
"#@title #Run Everydream 2\n",
"%cd /content/EveryDream2trainer\n",
"#@markdown If you want to use a .json config or upload your own, skip this cell and run the cell below instead\n",
"!rm -r /content/EveryDream2trainer/Training_Data\n",
"#@markdown * Save logs and output ckpts to Gdrive (strongly suggested)\n",
"Save_to_Gdrive = True #@param{type:\"boolean\"}\n",
"#@markdown * Disconnect after training to save Credits \n",
"Disconnect_after_training = False #@param{type:\"boolean\"}\n",
"#@markdown * Use resume to contnue training you just ran, will also find latest diffusers log in your Gdrive to continue.\n",
"resume = False #@param{type:\"boolean\"}\n",
"#@markdown * Name your project so you can find it in your logs\n",
"Project_Name = \"My_Project\" #@param{type: 'string'}\n",
"\n",
"#@markdown * The learning rate affects how much \"training\" is done on the model per training step. It is a very careful balance to select a value that will learn your data and not wreck the model. \n",
"#@markdown Leave this default unless you are very comfortable with training and know what you are doing.\n",
"\n",
"Learning_Rate = 1e-6 #@param{type: 'number'}\n",
"\n",
"#@markdown * A learning rate scheduler can change your learning rate as training progresses.\n",
"\n",
"#@markdown I recommend sticking with constant until you are comfortable with general training. \n",
"\n",
"Schedule = \"constant\" #@param [\"constant\", \"polynomial\", \"linear\", \"cosine\"] {allow-input: true}\n",
"\n",
"#@markdown * Resolution to train at (recommend 512). Higher resolution will require lower batch size (below).\n",
"Resolution = 512 #@param {type:\"slider\", min:256, max:768, step:64}\n",
"\n",
"#@markdown * Batch size is also another \"hyperparameter\" of itself and there are tradeoffs. It may not always be best to use the highest batch size possible. Once of the primary reasons to change it is if you get \"CUDA out of memory\" errors where lowering the value may help.\n",
"\n",
"#@markdown * Batch size impacts VRAM use. 8 should work on SD1.x models and 5 for SD2.x models at 512 resolution. Lower this if you get CUDA out of memory errors. You can check resources on your instance and watch the GPU RAM.\n",
"\n",
"Batch_Size = 6 #@param{type: 'number'}\n",
"\n",
"#@markdown * Gradient accumulation is sort of like a virtual batch size increase use this to increase batch size with out increasing vram usage\n",
"#@markdown Increasing from 1 to 2 will have a minor impact on vram use, but more beyond that will not.\n",
"#@markdown In colab free teir you can expect the fastest proformance from a batch of 8 and a gradient step of 1\n",
"#@markdown This is mostly for use if you are training higher resolution on free tier and cannot increase batch size.\n",
"\n",
"Gradient_steps = 1 #@param{type:\"slider\", min:1, max:10, step:1}\n",
"\n",
"#@markdown * Location on your Gdrive where your training images are.\n",
"Dataset_Location = \"/content/drive/MyDrive/training_samples\" #@param {type:\"string\"}\n",
"\n",
"model = save_name\n",
"\n",
"#@markdown * Max Epochs to train for, this defines how many total times all your training data is used. Default of 100 is a good start if you are training ~30-40 images of one subject. If you have 100 images, you can reduce this to 40-50 and so forth.\n",
"\n",
"Max_Epochs = 100 #@param {type:\"slider\", min:0, max:200, step:5}\n",
"\n",
"#@markdown * How often to save checkpoints.\n",
"Save_every_N_epoch = 20 #@param{type:\"integer\"}\n",
"\n",
"#@markdown * Test sample generation steps, how often to generate samples during training.\n",
"\n",
"#@markdown You can set your own sample prompts by adding them, one line at a time, to `/content/EveryDream2trainer/sample_prompts.txt`. If left empty, it will use the captions from your training images.\n",
"\n",
"#@markdown Use the steps_between_samples to set how often the samples are generated.\n",
"Steps_between_samples = 300 #@param{type:\"integer\"}\n",
"\n",
"#@markdown * That's it! Run the cell! or configure these advance options\n",
"\n",
"#@markdown # ________________ ADV SETTINGS _________________\n",
"#@markdown These are the default Every Dream 2 settings, changing these without learning what they do will likley waste compute credits\n",
"#@markdown please read the doc folder before changing these!\n",
"\n",
"#@markdown * A tip using the sliders, to finely adjust these click them with your mouse then use your keyboard arrows\n",
"\n",
"#@markdown * Using the same seed each time you train allows for more accurate a/b comparison of models, leave at -1 for random\n",
"#@markdown * The seed also effects your training samples, if you want the same seed each sample you will need to change it from -1\n",
"Training_Seed = -1 #@param{type:\"integer\"}\n",
"#@markdown * warm up steps are useful for validation and cosine lrs\n",
"Lr_warmup_steps = 20 #@param{type:\"integer\"}\n",
"#@markdown * use this option to configure a sample_prompts.json\n",
"#@markdown * check out /content/EveryDream2trainer/doc/logging.md. for more details\n",
"Advance_Samples = False #@param{type:\"boolean\"}\n",
"Sample_File = \"sample_prompts.txt\"\n",
"if Advance_Samples:\n",
" Sample_File = \"sample_prompts.json\"\n",
"#@markdown * Checkpointing Saves Vram to allow larger batch sizes minor slow down on a single batch size but will can allow room for a higher traning resolution (suggested on Colab Free tier, turn off for A100)\n",
"Gradient_checkpointing = True #@param{type:\"boolean\"}\n",
"Disable_Xformers = False #@param{type:\"boolean\"}\n",
"#@markdown * Tag shuffling, mainly for booru training. Best to just read this if interested in shufflng tags /content/EveryDream2trainer/doc/SHUFFLING_TAGS.md\n",
"shuffle_tags = False #@param{type:\"boolean\"}\n",
"#@markdown * You can turn off the text encoder training (generally not suggested)\n",
"Disable_text_Encoder= False #@param{type:\"boolean\"}\n",
"#@markdown * Skip the nth last layer of CLIP.\n",
"Clip_skip = 1 #@param {type:\"slider\", min:0, max:4, step:1}\n",
"#@markdown * ratio of captions dropped from training data.\n",
"Conditional_DropOut = 0.04 #@param {type:\"slider\", min:0, max:0.3, step:0.01}\n",
"#@markdown * Ratio of images randomly to flip horizontally.\n",
"Picture_flip = 0 #@param {type:\"slider\", min:0, max:0.5, step:0.05}\n",
"#@markdown * This can improve contrast in light and dark scenes, Use a ratio between 0-10% for Best results.\n",
"zero_frequency_noise = 0.05 #@param {type:\"slider\", min:0, max:0.25, step:0.01}\n",
"\n",
"#@markdown * Weights and Biases logging token. \n",
"# #@markdown Paste your token here if you have an account so you can use it to track your training progress. If you don't have an account, you can create one for free at https://wandb.ai/site. Log will use your project name from above. This is a free online logging utility.\n",
"# #@markdown Your key is on this page: https://wandb.ai/settings under \"Danger Zone\" \"API Keys\"\n",
"wandb_token = '' #@param{type:\"string\"}\n",
"wandb_settings = \"\"\n",
"if wandb_token:\n",
" !wandb login $wandb_token\n",
" wandb_settings = \"--wandb\"\n",
"\n",
"#@markdown use validation with wandb\n",
"\n",
"validatation = False #@param{type:\"boolean\"}\n",
"validate = \"\"\n",
"if validatation:\n",
" validate = \"--validation_config validation_default.json\"\n",
"\n",
"extensions = ['.zip', '.7z', '.rar', '.tgz']\n",
"uncompressed_dir = 'Training_Data'\n",
"\n",
"if any(ext in Dataset_Location for ext in extensions):\n",
" # Create the uncompressed directory if it doesn't exist\n",
" if not os.path.exists(uncompressed_dir):\n",
" os.makedirs(uncompressed_dir)\n",
" \n",
" # Extract the compressed file to the uncompressed directory\n",
" shutil.unpack_archive(Dataset_Location, uncompressed_dir)\n",
"\n",
" # Set the dataset location to the uncompressed directory\n",
" Dataset_Location = uncompressed_dir\n",
"\n",
"# Use the dataset location in the rest of your code\n",
"dataset = Dataset_Location\n",
"\n",
"Drive=\"\"\n",
"if Save_to_Gdrive:\n",
" Drive = \"--logdir /content/drive/MyDrive/everydreamlogs --save_ckpt_dir /content/drive/MyDrive/everydreamlogs/ckpt\"\n",
"\n",
"if Max_Epochs==0:\n",
" Max_Epoch=1\n",
"\n",
"if resume:\n",
" model = \"findlast\"\n",
"\n",
"Gradient = \"\"\n",
"if Gradient_checkpointing:\n",
" Gradient = \"--gradient_checkpointing \"\n",
"\n",
"DX = \"\" \n",
"if Disable_Xformers:\n",
" DX = \"--disable_xformers \"\n",
"\n",
"shuffle = \"\"\n",
"if shuffle_tags:\n",
" shuffle = \"--shuffle_tags \"\n",
"\n",
"def parse_progress(log_line):\n",
" match = re.search(r'\\((\\d+)%\\)', log_line)\n",
" if match:\n",
" return int(match.group(1))\n",
" return None\n",
" \n",
"\n",
"textencode = \"\"\n",
"if Disable_text_Encoder:\n",
" textencode = \"--disable_textenc_training\"\n",
"\n",
"def update_progress_bar(progress: float):\n",
" print(\"Training progress: {:.2f}%\".format(progress))\n",
" print(\"[{0}{1}]\".format('#' * int(progress // 2), ' ' * (50 - int(progress // 2))))\n",
"\n",
"# Start the training process and capture the output\n",
"command = f\"\"\"python train.py --resume_ckpt \"{model}\" \\\n",
" {textencode} \\\n",
" {Gradient} \\\n",
" {shuffle} \\\n",
" {Drive} \\\n",
" {DX} \\\n",
" {validate} \\\n",
" {wandb_settings} \\\n",
" --clip_skip {Clip_skip} \\\n",
" --batch_size {Batch_Size} \\\n",
" --grad_accum {Gradient_steps} \\\n",
" --cond_dropout {Conditional_DropOut} \\\n",
" --data_root \"{dataset}\" \\\n",
" --flip_p {Picture_flip} \\\n",
" --lr {Learning_Rate} \\\n",
" --log_step 25 \\\n",
" --lr_warmup_steps {Lr_warmup_steps} \\\n",
" --lr_scheduler \"{Schedule}\" \\\n",
" --max_epochs {Max_Epochs} \\\n",
" --project_name \"{Project_Name}\" \\\n",
" --resolution {Resolution} \\\n",
" --sample_prompts \"{Sample_File}\" \\\n",
" --sample_steps {Steps_between_samples} \\\n",
" --save_every_n_epoch {Save_every_N_epoch} \\\n",
" --seed {Training_Seed} \\\n",
" --zero_frequency_noise_ratio {zero_frequency_noise}\"\"\"\n",
"\n",
"process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)\n",
"\n",
"# Initialize the progress bar\n",
"progress_bar = tqdm(total=100, desc=\"Training progress\", ncols=100)\n",
"\n",
"for log_line in process.stdout:\n",
" global last_output\n",
" last_output = None\n",
" log_line = log_line.strip()\n",
" if log_line:\n",
" if log_line != last_output:\n",
" progress = parse_progress(log_line)\n",
" if progress is not None:\n",
" update_progress_bar(progress)\n",
" else:\n",
" print(log_line)\n",
" last_output = log_line\n",
"\n",
"# Finish the training process\n",
"process.wait()\n",
"if Disconnect_after_training:\n",
" time.sleep(40)\n",
" runtime.unassign()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "Iuoa_1B9jRGU"
},
"outputs": [],
"source": [
"#@title Alternate startup script\n",
"#@markdown * Edit train.json to setup your paramaters\n",
"#@markdown * Edit chain0.json to make use of chaining\n",
"#@markdown * make sure to check each confguration you will need 1 Json per chain length 3 are provided\n",
"#@markdown * make sure your .Json contain the line Notebook: true\n",
"#@markdown * your locations in the .json can be done in this format /content/drive/MyDrive/ - then the sub folder you wish to use\n",
"\n",
"%cd /content/EveryDream2trainer\n",
"Chain_Length=0 #@param{type:\"integer\"}\n",
"l = Chain_Length \n",
"I=0 #repeat counter\n",
"if l == None or l == 0:\n",
" l=1\n",
"while l > 0:\n",
" !python train_colab.py --config chain{I}.json\n",
" l -= 1\n",
" I =+ 1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "8HmIWtODuE6p"
},
"outputs": [],
"source": [
"#@title Test your Diffusers\n",
"#@markdown Path to the diffusers that was trained\n",
"\n",
"#@markdown You can look in the file drawer on the left /content/drive/MyDrive/everydreamlogs and click the three dots to copy the path\n",
"\n",
"#@markdown ex. /content/drive/MyDrive/everydreamlogs/my_project_20230126-023804/ckpts/interrupted-gs86\n",
"\n",
"diffusers_path=\"\" #@param{type:\"string\"}\n",
"DF=diffusers_path\n",
"PROMPT= \"a photo of an astronaut on the moon\"#@param{type:\"string\"}\n",
"Resolution = 512 #@param {type:\"slider\", min:256, max:1024, step:32}\n",
"Seed= -1 #@param{type:\"integer\"}\n",
"Steps = 30 #@param {type:\"slider\", min:10, max:50, step:1}\n",
"cfg = 7 #@param {type:\"slider\", min:1, max:15, step:0.5}\n",
"\n",
"\n",
"!python /content/EveryDream2trainer/scripts/txt2img.py \\\n",
" --diffusers_path \"$DF\" \\\n",
" --resolution $Resolution \\\n",
" --seed $Seed \\\n",
" --prompt \"$PROMPT\" \\\n",
" --steps $Steps \\\n",
" --cfg_scale $cfg "
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"include_colab_link": true,
"provenance": []
},
"gpuClass": "standard",
"kernelspec": {
"display_name": "venv",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.10.5"
},
"vscode": {
"interpreter": {
"hash": "e602395b73d27e246c3f66de86a1ed4dc1e5a85e8356fd1a2f027b9d2f1f8162"
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}