@@ -376,8 +376,7 @@ def forward(self, x, tile_mode, cache_mode, alpha, pro):
376376 t2 = tile_mode * 2
377377 crop_size = (((h0 - 1 ) // t2 * t2 + t2 ) // tile_mode , ((w0 - 1 ) // t2 * t2 + t2 ) // tile_mode )
378378 else :
379- print ("[CCCV] tile_mode config error" )
380- os ._exit (233 )
379+ raise ValueError ("[CCCV] tile_mode config error: invalid tile_mode value" )
381380
382381 ph = ((h0 - 1 ) // crop_size [0 ] + 1 ) * crop_size [0 ]
383382 pw = ((w0 - 1 ) // crop_size [1 ] + 1 ) * crop_size [1 ]
@@ -526,8 +525,7 @@ def forward_gap_sync(self, x, tile_mode, alpha, pro):
526525 t2 = tile_mode * 2
527526 crop_size = (((h0 - 1 ) // t2 * t2 + t2 ) // tile_mode , ((w0 - 1 ) // t2 * t2 + t2 ) // tile_mode )
528527 else :
529- print ("[CCCV] tile_mode config error" )
530- os ._exit (233 )
528+ raise ValueError ("[CCCV] tile_mode config error: invalid tile_mode value" )
531529 ph = ((h0 - 1 ) // crop_size [0 ] + 1 ) * crop_size [0 ]
532530 pw = ((w0 - 1 ) // crop_size [1 ] + 1 ) * crop_size [1 ]
533531 x = F .pad (x , (18 , 18 + pw - w0 , 18 , 18 + ph - h0 ), "reflect" )
@@ -767,8 +765,7 @@ def forward(self, x, tile_mode, cache_mode, alpha, pro):
767765 t4 = tile_mode * 4
768766 crop_size = (((h0 - 1 ) // t4 * t4 + t4 ) // tile_mode , ((w0 - 1 ) // t4 * t4 + t4 ) // tile_mode )
769767 else :
770- print ("[CCCV] tile_mode config error" )
771- os ._exit (233 )
768+ raise ValueError ("[CCCV] tile_mode config error: invalid tile_mode value" )
772769 ph = ((h0 - 1 ) // crop_size [0 ] + 1 ) * crop_size [0 ]
773770 pw = ((w0 - 1 ) // crop_size [1 ] + 1 ) * crop_size [1 ]
774771 x = F .pad (x , (14 , 14 + pw - w0 , 14 , 14 + ph - h0 ), "reflect" )
@@ -916,8 +913,7 @@ def forward_gap_sync(self, x, tile_mode, alpha, pro):
916913 t4 = tile_mode * 4
917914 crop_size = (((h0 - 1 ) // t4 * t4 + t4 ) // tile_mode , ((w0 - 1 ) // t4 * t4 + t4 ) // tile_mode )
918915 else :
919- print ("[CCCV] tile_mode config error" )
920- os ._exit (233 )
916+ raise ValueError ("[CCCV] tile_mode config error: invalid tile_mode value" )
921917 ph = ((h0 - 1 ) // crop_size [0 ] + 1 ) * crop_size [0 ]
922918 pw = ((w0 - 1 ) // crop_size [1 ] + 1 ) * crop_size [1 ]
923919 x = F .pad (x , (14 , 14 + pw - w0 , 14 , 14 + ph - h0 ), "reflect" )
@@ -1162,8 +1158,7 @@ def forward(self, x, tile_mode, cache_mode, alpha, pro):
11621158 t2 = tile_mode * 2
11631159 crop_size = (((h0 - 1 ) // t2 * t2 + t2 ) // tile_mode , ((w0 - 1 ) // t2 * t2 + t2 ) // tile_mode )
11641160 else :
1165- print ("[CCCV] tile_mode config error" )
1166- os ._exit (233 )
1161+ raise ValueError ("[CCCV] tile_mode config error: invalid tile_mode value" )
11671162 ph = ((h0 - 1 ) // crop_size [0 ] + 1 ) * crop_size [0 ]
11681163 pw = ((w0 - 1 ) // crop_size [1 ] + 1 ) * crop_size [1 ]
11691164 x = F .pad (x , (19 , 19 + pw - w0 , 19 , 19 + ph - h0 ), "reflect" )
@@ -1323,8 +1318,7 @@ def forward_gap_sync(self, x, tile_mode, alpha, pro):
13231318 t2 = tile_mode * 2
13241319 crop_size = (((h0 - 1 ) // t2 * t2 + t2 ) // tile_mode , ((w0 - 1 ) // t2 * t2 + t2 ) // tile_mode ) # 5.6G
13251320 else :
1326- print ("[CCCV] tile_mode config error" )
1327- os ._exit (233 )
1321+ raise ValueError ("[CCCV] tile_mode config error: invalid tile_mode value" )
13281322 ph = ((h0 - 1 ) // crop_size [0 ] + 1 ) * crop_size [0 ]
13291323 pw = ((w0 - 1 ) // crop_size [1 ] + 1 ) * crop_size [1 ]
13301324 x = F .pad (x , (19 , 19 + pw - w0 , 19 , 19 + ph - h0 ), "reflect" )
0 commit comments