Various windows bug fixes
This commit is contained in:
@@ -35,7 +35,7 @@ class GenerateConfig:
|
|||||||
raise ValueError("Prompts must be set")
|
raise ValueError("Prompts must be set")
|
||||||
if isinstance(self.prompts, str):
|
if isinstance(self.prompts, str):
|
||||||
if os.path.exists(self.prompts):
|
if os.path.exists(self.prompts):
|
||||||
with open(self.prompts, 'r') as f:
|
with open(self.prompts, 'r', encoding='utf-8') as f:
|
||||||
self.prompts = f.read().splitlines()
|
self.prompts = f.read().splitlines()
|
||||||
self.prompts = [p.strip() for p in self.prompts if len(p.strip()) > 0]
|
self.prompts = [p.strip() for p in self.prompts if len(p.strip()) > 0]
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class TrainSDRescaleProcess(BaseSDTrainProcess):
|
|||||||
self.print(f"Loading prompt file from {self.rescale_config.prompt_file}")
|
self.print(f"Loading prompt file from {self.rescale_config.prompt_file}")
|
||||||
|
|
||||||
# read line by line from file
|
# read line by line from file
|
||||||
with open(self.rescale_config.prompt_file, 'r') as f:
|
with open(self.rescale_config.prompt_file, 'r', encoding='utf-8') as f:
|
||||||
self.prompt_txt_list = f.readlines()
|
self.prompt_txt_list = f.readlines()
|
||||||
# clean empty lines
|
# clean empty lines
|
||||||
self.prompt_txt_list = [line.strip() for line in self.prompt_txt_list if len(line.strip()) > 0]
|
self.prompt_txt_list = [line.strip() for line in self.prompt_txt_list if len(line.strip()) > 0]
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class TrainSliderProcess(BaseSDTrainProcess):
|
|||||||
|
|
||||||
# read line by line from file
|
# read line by line from file
|
||||||
if self.slider_config.prompt_file:
|
if self.slider_config.prompt_file:
|
||||||
with open(self.slider_config.prompt_file, 'r') as f:
|
with open(self.slider_config.prompt_file, 'r', encoding='utf-8') as f:
|
||||||
self.prompt_txt_list = f.readlines()
|
self.prompt_txt_list = f.readlines()
|
||||||
# clean empty lines
|
# clean empty lines
|
||||||
self.prompt_txt_list = [line.strip() for line in self.prompt_txt_list if len(line.strip()) > 0]
|
self.prompt_txt_list = [line.strip() for line in self.prompt_txt_list if len(line.strip()) > 0]
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ diffusers
|
|||||||
transformers
|
transformers
|
||||||
lycoris_lora
|
lycoris_lora
|
||||||
flatten_json
|
flatten_json
|
||||||
accelerator
|
|
||||||
pyyaml
|
pyyaml
|
||||||
oyaml
|
oyaml
|
||||||
tensorboard
|
tensorboard
|
||||||
|
|||||||
@@ -70,10 +70,10 @@ def get_config(config_file_path, name=None):
|
|||||||
|
|
||||||
# if we found it, check if it is a json or yaml file
|
# if we found it, check if it is a json or yaml file
|
||||||
if real_config_path.endswith('.json') or real_config_path.endswith('.jsonc'):
|
if real_config_path.endswith('.json') or real_config_path.endswith('.jsonc'):
|
||||||
with open(real_config_path, 'r') as f:
|
with open(real_config_path, 'r', encoding='utf-8') as f:
|
||||||
config = json.load(f, object_pairs_hook=OrderedDict)
|
config = json.load(f, object_pairs_hook=OrderedDict)
|
||||||
elif real_config_path.endswith('.yaml') or real_config_path.endswith('.yml'):
|
elif real_config_path.endswith('.yaml') or real_config_path.endswith('.yml'):
|
||||||
with open(real_config_path, 'r') as f:
|
with open(real_config_path, 'r', encoding='utf-8') as f:
|
||||||
config = yaml.load(f, Loader=fixed_loader)
|
config = yaml.load(f, Loader=fixed_loader)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Config file {config_file_path} must be a json or yaml file")
|
raise ValueError(f"Config file {config_file_path} must be a json or yaml file")
|
||||||
|
|||||||
Reference in New Issue
Block a user