@@ -656,7 +656,7 @@ def load_tokenizer(self, cls, **kwargs):
656656 """Load a tokenizer layer from the preset."""
657657 raise NotImplementedError
658658
659- def load_task (self , cls , load_weights , load_task , ** kwargs ):
659+ def load_task (self , cls , load_weights , load_task_extras , ** kwargs ):
660660 """Load a task model from the preset.
661661
662662 By default, we create a task from a backbone and preprocessor with
@@ -672,11 +672,11 @@ def load_task(self, cls, load_weights, load_task, **kwargs):
672672 if "preprocessor" not in kwargs :
673673 kwargs ["preprocessor" ] = self .load_preprocessor (
674674 cls .preprocessor_cls ,
675- load_task = load_task ,
675+ load_task_extras = load_task_extras ,
676676 )
677677 return cls (** kwargs )
678678
679- def load_preprocessor (self , cls , load_task , ** kwargs ):
679+ def load_preprocessor (self , cls , load_task_extras , ** kwargs ):
680680 """Load a prepocessor layer from the preset.
681681
682682 By default, we create a preprocessor from a tokenizer with default
@@ -705,23 +705,24 @@ def load_tokenizer(self, cls, **kwargs):
705705 tokenizer .load_preset_assets (self .preset )
706706 return tokenizer
707707
708- def load_task (self , cls , load_weights , load_task , ** kwargs ):
708+ def load_task (self , cls , load_weights , load_task_extras , ** kwargs ):
709709 # If there is no `task.json` or it's for the wrong class delegate to the
710710 # super class loader.
711- if not load_task :
712- return super ().load_task (cls , load_weights , load_task , ** kwargs )
711+ if not load_task_extras :
712+ return super ().load_task (cls , load_weights , load_task_extras , ** kwargs )
713713 if not check_file_exists (self .preset , TASK_CONFIG_FILE ):
714714 raise ValueError (
715715 "Saved preset has no `task.json`, cannot load the task config "
716- "from a file. Call `from_preset()` with `load_task=False` to "
717- "load the task from a backbone with library defaults."
716+ "from a file. Call `from_preset()` with "
717+ "`load_task_extras=False` to load the task from a backbone "
718+ "with library defaults."
718719 )
719720 task_config = load_json (self .preset , TASK_CONFIG_FILE )
720721 if not issubclass (check_config_class (task_config ), cls ):
721722 raise ValueError (
722723 f"Saved `task.json`does not match calling cls { cls } . Call "
723- "`from_preset()` with `load_task =False` to load the task from "
724- "a backbone with library defaults."
724+ "`from_preset()` with `load_task_extras =False` to load the "
725+ "task from a backbone with library defaults."
725726 )
726727 # We found a `task.json` with a complete config for our class.
727728 task = load_serialized_object (task_config , ** kwargs )
@@ -736,21 +737,21 @@ def load_task(self, cls, load_weights, load_task, **kwargs):
736737 task .backbone .load_weights (backbone_weights )
737738 return task
738739
739- def load_preprocessor (self , cls , load_task , ** kwargs ):
740- if not load_task :
741- return super ().load_preprocessor (cls , load_task , ** kwargs )
740+ def load_preprocessor (self , cls , load_task_extras , ** kwargs ):
741+ if not load_task_extras :
742+ return super ().load_preprocessor (cls , load_task_extras , ** kwargs )
742743 if not check_file_exists (self .preset , PREPROCESSOR_CONFIG_FILE ):
743744 raise ValueError (
744745 "Saved preset has no `preprocessor.json`, cannot load the task "
745746 "preprocessing config from a file. Call `from_preset()` with "
746- "`load_task =False` to load the preprocessor with library "
747- "defaults."
747+ "`load_task_extras =False` to load the preprocessor with "
748+ "library defaults."
748749 )
749750 preprocessor_json = load_json (self .preset , PREPROCESSOR_CONFIG_FILE )
750751 if not issubclass (check_config_class (preprocessor_json ), cls ):
751752 raise ValueError (
752753 f"Saved `preprocessor.json`does not match calling cls { cls } . "
753- "Call `from_preset()` with `load_task =False` to "
754+ "Call `from_preset()` with `load_task_extras =False` to "
754755 "load the the preprocessor with library defaults."
755756 )
756757 # We found a `preprocessing.json` with a complete config for our class.
0 commit comments