@@ -289,6 +289,23 @@ def __init__(
289289 self ._version = self ._pick_version (version )
290290 # Compute the base directory (for download) and dataset/version directory.
291291 self ._data_dir_root , self ._data_dir = self ._build_data_dir (data_dir )
292+ # If the dataset info is available, use it.
293+ if dataset_info .dataset_info_path (self .data_path ).exists ():
294+ self .info .read_from_directory (self ._data_dir )
295+ else : # Use the code version (do not restore data)
296+ self .info .initialize_from_bucket ()
297+ if self .BLOCKED_VERSIONS is not None :
298+ config_name = self ._builder_config .name if self ._builder_config else None
299+ if is_blocked := self .BLOCKED_VERSIONS .is_blocked (
300+ version = self ._version , config = config_name
301+ ):
302+ default_msg = (
303+ f"Dataset { self .name } is blocked at version { self ._version } and"
304+ f" config { config_name } ."
305+ )
306+ self .info .set_is_blocked (
307+ is_blocked .blocked_msg if is_blocked .blocked_msg else default_msg
308+ )
292309
293310 @utils .classproperty
294311 @classmethod
@@ -493,23 +510,6 @@ def info(self) -> dataset_info.DatasetInfo:
493510 "DatasetBuilder._info should returns `tfds.core.DatasetInfo`, not "
494511 f" { type (info )} ."
495512 )
496- # If the dataset info is available, use it.
497- if dataset_info .dataset_info_path (self .data_path ).exists ():
498- info .read_from_directory (self .data_path )
499- else : # Use the code version (do not restore data)
500- info .initialize_from_bucket ()
501- if self .BLOCKED_VERSIONS is not None :
502- config_name = self ._builder_config .name if self ._builder_config else None
503- if is_blocked := self .BLOCKED_VERSIONS .is_blocked (
504- version = self ._version , config = config_name
505- ):
506- default_msg = (
507- f"Dataset { self .name } is blocked at version { self ._version } and"
508- f" config { config_name } ."
509- )
510- info .set_is_blocked (
511- is_blocked .blocked_msg if is_blocked .blocked_msg else default_msg
512- )
513513 return info
514514
515515 @utils .classproperty
0 commit comments