add tunable ops path

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-01-30 13:35:09 -05:00
parent 0ea7840608
commit 1697fb1508
4 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -4,8 +4,8 @@
- **Torch**:
- for cuda environemnts set default to `torch==2.6.0+cu126`
- add torch tunable ops and their max duration
*set in settings -> backend settings -> torch*
- add support for torch **tunable ops**, this can speed up operations by up to 10-30% on some platforms
*set in settings -> backend settings -> torch* and *paths -> tunable ops cache*
- **Fixes**:
- photomaker with offloading
- photomaker with refine
+5 -2
View File
@@ -295,9 +295,12 @@ def set_cuda_tunable():
if opts.torch_tunable_ops != 'default':
torch.cuda.tunable.enable(opts.torch_tunable_ops == 'true')
torch.cuda.tunable.tuning_enable(opts.torch_tunable_ops == 'true')
# torch.cuda.tunable.set_max_tuning_duration(100)
torch.cuda.tunable.set_max_tuning_duration(1000) # set to high value as actual is min(duration, iterations)
torch.cuda.tunable.set_max_tuning_iterations(opts.torch_tunable_limit)
# log.debug(f'Torce tunable: enabled={torch.cuda.tunable.is_enabled()} tuning={torch.cuda.tunable.tuning_is_enabled()} iterations={torch.cuda.tunable.get_max_tuning_iterations()} duration={torch.cuda.tunable.get_max_tuning_duration()}')
fn = os.path.join(opts.tunable_dir, 'tunable.csv')
torch.cuda.tunable.set_filename(fn)
if torch.cuda.tunable.is_enabled():
log.debug(f'Torce tunable: enabled={torch.cuda.tunable.is_enabled()} tuning={torch.cuda.tunable.tuning_is_enabled()} iterations={torch.cuda.tunable.get_max_tuning_iterations()} duration={torch.cuda.tunable.get_max_tuning_duration()} fn="{fn}"')
except Exception:
pass
+1
View File
@@ -109,6 +109,7 @@ def create_paths(opts):
create_path(fix_path('unet_dir'))
create_path(fix_path('te_dir'))
create_path(fix_path('lora_dir'))
create_path(fix_path('tunable_dir'))
create_path(fix_path('embeddings_dir'))
create_path(fix_path('hypernetwork_dir'))
create_path(fix_path('onnx_temp_dir'))
+1
View File
@@ -665,6 +665,7 @@ options_templates.update(options_section(('system-paths', "System Paths"), {
"ckpt_dir": OptionInfo(os.path.join(paths.models_path, 'Stable-diffusion'), "Folder with stable diffusion models", folder=True),
"diffusers_dir": OptionInfo(os.path.join(paths.models_path, 'Diffusers'), "Folder with Huggingface models", folder=True),
"hfcache_dir": OptionInfo(default_hfcache_dir, "Folder for Huggingface cache", folder=True),
"tunable_dir": OptionInfo(os.path.join(paths.models_path, 'tunable'), "Folder for Tunable ops cache", folder=True),
"vae_dir": OptionInfo(os.path.join(paths.models_path, 'VAE'), "Folder with VAE files", folder=True),
"unet_dir": OptionInfo(os.path.join(paths.models_path, 'UNET'), "Folder with UNET files", folder=True),
"te_dir": OptionInfo(os.path.join(paths.models_path, 'Text-encoder'), "Folder with Text encoder files", folder=True),