Open f8upd8 opened 1 year ago
Hi,
I encountered an error with your pull request code as shown below.
Traceback (most recent call last):
File "tool_transfer_control.py", line 42, in <module>
if not input_state_dict.get(key):
RuntimeError: Boolean value of Tensor with more than one value is ambiguous
Therefore, I suggest modifying your code as follows.
From:
if is_first_stage or is_cond_stage:
if not input_state_dict.get(key):
continue
final_state_dict[key] = input_state_dict[key]
continue
To:
if is_first_stage or is_cond_stage:
if key not in input_state_dict:
continue
final_state_dict[key] = input_state_dict[key]
continue
I made some modifications based on your code and successfully managed to convert the model I wanted.
tysm
Traceback:
I suggest changing
to
This will ensure script does not die if one model has a state key that other does not. This helped me to transfer models to novelai.
Sorry for being lazy with PRs