File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 27
27
sys .path .append (module_path )
28
28
29
29
30
- print ("[System ARGV] " + str (sys .argv ))
30
+ logger .std_info ("[System ARGV] " + str (sys .argv ))
31
+
32
+ try :
33
+ index = sys .argv .index ('--gpu-device-id' )
34
+ os .environ ["CUDA_VISIBLE_DEVICES" ] = str (sys .argv [index + 1 ])
35
+ logger .std_info (f"[Fooocus] Set device to: { str (sys .argv [index + 1 ])} " )
36
+ except ValueError :
37
+ pass
31
38
32
39
os .environ ["PYTORCH_ENABLE_MPS_FALLBACK" ] = "1"
33
40
os .environ ["PYTORCH_MPS_HIGH_WATERMARK_RATIO" ] = "0.0"
@@ -74,9 +81,6 @@ def prepare_environments(args) -> bool:
74
81
Args:
75
82
args: command line arguments
76
83
"""
77
- if args .gpu_device_id is not None :
78
- os .environ ["CUDA_VISIBLE_DEVICES" ] = str (args .gpu_device_id )
79
- print ("Set device to:" , args .gpu_device_id )
80
84
81
85
if args .base_url is None or len (args .base_url .strip ()) == 0 :
82
86
host = args .host
You can’t perform that action at this time.
0 commit comments