export MODEL_NAME="CompVis/stable-diffusion-v1-4"
export DATASET_NAME="lambdalabs/pokemon-blip-captions"
accelerate launch --mixed_precision="fp16" train_text_to_image.py \
--pretrained_model_name_or_path=$MODEL_NAME --dataset_name=$DATASET_NAME \
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Adapted from https://github.com/borisdayma/dalle-mini/blob/main/tools/train/train.py | |
import random | |
from dataclasses import dataclass, field | |
from functools import partial | |
import jax | |
import jax.numpy as jnp | |
import numpy as np | |
from datasets import Dataset, load_dataset |
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 timeit | |
from optimum.onnxruntime import ORTStableDiffusionPipeline | |
from diffusers import StableDiffusionPipeline | |
import numpy as np | |
model_id = "runwayml/stable-diffusion-v1-5" | |
onnx_model_id = "sayakpaul/onnx-stable-diffusion-v1-5" | |
prompt = "a photo of an astronaut riding a horse on mars" |
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
#!/usr/bin/env python | |
# coding=utf-8 | |
# Copyright 2022 The HuggingFace Inc. team. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 tensorflow as tf | |
tf.keras.mixed_precision.set_global_policy("mixed_float16") | |
import glob | |
import os | |
import keras_cv | |
import numpy as np | |
import PIL |
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
""" | |
Usage: python run_semantic_segmentation.py | |
References: | |
* https://www.tensorflow.org/tutorials/images/segmentation#define_the_model | |
* https://huggingface.co/docs/transformers/main/en/tasks/semantic_segmentation | |
""" | |
import os | |
import uuid |
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
""" | |
Referred from https://stackoverflow.com/questions/534839/how-to-create-a-guid-uuid-in-python | |
""" | |
import os | |
import uuid | |
from concurrent.futures import ThreadPoolExecutor | |
import pandas as pd | |
import requests |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.