@@ -95,21 +95,24 @@ def _replace_relative_paths_for_remote_source(
9595
9696
9797def load_raw_resource_description (
98- source : Union [dict , os .PathLike , IO , str , bytes , raw_nodes .URI , RawResourceDescription ]
98+ source : Union [dict , os .PathLike , IO , str , bytes , raw_nodes .URI , RawResourceDescription ],
99+ update_to_current_format : bool = True ,
99100) -> RawResourceDescription :
100101 """load a raw python representation from a BioImage.IO resource description file (RDF).
101102 Use `load_resource_description` for a more convenient representation.
102103
103104 Args:
104105 source: resource description file (RDF)
106+ update_to_current_format: if True (default) attempt auto-conversion to latest format version
107+ (most bioimageio.core functionality expects the latest format version for each resource)
105108
106109 Returns:
107110 raw BioImage.IO resource
108111 """
109112 if isinstance (source , RawResourceDescription ):
110113 return source
111114
112- raw_rd = spec .load_raw_resource_description (source , update_to_current_format = True )
115+ raw_rd = spec .load_raw_resource_description (source , update_to_current_format = update_to_current_format )
113116 raw_rd = _replace_relative_paths_for_remote_source (raw_rd , raw_rd .root_path )
114117 return raw_rd
115118
@@ -133,7 +136,7 @@ def load_resource_description(
133136 if isinstance (source , ResourceDescription ):
134137 return source
135138
136- raw_rd = load_raw_resource_description (source )
139+ raw_rd = load_raw_resource_description (source , update_to_current_format = True )
137140
138141 if weights_priority_order is not None :
139142 for wf in weights_priority_order :
@@ -181,26 +184,28 @@ def get_local_resource_package_content(
181184def export_resource_package (
182185 source : Union [RawResourceDescription , os .PathLike , str , dict , raw_nodes .URI ],
183186 * ,
184- output_path : Optional [os .PathLike ] = None ,
185- weights_priority_order : Optional [Sequence [Union [str ]]] = None ,
186187 compression : int = ZIP_DEFLATED ,
187188 compression_level : int = 1 ,
189+ output_path : Optional [os .PathLike ] = None ,
190+ update_to_current_format : bool = False ,
191+ weights_priority_order : Optional [Sequence [Union [str ]]] = None ,
188192) -> pathlib .Path :
189193 """Package a BioImage.IO resource as a zip file.
190194
191195 Args:
192196 source: raw resource description, path, URI or raw data as dict
193- output_path: file path to write package to
194- weights_priority_order: If given only the first weights format present in the model is included.
195- If none of the prioritized weights formats is found all are included.
196197 compression: The numeric constant of compression method.
197198 compression_level: Compression level to use when writing files to the archive.
198199 See https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile
200+ output_path: file path to write package to
201+ update_to_current_format: If True attempt auto-conversion to latest format version.
202+ weights_priority_order: If given only the first weights format present in the model is included.
203+ If none of the prioritized weights formats is found all are included.
199204
200205 Returns:
201206 path to zipped BioImage.IO package in BIOIMAGEIO_CACHE_PATH or 'output_path'
202207 """
203- raw_rd = load_raw_resource_description (source )
208+ raw_rd = load_raw_resource_description (source , update_to_current_format = update_to_current_format )
204209 package_content = get_local_resource_package_content (raw_rd , weights_priority_order )
205210 if output_path is None :
206211 package_path = _get_tmp_package_path (raw_rd , weights_priority_order )
0 commit comments