def local_experiment(args: Namespace) -> None: try: from determined import experimental, load except ImportError as e: print("--local requires that the `determined` package is installed.") raise e if not args.test_mode: raise NotImplementedError( "Local training mode (--local mode without --test mode) is not yet supported. Please " "try local test mode by adding the --test flag or cluster training mode by removing " "the --local flag.") experiment_config = _parse_config_file_or_exit(args.config_file) # Python typically initializes sys.path[0] as the empty string when # invoked interactively, which directs Python to search modules in the # current directory first. However, this is _not_ happening when this # Python function is invoked via the cli. We add it manually here so # that test_one_batch can import the entrypoint by changing the # directory to model_def. # # Reference: https://docs.python.org/3/library/sys.html#sys.path with experimental._local_execution_manager(args.model_def.resolve()): trial_class = load.load_trial_implementation( experiment_config["entrypoint"]) sys.path = [""] + sys.path experimental.test_one_batch(trial_class=trial_class, config=experiment_config)
def test_test_one_batch() -> None: experimental.test_one_batch( pathlib.Path(pytorch_xor_model.__file__).parent, pytorch_xor_model.XORTrial, config={ "hyperparameters": { "hidden_size": 2, "learning_rate": 0.5, "global_batch_size": 4 } }, )
def test_test_one_batch() -> None: with det._local_execution_manager( pathlib.Path(pytorch_xor_model.__file__).parent): experimental.test_one_batch( trial_class=pytorch_xor_model.XORTrial, config={ "hyperparameters": { "hidden_size": 2, "learning_rate": 0.5, "global_batch_size": 4 } }, )
def local_experiment(args: Namespace) -> None: experiment_config = _parse_config_file_or_exit(args.config_file) try: from determined import experimental except ImportError as e: print("--local requires that the `determined` package is installed.") raise e # Python typically initializes sys.path[0] as the empty string when # invoked interactively, which directs Python to search modules in the # current directory first. However, this is _not_ happening when this # Python function is invoked via the cli. We add it manually here so # that test_one_batch can import the entrypoint by changing the # directory to model_def. # # Reference: https://docs.python.org/3/library/sys.html#sys.path sys.path = [""] + sys.path experimental.test_one_batch( args.model_def.resolve(), trial_class=None, config=experiment_config )
def local_experiment(args: Namespace) -> None: try: import determined as det from determined import experimental, load except ImportError as e: print("--local requires that the `determined` package is installed.") raise e if not args.test_mode: raise NotImplementedError( "Local training mode (--local mode without --test mode) is not yet supported. Please " "try local test mode by adding the --test flag or cluster training mode by removing " "the --local flag." ) experiment_config = _parse_config_file_or_exit(args.config_file) determined.common.set_logger(bool(experiment_config.get("debug", False))) with det._local_execution_manager(args.model_def.resolve()): trial_class = load.trial_class_from_entrypoint(experiment_config["entrypoint"]) experimental.test_one_batch(trial_class=trial_class, config=experiment_config)