Spaces:
Sleeping
Sleeping
anbucur
commited on
Commit
·
7ccbf05
1
Parent(s):
4e4b650
Add prod
Browse files- prod_model.py +9 -2
prod_model.py
CHANGED
@@ -33,7 +33,9 @@ class ProductionDesignModel(DesignModel):
|
|
33 |
logging.info(f"Using device: {self.device}")
|
34 |
|
35 |
self.model_id = "stabilityai/stable-diffusion-2-1"
|
|
|
36 |
logging.info(f"Loading model: {self.model_id}")
|
|
|
37 |
|
38 |
# Initialize the pipeline with error handling
|
39 |
try:
|
@@ -55,8 +57,13 @@ class ProductionDesignModel(DesignModel):
|
|
55 |
logging.error(f"Error loading model: {e}")
|
56 |
raise
|
57 |
|
58 |
-
# Initialize tokenizer
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
# Set default prompts
|
62 |
self.neg_prompt = "blurry, low quality, distorted, deformed, disfigured, watermark, text, bad proportions, duplicate, double, multiple, broken, cropped"
|
|
|
33 |
logging.info(f"Using device: {self.device}")
|
34 |
|
35 |
self.model_id = "stabilityai/stable-diffusion-2-1"
|
36 |
+
self.tokenizer_id = "openai/clip-vit-large-patch14" # Correct tokenizer for SD 2.1
|
37 |
logging.info(f"Loading model: {self.model_id}")
|
38 |
+
logging.info(f"Loading tokenizer: {self.tokenizer_id}")
|
39 |
|
40 |
# Initialize the pipeline with error handling
|
41 |
try:
|
|
|
57 |
logging.error(f"Error loading model: {e}")
|
58 |
raise
|
59 |
|
60 |
+
# Initialize tokenizer with correct path
|
61 |
+
try:
|
62 |
+
self.tokenizer = CLIPTokenizer.from_pretrained(self.tokenizer_id)
|
63 |
+
logging.info("Tokenizer loaded successfully")
|
64 |
+
except Exception as e:
|
65 |
+
logging.error(f"Error loading tokenizer: {e}")
|
66 |
+
raise
|
67 |
|
68 |
# Set default prompts
|
69 |
self.neg_prompt = "blurry, low quality, distorted, deformed, disfigured, watermark, text, bad proportions, duplicate, double, multiple, broken, cropped"
|