@@ -1778,7 +1778,6 @@ bool ModelLoader::model_is_unet() {
17781778
17791779SDVersion ModelLoader::get_sd_version () {
17801780 TensorStorage token_embedding_weight, input_block_weight;
1781- bool input_block_checked = false ;
17821781
17831782 bool has_multiple_encoders = false ;
17841783 bool is_unet = false ;
@@ -1791,12 +1790,12 @@ SDVersion ModelLoader::get_sd_version() {
17911790 bool has_middle_block_1 = false ;
17921791
17931792 for (auto & tensor_storage : tensor_storages) {
1794- if (!(is_xl || is_flux )) {
1793+ if (!(is_xl)) {
17951794 if (tensor_storage.name .find (" model.diffusion_model.double_blocks." ) != std::string::npos) {
17961795 is_flux = true ;
1797- if (input_block_checked) {
1798- break ;
1799- }
1796+ }
1797+ if (tensor_storage. name . find ( " model.diffusion_model.nerf_final_layer_conv. " ) != std::string::npos) {
1798+ return VERSION_CHROMA_RADIANCE;
18001799 }
18011800 if (tensor_storage.name .find (" model.diffusion_model.joint_blocks." ) != std::string::npos) {
18021801 return VERSION_SD3;
@@ -1813,22 +1812,19 @@ SDVersion ModelLoader::get_sd_version() {
18131812 if (tensor_storage.name .find (" model.diffusion_model.img_emb" ) != std::string::npos) {
18141813 has_img_emb = true ;
18151814 }
1816- if (tensor_storage.name .find (" model.diffusion_model.input_blocks." ) != std::string::npos || tensor_storage.name .find (" unet.down_blocks." ) != std::string::npos) {
1815+ if (tensor_storage.name .find (" model.diffusion_model.input_blocks." ) != std::string::npos ||
1816+ tensor_storage.name .find (" unet.down_blocks." ) != std::string::npos) {
18171817 is_unet = true ;
18181818 if (has_multiple_encoders) {
18191819 is_xl = true ;
1820- if (input_block_checked) {
1821- break ;
1822- }
18231820 }
18241821 }
1825- if (tensor_storage.name .find (" conditioner.embedders.1" ) != std::string::npos || tensor_storage.name .find (" cond_stage_model.1" ) != std::string::npos || tensor_storage.name .find (" te.1" ) != std::string::npos) {
1822+ if (tensor_storage.name .find (" conditioner.embedders.1" ) != std::string::npos ||
1823+ tensor_storage.name .find (" cond_stage_model.1" ) != std::string::npos ||
1824+ tensor_storage.name .find (" te.1" ) != std::string::npos) {
18261825 has_multiple_encoders = true ;
18271826 if (is_unet) {
18281827 is_xl = true ;
1829- if (input_block_checked) {
1830- break ;
1831- }
18321828 }
18331829 }
18341830 if (tensor_storage.name .find (" model.diffusion_model.input_blocks.8.0.time_mixer.mix_factor" ) != std::string::npos) {
@@ -1848,12 +1844,10 @@ SDVersion ModelLoader::get_sd_version() {
18481844 token_embedding_weight = tensor_storage;
18491845 // break;
18501846 }
1851- if (tensor_storage.name == " model.diffusion_model.input_blocks.0.0.weight" || tensor_storage.name == " model.diffusion_model.img_in.weight" || tensor_storage.name == " unet.conv_in.weight" ) {
1852- input_block_weight = tensor_storage;
1853- input_block_checked = true ;
1854- if (is_flux) {
1855- break ;
1856- }
1847+ if (tensor_storage.name == " model.diffusion_model.input_blocks.0.0.weight" ||
1848+ tensor_storage.name == " model.diffusion_model.img_in.weight" ||
1849+ tensor_storage.name == " unet.conv_in.weight" ) {
1850+ input_block_weight = tensor_storage;
18571851 }
18581852 }
18591853 if (is_wan) {
0 commit comments