Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,9 @@
|
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
-
from diffusers import StableDiffusionPipeline
|
5 |
-
from transformers import CLIPTextModel, CLIPTokenizer
|
6 |
from datasets import load_dataset
|
7 |
import json
|
8 |
import time
|
@@ -54,13 +55,13 @@ def train_model(user_email, images, progress):
|
|
54 |
tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-base-patch16")
|
55 |
text_encoder = CLIPTextModel.from_pretrained("openai/clip-vit-base-patch16")
|
56 |
|
57 |
-
# إعداد الـ Trainer باستخدام
|
58 |
-
trainer =
|
59 |
model=pipe.unet,
|
60 |
args=training_args,
|
61 |
train_dataset=dataset["train"],
|
62 |
tokenizer=tokenizer,
|
63 |
-
|
64 |
)
|
65 |
|
66 |
# بدء عملية التدريب
|
|
|
1 |
+
pip install --upgrade diffusers
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
import torch
|
5 |
+
from diffusers import StableDiffusionPipeline
|
6 |
+
from transformers import CLIPTextModel, CLIPTokenizer, Trainer, TrainingArguments
|
7 |
from datasets import load_dataset
|
8 |
import json
|
9 |
import time
|
|
|
55 |
tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-base-patch16")
|
56 |
text_encoder = CLIPTextModel.from_pretrained("openai/clip-vit-base-patch16")
|
57 |
|
58 |
+
# إعداد الـ Trainer باستخدام Trainer من Hugging Face
|
59 |
+
trainer = Trainer(
|
60 |
model=pipe.unet,
|
61 |
args=training_args,
|
62 |
train_dataset=dataset["train"],
|
63 |
tokenizer=tokenizer,
|
64 |
+
data_collator=None,
|
65 |
)
|
66 |
|
67 |
# بدء عملية التدريب
|