kohya-ss / kohya-ss/sd-scripts

ImportError: cannot import name 'load_safetensors' from 'library.utils' (G:\kohya_ss\sd-scripts\library\utils.py)

Open
#1,848 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

15:58:58-737639 INFO Executing command: G:\kohya_ss\venv\Scripts\python.exe
G:/kohya_ss/sd-scripts/networks/flux_extract_lora.py --model_org
I:\sdmodel\z\flux\lumiere_flux_alpha-fp8.safetensors --model_tuned
I:\sdmodel\z\flux\EdgeOfReality_v26.safetensors --save_to
I:\sdmodel\lora\0CFlux\EdgeOfReality_v26.safetensors --dim 256 --device cuda --clamp_quantile 1
--save_precision float
G:\kohya_ss\venv\lib\site-packages\transformers\utils\hub.py:127: FutureWarning: Using `TRANSFORMERS_CACHE` is deprecated and will be removed in v5 of Transformers. Use `HF_HOME` instead.
warnings.warn(
G:\kohya_ss\venv\lib\site-packages\diffusers\utils\outputs.py:63: FutureWarning: `torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.
torch.utils._pytree._register_pytree_node(
Traceback (most recent call last):
File "G:\kohya_ss\sd-scripts\networks\flux_extract_lora.py", line 13, in
from library import flux_utils, sai_model_spec, model_util, sdxl_model_util
File "G:\kohya_ss\sd-scripts\library\flux_utils.py", line 21, in
from library.utils import load_safetensors
ImportError: cannot import name 'load_safetensors' from 'library.utils' (G:\kohya_ss\sd-scripts\library\utils.py)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with networks/flux_extract_lora.py and follow its import into library/flux_utils.py, then inspect library/utils.py to determine why load_safetensors is unavailable. Reproduce the command shown in the traceback and confirm that it starts without this ImportError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.