File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
diffsynth_engine/models/z_image Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,11 @@ def from_state_dict(
5959 device : str = "cuda:0" ,
6060 dtype : torch .dtype = torch .bfloat16 ,
6161 ):
62- model = cls (config = config , device = "meta" , dtype = dtype )
62+ with torch .device ("meta" ):
63+ model = cls (config = config , device = "meta" , dtype = dtype )
6364 model .requires_grad_ (False )
65+
66+ model .rotary_emb = Qwen3RotaryEmbedding (config = config , device = device )
6467 model .load_state_dict (state_dict , assign = True )
6568 model .to (device = device , dtype = dtype , non_blocking = True )
6669 return model
Original file line number Diff line number Diff line change @@ -584,7 +584,8 @@ def from_state_dict(
584584 dtype : torch .dtype ,
585585 ** kwargs ,
586586 ):
587- model = cls (device = "meta" , dtype = dtype , ** kwargs )
587+ with torch .device ("meta" ):
588+ model = cls (device = "meta" , dtype = dtype , ** kwargs )
588589 model = model .requires_grad_ (False )
589590 model .load_state_dict (state_dict , assign = True )
590591 model .to (device = device , dtype = dtype , non_blocking = True )
You can’t perform that action at this time.
0 commit comments