deaf1296 anzorq commited on
Commit
ab9de45
·
0 Parent(s):

Duplicate from anzorq/finetuned_diffusion

Browse files

Co-authored-by: AQ <[email protected]>

Files changed (6) hide show
  1. .gitattributes +33 -0
  2. README.md +14 -0
  3. app.py +302 -0
  4. nsfw.png +0 -0
  5. requirements.txt +9 -0
  6. utils.py +6 -0
.gitattributes ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.npy filter=lfs diff=lfs merge=lfs -text
14
+ *.npz filter=lfs diff=lfs merge=lfs -text
15
+ *.onnx filter=lfs diff=lfs merge=lfs -text
16
+ *.ot filter=lfs diff=lfs merge=lfs -text
17
+ *.parquet filter=lfs diff=lfs merge=lfs -text
18
+ *.pb filter=lfs diff=lfs merge=lfs -text
19
+ *.pickle filter=lfs diff=lfs merge=lfs -text
20
+ *.pkl filter=lfs diff=lfs merge=lfs -text
21
+ *.pt filter=lfs diff=lfs merge=lfs -text
22
+ *.pth filter=lfs diff=lfs merge=lfs -text
23
+ *.rar filter=lfs diff=lfs merge=lfs -text
24
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
25
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
26
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
27
+ *.tflite filter=lfs diff=lfs merge=lfs -text
28
+ *.tgz filter=lfs diff=lfs merge=lfs -text
29
+ *.wasm filter=lfs diff=lfs merge=lfs -text
30
+ *.xz filter=lfs diff=lfs merge=lfs -text
31
+ *.zip filter=lfs diff=lfs merge=lfs -text
32
+ *.zst filter=lfs diff=lfs merge=lfs -text
33
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Finetuned Diffusion
3
+ emoji: 🪄🖼️
4
+ colorFrom: red
5
+ colorTo: pink
6
+ sdk: gradio
7
+ sdk_version: 3.6
8
+ app_file: app.py
9
+ pinned: true
10
+ license: mit
11
+ duplicated_from: anzorq/finetuned_diffusion
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import AutoencoderKL, UNet2DConditionModel, StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DPMSolverMultistepScheduler
2
+ import gradio as gr
3
+ import torch
4
+ from PIL import Image
5
+ import utils
6
+ import datetime
7
+ import time
8
+ import psutil
9
+
10
+ start_time = time.time()
11
+ is_colab = utils.is_google_colab()
12
+
13
+ class Model:
14
+ def __init__(self, name, path="", prefix=""):
15
+ self.name = name
16
+ self.path = path
17
+ self.prefix = prefix
18
+ self.pipe_t2i = None
19
+ self.pipe_i2i = None
20
+
21
+ models = [
22
+ Model("Arcane", "nitrosocke/Arcane-Diffusion", "arcane style "),
23
+ Model("Archer", "nitrosocke/archer-diffusion", "archer style "),
24
+ Model("Modern Disney", "nitrosocke/mo-di-diffusion", "modern disney style "),
25
+ Model("Classic Disney", "nitrosocke/classic-anim-diffusion", "classic disney style "),
26
+ Model("Loving Vincent (Van Gogh)", "dallinmackay/Van-Gogh-diffusion", "lvngvncnt "),
27
+ Model("Redshift renderer (Cinema4D)", "nitrosocke/redshift-diffusion", "redshift style "),
28
+ Model("Midjourney v4 style", "prompthero/midjourney-v4-diffusion", "mdjrny-v4 style "),
29
+ Model("Waifu", "hakurei/waifu-diffusion"),
30
+ Model("Cyberpunk Anime", "DGSpitzer/Cyberpunk-Anime-Diffusion", "dgs illustration style "),
31
+ Model("Elden Ring", "nitrosocke/elden-ring-diffusion", "elden ring style "),
32
+ Model("TrinArt v2", "naclbit/trinart_stable_diffusion_v2"),
33
+ Model("Spider-Verse", "nitrosocke/spider-verse-diffusion", "spiderverse style "),
34
+ Model("Balloon Art", "Fictiverse/Stable_Diffusion_BalloonArt_Model", "BalloonArt "),
35
+ Model("Tron Legacy", "dallinmackay/Tron-Legacy-diffusion", "trnlgcy "),
36
+ Model("Pokémon", "lambdalabs/sd-pokemon-diffusers"),
37
+ Model("Pony Diffusion", "AstraliteHeart/pony-diffusion"),
38
+ Model("Robo Diffusion", "nousr/robo-diffusion"),
39
+ ]
40
+
41
+ custom_model = None
42
+ if is_colab:
43
+ models.insert(0, Model("Custom model"))
44
+ custom_model = models[0]
45
+
46
+ last_mode = "txt2img"
47
+ current_model = models[1] if is_colab else models[0]
48
+ current_model_path = current_model.path
49
+
50
+ if is_colab:
51
+ pipe = StableDiffusionPipeline.from_pretrained(
52
+ current_model.path,
53
+ torch_dtype=torch.float16,
54
+ scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
55
+ safety_checker=lambda images, clip_input: (images, False)
56
+ )
57
+
58
+ else:
59
+ pipe = StableDiffusionPipeline.from_pretrained(
60
+ current_model.path,
61
+ torch_dtype=torch.float16,
62
+ scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
63
+ )
64
+
65
+ if torch.cuda.is_available():
66
+ pipe = pipe.to("cuda")
67
+
68
+ device = "GPU 🔥" if torch.cuda.is_available() else "CPU 🥶"
69
+
70
+ def error_str(error, title="Error"):
71
+ return f"""#### {title}
72
+ {error}""" if error else ""
73
+
74
+ def custom_model_changed(path):
75
+ models[0].path = path
76
+ global current_model
77
+ current_model = models[0]
78
+
79
+ def on_model_change(model_name):
80
+
81
+ prefix = "Enter prompt. \"" + next((m.prefix for m in models if m.name == model_name), None) + "\" is prefixed automatically" if model_name != models[0].name else "Don't forget to use the custom model prefix in the prompt!"
82
+
83
+ return gr.update(visible = model_name == models[0].name), gr.update(placeholder=prefix)
84
+
85
+ def inference(model_name, prompt, guidance, steps, n_images=1, width=512, height=512, seed=0, img=None, strength=0.5, neg_prompt=""):
86
+
87
+ print(psutil.virtual_memory()) # print memory usage
88
+
89
+ global current_model
90
+ for model in models:
91
+ if model.name == model_name:
92
+ current_model = model
93
+ model_path = current_model.path
94
+
95
+ generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
96
+
97
+ try:
98
+ if img is not None:
99
+ return img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator), None
100
+ else:
101
+ return txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator), None
102
+ except Exception as e:
103
+ return None, error_str(e)
104
+
105
+ def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator):
106
+
107
+ print(f"{datetime.datetime.now()} txt_to_img, model: {current_model.name}")
108
+
109
+ global last_mode
110
+ global pipe
111
+ global current_model_path
112
+ if model_path != current_model_path or last_mode != "txt2img":
113
+ current_model_path = model_path
114
+
115
+ if is_colab or current_model == custom_model:
116
+ pipe = StableDiffusionPipeline.from_pretrained(
117
+ current_model_path,
118
+ torch_dtype=torch.float16,
119
+ scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
120
+ safety_checker=lambda images, clip_input: (images, False)
121
+ )
122
+ else:
123
+ pipe = StableDiffusionPipeline.from_pretrained(
124
+ current_model_path,
125
+ torch_dtype=torch.float16,
126
+ scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
127
+ )
128
+ # pipe = pipe.to("cpu")
129
+ # pipe = current_model.pipe_t2i
130
+
131
+ if torch.cuda.is_available():
132
+ pipe = pipe.to("cuda")
133
+ last_mode = "txt2img"
134
+
135
+ prompt = current_model.prefix + prompt
136
+ result = pipe(
137
+ prompt,
138
+ negative_prompt = neg_prompt,
139
+ num_images_per_prompt=n_images,
140
+ num_inference_steps = int(steps),
141
+ guidance_scale = guidance,
142
+ width = width,
143
+ height = height,
144
+ generator = generator)
145
+
146
+ return replace_nsfw_images(result)
147
+
148
+ def img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator):
149
+
150
+ print(f"{datetime.datetime.now()} img_to_img, model: {model_path}")
151
+
152
+ global last_mode
153
+ global pipe
154
+ global current_model_path
155
+ if model_path != current_model_path or last_mode != "img2img":
156
+ current_model_path = model_path
157
+
158
+ if is_colab or current_model == custom_model:
159
+ pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
160
+ current_model_path,
161
+ torch_dtype=torch.float16,
162
+ scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler"),
163
+ safety_checker=lambda images, clip_input: (images, False)
164
+ )
165
+ else:
166
+ pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
167
+ current_model_path,
168
+ torch_dtype=torch.float16,
169
+ scheduler=DPMSolverMultistepScheduler.from_pretrained(current_model.path, subfolder="scheduler")
170
+ )
171
+ # pipe = pipe.to("cpu")
172
+ # pipe = current_model.pipe_i2i
173
+
174
+ if torch.cuda.is_available():
175
+ pipe = pipe.to("cuda")
176
+ last_mode = "img2img"
177
+
178
+ prompt = current_model.prefix + prompt
179
+ ratio = min(height / img.height, width / img.width)
180
+ img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
181
+ result = pipe(
182
+ prompt,
183
+ negative_prompt = neg_prompt,
184
+ num_images_per_prompt=n_images,
185
+ init_image = img,
186
+ num_inference_steps = int(steps),
187
+ strength = strength,
188
+ guidance_scale = guidance,
189
+ # width = width,
190
+ # height = height,
191
+ generator = generator)
192
+
193
+ return replace_nsfw_images(result)
194
+
195
+ def replace_nsfw_images(results):
196
+
197
+ if is_colab:
198
+ return results.images
199
+
200
+ for i in range(len(results.images)):
201
+ if results.nsfw_content_detected[i]:
202
+ results.images[i] = Image.open("nsfw.png")
203
+ return results.images
204
+
205
+ css = """.finetuned-diffusion-div div{display:inline-flex;align-items:center;gap:.8rem;font-size:1.75rem}.finetuned-diffusion-div div h1{font-weight:900;margin-bottom:7px}.finetuned-diffusion-div p{margin-bottom:10px;font-size:94%}a{text-decoration:underline}.tabs{margin-top:0;margin-bottom:0}#gallery{min-height:20rem}
206
+ """
207
+ with gr.Blocks(css=css) as demo:
208
+ gr.HTML(
209
+ f"""
210
+ <div class="finetuned-diffusion-div">
211
+ <div>
212
+ <h1>Finetuned Diffusion</h1>
213
+ </div>
214
+ <p>
215
+ Demo for multiple fine-tuned Stable Diffusion models, trained on different styles: <br>
216
+ <a href="https://huggingface.co/nitrosocke/Arcane-Diffusion">Arcane</a>, <a href="https://huggingface.co/nitrosocke/archer-diffusion">Archer</a>, <a href="https://huggingface.co/nitrosocke/elden-ring-diffusion">Elden Ring</a>, <a href="https://huggingface.co/nitrosocke/spider-verse-diffusion">Spider-Verse</a>, <a href="https://huggingface.co/nitrosocke/mo-di-diffusion">Modern Disney</a>, <a href="https://huggingface.co/nitrosocke/classic-anim-diffusion">Classic Disney</a>, <a href="https://huggingface.co/dallinmackay/Van-Gogh-diffusion">Loving Vincent (Van Gogh)</a>, <a href="https://huggingface.co/nitrosocke/redshift-diffusion">Redshift renderer (Cinema4D)</a>, <a href="https://huggingface.co/prompthero/midjourney-v4-diffusion">Midjourney v4 style</a>, <a href="https://huggingface.co/hakurei/waifu-diffusion">Waifu</a>, <a href="https://huggingface.co/lambdalabs/sd-pokemon-diffusers">Pokémon</a>, <a href="https://huggingface.co/AstraliteHeart/pony-diffusion">Pony Diffusion</a>, <a href="https://huggingface.co/nousr/robo-diffusion">Robo Diffusion</a>, <a href="https://huggingface.co/DGSpitzer/Cyberpunk-Anime-Diffusion">Cyberpunk Anime</a>, <a href="https://huggingface.co/dallinmackay/Tron-Legacy-diffusion">Tron Legacy</a>, <a href="https://huggingface.co/Fictiverse/Stable_Diffusion_BalloonArt_Model">Balloon Art</a> + in colab notebook you can load any other Diffusers 🧨 SD model hosted on HuggingFace 🤗.
217
+ </p>
218
+ <p>You can skip the queue and load custom models in the colab: <a href="https://colab.research.google.com/gist/qunash/42112fb104509c24fd3aa6d1c11dd6e0/copy-of-fine-tuned-diffusion-gradio.ipynb"><img data-canonical-src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" src="https://camo.githubusercontent.com/84f0493939e0c4de4e6dbe113251b4bfb5353e57134ffd9fcab6b8714514d4d1/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667"></a></p>
219
+ Running on <b>{device}</b>{(" in a <b>Google Colab</b>." if is_colab else "")}
220
+ </p>
221
+ <p>You can also duplicate this space and upgrade to gpu by going to settings:<br>
222
+ <a style="display:inline-block" href="https://huggingface.co/spaces/anzorq/finetuned_diffusion?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></p>
223
+ </div>
224
+ """
225
+ )
226
+ with gr.Row():
227
+
228
+ with gr.Column(scale=55):
229
+ with gr.Group():
230
+ model_name = gr.Dropdown(label="Model", choices=[m.name for m in models], value=current_model.name)
231
+ with gr.Box(visible=False) as custom_model_group:
232
+ custom_model_path = gr.Textbox(label="Custom model path", placeholder="Path to model, e.g. nitrosocke/Arcane-Diffusion", interactive=True)
233
+ gr.HTML("<div><font size='2'>Custom models have to be downloaded first, so give it some time.</font></div>")
234
+
235
+ with gr.Row():
236
+ prompt = gr.Textbox(label="Prompt", show_label=False, max_lines=2,placeholder="Enter prompt. Style applied automatically").style(container=False)
237
+ generate = gr.Button(value="Generate").style(rounded=(False, True, True, False))
238
+
239
+
240
+ # image_out = gr.Image(height=512)
241
+ gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
242
+
243
+ error_output = gr.Markdown()
244
+
245
+ with gr.Column(scale=45):
246
+ with gr.Tab("Options"):
247
+ with gr.Group():
248
+ neg_prompt = gr.Textbox(label="Negative prompt", placeholder="What to exclude from the image")
249
+
250
+ n_images = gr.Slider(label="Images", value=1, minimum=1, maximum=4, step=1)
251
+
252
+ with gr.Row():
253
+ guidance = gr.Slider(label="Guidance scale", value=7.5, maximum=15)
254
+ steps = gr.Slider(label="Steps", value=25, minimum=2, maximum=75, step=1)
255
+
256
+ with gr.Row():
257
+ width = gr.Slider(label="Width", value=512, minimum=64, maximum=1024, step=8)
258
+ height = gr.Slider(label="Height", value=512, minimum=64, maximum=1024, step=8)
259
+
260
+ seed = gr.Slider(0, 2147483647, label='Seed (0 = random)', value=0, step=1)
261
+
262
+ with gr.Tab("Image to image"):
263
+ with gr.Group():
264
+ image = gr.Image(label="Image", height=256, tool="editor", type="pil")
265
+ strength = gr.Slider(label="Transformation strength", minimum=0, maximum=1, step=0.01, value=0.5)
266
+
267
+ if is_colab:
268
+ model_name.change(on_model_change, inputs=model_name, outputs=[custom_model_group, prompt], queue=False)
269
+ custom_model_path.change(custom_model_changed, inputs=custom_model_path, outputs=None)
270
+ # n_images.change(lambda n: gr.Gallery().style(grid=[2 if n > 1 else 1], height="auto"), inputs=n_images, outputs=gallery)
271
+
272
+ inputs = [model_name, prompt, guidance, steps, n_images, width, height, seed, image, strength, neg_prompt]
273
+ outputs = [gallery, error_output]
274
+ prompt.submit(inference, inputs=inputs, outputs=outputs)
275
+ generate.click(inference, inputs=inputs, outputs=outputs)
276
+
277
+ ex = gr.Examples([
278
+ [models[7].name, "tiny cute and adorable kitten adventurer dressed in a warm overcoat with survival gear on a winters day", 7.5, 25],
279
+ [models[4].name, "portrait of dwayne johnson", 7.0, 35],
280
+ [models[5].name, "portrait of a beautiful alyx vance half life", 10, 25],
281
+ [models[6].name, "Aloy from Horizon: Zero Dawn, half body portrait, smooth, detailed armor, beautiful face, illustration", 7.0, 30],
282
+ [models[5].name, "fantasy portrait painting, digital art", 4.0, 20],
283
+ ], inputs=[model_name, prompt, guidance, steps], outputs=outputs, fn=inference, cache_examples=False)
284
+
285
+ gr.HTML("""
286
+ <div style="border-top: 1px solid #303030;">
287
+ <br>
288
+ <p>Models by <a href="https://huggingface.co/nitrosocke">@nitrosocke</a>, <a href="https://twitter.com/haruu1367">@haruu1367</a>, <a href="https://twitter.com/DGSpitzer">@Helixngc7293</a>, <a href="https://twitter.com/dal_mack">@dal_mack</a>, <a href="https://twitter.com/prompthero">@prompthero</a> and others. ❤️</p>
289
+ <p>This space uses the <a href="https://github.com/LuChengTHU/dpm-solver">DPM-Solver++</a> sampler by <a href="https://arxiv.org/abs/2206.00927">Cheng Lu, et al.</a>.</p>
290
+ <p>Space by:<br>
291
+ <a href="https://twitter.com/hahahahohohe"><img src="https://img.shields.io/twitter/follow/hahahahohohe?label=%40anzorq&style=social" alt="Twitter Follow"></a><br>
292
+ <a href="https://github.com/qunash"><img alt="GitHub followers" src="https://img.shields.io/github/followers/qunash?style=social" alt="Github Follow"></a></p><br><br>
293
+ <a href="https://www.buymeacoffee.com/anzorq" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 45px !important;width: 162px !important;" ></a><br><br>
294
+ <p><img src="https://visitor-badge.glitch.me/badge?page_id=anzorq.finetuned_diffusion" alt="visitors"></p>
295
+ </div>
296
+ """)
297
+
298
+ print(f"Space built in {time.time() - start_time:.2f} seconds")
299
+
300
+ if not is_colab:
301
+ demo.queue(concurrency_count=1)
302
+ demo.launch(debug=is_colab, share=is_colab)
nsfw.png ADDED
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ --extra-index-url https://download.pytorch.org/whl/cu113
2
+ torch
3
+ git+https://github.com/huggingface/diffusers.git
4
+ #transformers
5
+ git+https://github.com/huggingface/transformers
6
+ scipy
7
+ ftfy
8
+ accelerate
9
+ psutil
utils.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ def is_google_colab():
2
+ try:
3
+ import google.colab
4
+ return True
5
+ except:
6
+ return False