Spaces:
Running
on
Zero
Running
on
Zero
Alexander Bagus
commited on
Commit
·
8e10f35
1
Parent(s):
ba100e2
22
Browse files
app.py
CHANGED
|
@@ -18,16 +18,26 @@ from utils.prompt_utils import polish_prompt
|
|
| 18 |
# subprocess.run(["git", "clone", GIT_URL])
|
| 19 |
# else:
|
| 20 |
# print("Folder already exists.")
|
| 21 |
-
|
| 22 |
MAX_SEED = np.iinfo(np.int32).max
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
low_cpu_mem_usage=False,
|
| 28 |
)
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
def prepare(prompt, is_polish_prompt):
|
| 33 |
if not is_polish_prompt: return prompt, False
|
|
|
|
| 18 |
# subprocess.run(["git", "clone", GIT_URL])
|
| 19 |
# else:
|
| 20 |
# print("Folder already exists.")
|
| 21 |
+
MODEL_REPO = "meituan-longcat/LongCat-Image"
|
| 22 |
MAX_SEED = np.iinfo(np.int32).max
|
| 23 |
|
| 24 |
+
text_processor = AutoProcessor.from_pretrained(
|
| 25 |
+
MODEL_REPO,
|
| 26 |
+
subfolder = 'tokenizer'
|
|
|
|
| 27 |
)
|
| 28 |
+
transformer = LongCatImageTransformer2DModel.from_pretrained(
|
| 29 |
+
MODEL_REPO ,
|
| 30 |
+
subfolder = 'transformer',
|
| 31 |
+
torch_dtype=torch.bfloat16,
|
| 32 |
+
use_safetensors=True
|
| 33 |
+
).to("cuda")
|
| 34 |
|
| 35 |
+
pipe = LongCatImagePipeline.from_pretrained(
|
| 36 |
+
MODEL_REPO,
|
| 37 |
+
transformer=transformer,
|
| 38 |
+
text_processor=text_processor
|
| 39 |
+
)
|
| 40 |
+
pipe.to("cuda", torch.bfloat16)
|
| 41 |
|
| 42 |
def prepare(prompt, is_polish_prompt):
|
| 43 |
if not is_polish_prompt: return prompt, False
|