You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
from_single_file() support for AnimaTextConditioner #14930
Is your feature request related to a problem? Please describe.
Although the Anima developer has recommended that community finetuners avoid training the llm_adapter part of the model, it appears that at least some of them have been doing so, which means that loading only the transformer portion of their finetuned models might not produce expected results.
In fact, I compared the llm_adapter values of the official base-v1.0 model and the turbo-v1.1 model, and they are in fact not identical. The difference seems to be down to converting to FP16 and back to BF16, but still I think it is best to add this functionality.
Describe the solution you'd like.
I would like to be able to do this:
Describe alternatives you've considered.
I guess it is possible to use this script to manually convert the llm_adapter portion, then call AnimaTextConditioner.from_pretrained(), but this will be very clunky.
Additional context.
Add any other context or screenshots about the feature request here.
For some weird reason, if I try adding single file support for AnimaTextConditioner myself, I do not get the same output. This happens even if I point it to this exact file here.
I already compared the state_dict, and it appears to be identical, so I guess it has something to do with the initialization happening differently somehow, but I have no idea how to debug this.
If I just run the code as-is, I get different outputs, but if I uncomment the line test_conditioner1.to(torch.bfloat16), I get identical outputs. And I get the warning about casting to bfloat16 using .to() if I specify dtype=torch.bfloat16 in the .from_single_file() method, but not the .from_pretrained() method.
When I run the code through a debugger, I notice that .from_pretrained() initializes the model in bfloat16, and does not cast to bfloat16 via .to(torch.bfloat16), while .from_single_file() does the type casting directly.
Activity
mingyi456 commentedon Oct 4, 2026
For some weird reason, if I try adding single file support for AnimaTextConditioner myself, I do not get the same output. This happens even if I point it to this exact file here.
I already compared the state_dict, and it appears to be identical, so I guess it has something to do with the initialization happening differently somehow, but I have no idea how to debug this.
mingyi456 commentedon Oct 6, 2026
The following code snippet should be enough to reproduce the problem, with the safetensors file in the attached zip folder:
llm_adapter from_pretrained input.zip
If I just run the code as-is, I get different outputs, but if I uncomment the line
test_conditioner1.to(torch.bfloat16), I get identical outputs. And I get the warning about casting to bfloat16 using.to()if I specifydtype=torch.bfloat16in the.from_single_file()method, but not the.from_pretrained()method.When I run the code through a debugger, I notice that
.from_pretrained()initializes the model in bfloat16, and does not cast to bfloat16 via.to(torch.bfloat16), while.from_single_file()does the type casting directly.