openfree commited on
Commit
7511d53
·
verified ·
1 Parent(s): 6fcf6b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -70,22 +70,21 @@ try:
70
  pipe = FluxPipeline.from_pretrained(
71
  "black-forest-labs/FLUX.1-dev",
72
  torch_dtype=torch.float16,
73
- use_auth_token=HF_TOKEN,
74
- safety_checker=None,
75
- device_map="balanced" # 'auto' 대신 'balanced' 사용
76
  )
77
  print("FLUX pipeline initialized successfully")
78
 
79
  # 메모리 최적화 설정
80
  pipe.enable_attention_slicing(slice_size=1)
81
- pipe.enable_model_cpu_offload()
82
- print("Pipeline optimization settings applied")
83
-
84
- # 추가 메모리 최적화
85
  if torch.cuda.is_available():
 
86
  torch.cuda.empty_cache()
87
  torch.backends.cudnn.benchmark = True
88
  torch.backends.cuda.matmul.allow_tf32 = True
 
 
89
 
90
  except Exception as e:
91
  print(f"Error initializing FLUX pipeline: {str(e)}")
 
70
  pipe = FluxPipeline.from_pretrained(
71
  "black-forest-labs/FLUX.1-dev",
72
  torch_dtype=torch.float16,
73
+ use_auth_token=HF_TOKEN
 
 
74
  )
75
  print("FLUX pipeline initialized successfully")
76
 
77
  # 메모리 최적화 설정
78
  pipe.enable_attention_slicing(slice_size=1)
79
+
80
+ # GPU 설정
 
 
81
  if torch.cuda.is_available():
82
+ pipe = pipe.to("cuda:0")
83
  torch.cuda.empty_cache()
84
  torch.backends.cudnn.benchmark = True
85
  torch.backends.cuda.matmul.allow_tf32 = True
86
+
87
+ print("Pipeline optimization settings applied")
88
 
89
  except Exception as e:
90
  print(f"Error initializing FLUX pipeline: {str(e)}")