Skip to content

"ValueError: too many values to unpack (expected 2)" is occurred in windows local mode #847

Description

@xnaiman

System Information

  • Framework (e.g. TensorFlow) / Algorithm (e.g. KMeans): Scikit-Learn
  • Framework Version: 0.20.0 (official sagemaker-scikit-learn-container)
  • Python Version: 3.6
  • CPU or GPU: CPU
  • Python SDK Version: 1.26.0
  • Are you using a custom image: No

Describe the problem

When I execute fit method in local mode on windows, "ValueError: too many values to unpack (expected 2)" is occurred.

Cause

I already know that the cause is the difference between windows and linux drive description. Therefore, I specify the cause.

The following code is provided for sagemaker-python-sdk/src/sagemaker/local/image.py.

  • class: _SageMakerContainer
  • method: retrieve_artifacts
host_dir, container_dir = volume.split(':')

When this code is executed on windows, if volume is as follows.

C:\Users\oracle7\AppData\Local\Temp\tmp9sd97b87\algo-1-gnnm3\input:/opt/ml/input

The retun value is three and is as follows.

  • C:
  • \Users\oracle7\AppData\Local\Temp\tmp9sd97b87\algo-1-gnnm3\input
  • /opt/ml/input

Thus, if platform.system () is Windows, three return values ​​should be assumed.

Minimal repro / logs

  • Logs
algo-1-gnnm3_1  | 2019-06-13 00:45:24,804 sagemaker-containers INFO     Reporting training SUCCESS
tmp9sd97b87_algo-1-gnnm3_1 exited with code 0
Aborting on container exit...
Traceback (most recent call last):
  File "c:\Users\oracle7\.vscode\extensions\ms-python.python-2019.5.18875\pythonFiles\ptvsd_launcher.py", line 43, in <module>
    main(ptvsdArgs)
  File "c:\Users\oracle7\.vscode\extensions\ms-python.python-2019.5.18875\pythonFiles\lib\python\ptvsd\__main__.py", line 434, in main
    run()
  File "c:\Users\oracle7\.vscode\extensions\ms-python.python-2019.5.18875\pythonFiles\lib\python\ptvsd\__main__.py", line 312, in run_file
    runpy.run_path(target, run_name='__main__')
  File "C:\Anaconda3\envs\sagemaker\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Anaconda3\envs\sagemaker\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Anaconda3\envs\sagemaker\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\oracle7\Documents\GitLab\System\predictive-maintenance\sagemaker\tutorial_basic\train.py", line 24, in <module>
    sklearn.fit({'train': train_input})
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\estimator.py", line 234, in fit
    self.latest_training_job = _TrainingJob.start_new(self, inputs)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\estimator.py", line 592, in start_new
    estimator.sagemaker_session.train(**train_args)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\session.py", line 317, in train
    self.sagemaker_client.create_training_job(**train_request)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\local\local_session.py", line 73, in create_training_job
    training_job.start(InputDataConfig, OutputDataConfig, hyperparameters, TrainingJobName)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\local\entities.py", line 69, in start
    self.model_artifacts = self.container.train(input_data_config, output_data_config, hyperparameters, job_name)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\local\image.py", line 143, in train
    artifacts = self.retrieve_artifacts(compose_data, output_data_config, job_name)
  File "C:\Anaconda3\envs\sagemaker\lib\site-packages\sagemaker\local\image.py", line 239, in retrieve_artifacts
    host_dir, container_dir = volume.split(':')
ValueError: too many values to unpack (expected 2)
  • Exact command to reproduce:
sklearn = SKLearn(
    entry_point='scikit_learn_iris.py',
    train_instance_type="ml.c4.xlarge",
    role=role,
    sagemaker_session=sagemaker_session,
    hyperparameters={'max_leaf_nodes': 30})

sklearn.fit({'train': train_input})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions