3
3
import math
4
4
import numbers
5
5
import args_manager
6
- import tempfile
7
6
import modules .flags
8
7
import modules .sdxl_styles
9
8
10
9
from modules .model_loader import load_file_from_url
11
10
from modules .util import get_files_from_folder , makedirs_with_log
12
11
from modules .flags import Performance , MetadataScheme
13
12
14
-
15
13
def get_config_path (key , default_value ):
16
14
env = os .getenv (key )
17
15
if env is not None and isinstance (env , str ):
@@ -20,7 +18,6 @@ def get_config_path(key, default_value):
20
18
else :
21
19
return os .path .abspath (default_value )
22
20
23
-
24
21
config_path = get_config_path ('config_path' , "./config.txt" )
25
22
config_example_path = get_config_path ('config_example_path' , "config_modification_tutorial.txt" )
26
23
config_dict = {}
@@ -120,7 +117,7 @@ def get_path_output() -> str:
120
117
global config_dict
121
118
path_output = get_dir_or_set_default ('path_outputs' , '../outputs/' , make_directory = True )
122
119
if args_manager .args .output_path :
123
- print (f'Overriding config value path_outputs with { args_manager .args .output_path } ' )
120
+ print (f'[CONFIG] Overriding config value path_outputs with { args_manager .args .output_path } ' )
124
121
config_dict ['path_outputs' ] = path_output = args_manager .args .output_path
125
122
return path_output
126
123
@@ -181,7 +178,6 @@ def get_dir_or_set_default(key, default_value, as_array=False, make_directory=Fa
181
178
path_fooocus_expansion = get_dir_or_set_default ('path_fooocus_expansion' , '../models/prompt_expansion/fooocus_expansion' )
182
179
path_outputs = get_path_output ()
183
180
184
-
185
181
def get_config_item_or_set_default (key , default_value , validator , disable_empty_as_none = False ):
186
182
global config_dict , visited_keys
187
183
@@ -210,36 +206,6 @@ def get_config_item_or_set_default(key, default_value, validator, disable_empty_
210
206
return default_value
211
207
212
208
213
- def init_temp_path (path : str | None , default_path : str ) -> str :
214
- if args_manager .args .temp_path :
215
- path = args_manager .args .temp_path
216
-
217
- if path != '' and path != default_path :
218
- try :
219
- if not os .path .isabs (path ):
220
- path = os .path .abspath (path )
221
- os .makedirs (path , exist_ok = True )
222
- print (f'Using temp path { path } ' )
223
- return path
224
- except Exception as e :
225
- print (f'Could not create temp path { path } . Reason: { e } ' )
226
- print (f'Using default temp path { default_path } instead.' )
227
-
228
- os .makedirs (default_path , exist_ok = True )
229
- return default_path
230
-
231
-
232
- default_temp_path = os .path .join (tempfile .gettempdir (), 'fooocus' )
233
- temp_path = init_temp_path (get_config_item_or_set_default (
234
- key = 'temp_path' ,
235
- default_value = default_temp_path ,
236
- validator = lambda x : isinstance (x , str ),
237
- ), default_temp_path )
238
- temp_path_cleanup_on_launch = get_config_item_or_set_default (
239
- key = 'temp_path_cleanup_on_launch' ,
240
- default_value = True ,
241
- validator = lambda x : isinstance (x , bool )
242
- )
243
209
default_base_model_name = get_config_item_or_set_default (
244
210
key = 'default_model' ,
245
211
default_value = 'model.safetensors' ,
0 commit comments