"hypertile_max_depth_unet":shared.OptionInfo(3,"Hypertile U-Net max depth",gr.Slider,{"minimum":0,"maximum":3,"step":1},infotext="Hypertile U-Net max depth").info("larger = more neural network layers affected; minor effect on performance"),
"hypertile_max_tile_unet":shared.OptionInfo(256,"Hypertile U-Net max tile size",gr.Slider,{"minimum":0,"maximum":512,"step":16},infotext="Hypertile U-Net max tile size").info("larger = worse performance"),
"hypertile_enable_vae":shared.OptionInfo(False,"Enable Hypertile VAE",infotext="Hypertile VAE").info("minimal change in the generated picture"),
"hypertile_max_depth_vae":shared.OptionInfo(3,"Hypertile VAE max depth",gr.Slider,{"minimum":0,"maximum":3,"step":1},infotext="Hypertile VAE max depth"),
"hypertile_max_tile_vae":shared.OptionInfo(128,"Hypertile VAE max tile size",gr.Slider,{"minimum":0,"maximum":512,"step":16},infotext="Hypertile VAE max tile size"),
xyz_grid.AxisOption("[Hypertile] Unet First pass Enabled",str,xyz_grid.apply_override('hypertile_enable_unet',boolean=True),choices=xyz_grid.boolean_choice(reverse=True)),
xyz_grid.AxisOption("[Hypertile] Unet Second pass Enabled",str,xyz_grid.apply_override('hypertile_enable_unet_secondpass',boolean=True),choices=xyz_grid.boolean_choice(reverse=True)),
xyz_grid.AxisOption("[Hypertile] Unet Max Depth",int,xyz_grid.apply_override("hypertile_max_depth_unet"),confirm=xyz_grid.confirm_range(0,3,'[Hypertile] Unet Max Depth'),choices=lambda:[str(x)forxinrange(4)]),
xyz_grid.AxisOption("[Hypertile] Unet Max Tile Size",int,xyz_grid.apply_override("hypertile_max_tile_unet"),confirm=xyz_grid.confirm_range(0,512,'[Hypertile] Unet Max Tile Size')),
xyz_grid.AxisOption("[Hypertile] VAE Max Depth",int,xyz_grid.apply_override("hypertile_max_depth_vae"),confirm=xyz_grid.confirm_range(0,3,'[Hypertile] VAE Max Depth'),choices=lambda:[str(x)forxinrange(4)]),
xyz_grid.AxisOption("[Hypertile] VAE Max Tile Size",int,xyz_grid.apply_override("hypertile_max_tile_vae"),confirm=xyz_grid.confirm_range(0,512,'[Hypertile] VAE Max Tile Size')),
Returns a function that applies the given value to the given value_name in opts.data.
"""
defvalidate(value_name:str,value:str):
value=int(value)
# validate value
ifnotmin_range==-1:
assertvalue>=min_range,f"Value {value} for {value_name} must be greater than or equal to {min_range}"
ifnotmax_range==-1:
assertvalue<=max_range,f"Value {value} for {value_name} must be less than or equal to {max_range}"
defapply_int(p,x,xs):
validate(value_name,x)
opts.data[value_name]=int(x)
returnapply_int
defbool_applier(value_name:str):
"""
Returns a function that applies the given value to the given value_name in opts.data.
"""
defvalidate(value_name:str,value:str):
assertvalue.lower()in["true","false"],f"Value {value} for {value_name} must be either true or false"
defapply_bool(p,x,xs):
validate(value_name,x)
value_boolean=x.lower()=="true"
opts.data[value_name]=value_boolean
returnapply_bool
defadd_axis_options():
extra_axis_options=[
xyz_grid.AxisOption("[Hypertile] Unet First pass Enabled",str,bool_applier("hypertile_enable_unet"),choices=xyz_grid.boolean_choice(reverse=True)),
xyz_grid.AxisOption("[Hypertile] Unet Second pass Enabled",str,bool_applier("hypertile_enable_unet_secondpass"),choices=xyz_grid.boolean_choice(reverse=True)),
xyz_grid.AxisOption("[Hypertile] Unet Max Depth",int,int_applier("hypertile_max_depth_unet",0,3),choices=lambda:[str(x)forxinrange(4)]),
xyz_grid.AxisOption("[Hypertile] Unet Max Tile Size",int,int_applier("hypertile_max_tile_unet",0,512)),