aiqtech commited on
Commit
4d86a9c
ยท
verified ยท
1 Parent(s): b070f28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -318,13 +318,14 @@ if __name__ == "__main__":
318
  "JeffreyXiang/TRELLIS-image-large",
319
  use_auth_token=HF_TOKEN
320
  )
321
- pipeline.cuda()
322
 
323
  # ์ด๋ฏธ์ง€ ์ƒ์„ฑ ํŒŒ์ดํ”„๋ผ์ธ
324
  pipe = FluxPipeline.from_pretrained(
325
  "black-forest-labs/FLUX.1-dev",
326
  torch_dtype=torch.bfloat16,
327
- use_auth_token=HF_TOKEN
 
328
  )
329
 
330
  # Hyper-SD LoRA ๋กœ๋“œ
@@ -336,7 +337,11 @@ if __name__ == "__main__":
336
  )
337
  )
338
  pipe.fuse_lora(lora_scale=0.125)
339
- pipe.to(device="cuda", dtype=torch.bfloat16)
 
 
 
 
340
 
341
  try:
342
  pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8)))
 
318
  "JeffreyXiang/TRELLIS-image-large",
319
  use_auth_token=HF_TOKEN
320
  )
321
+ pipeline.to("cuda") # .cuda() ๋Œ€์‹  .to("cuda") ์‚ฌ์šฉ
322
 
323
  # ์ด๋ฏธ์ง€ ์ƒ์„ฑ ํŒŒ์ดํ”„๋ผ์ธ
324
  pipe = FluxPipeline.from_pretrained(
325
  "black-forest-labs/FLUX.1-dev",
326
  torch_dtype=torch.bfloat16,
327
+ use_auth_token=HF_TOKEN,
328
+ device_map="auto" # device_map ์ถ”๊ฐ€
329
  )
330
 
331
  # Hyper-SD LoRA ๋กœ๋“œ
 
337
  )
338
  )
339
  pipe.fuse_lora(lora_scale=0.125)
340
+
341
+ # ๋ฒˆ์—ญ๊ธฐ ์ดˆ๊ธฐํ™” (GPU ์„ค์ • ์ถ”๊ฐ€)
342
+ translator = pipeline("translation",
343
+ model="Helsinki-NLP/opus-mt-ko-en",
344
+ device=0 if torch.cuda.is_available() else -1)
345
 
346
  try:
347
  pipeline.preprocess_image(Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8)))