Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: expected str, bytes or os.PathLike object, not bool #95

Open
davidemoro opened this issue Nov 6, 2023 · 0 comments
Open

Comments

@davidemoro
Copy link

davidemoro commented Nov 6, 2023

The "save_path" patch included in the "backend_kwargs" argument of the "predict" method will be overridden by a bool by "parse_backend_predict_kwargs".

This is caused by the following line:
save_path = kwargs.get("persist", None)

I think it should be instead:
save_path = kwargs.get("save_path", None)

Code reproducing the issue:

    predictor.predict(
        file_path,
        predictor_path=predictor_path,
        job_name=job_name,
        instance_type=instance_type,
        instance_count=1,
        wait=True,
        backend_kwargs={'save_path': output_path,     # this is a file system path!!
                        'transform_kwargs': {
                            'content_type': 'text/csv',
                            'split_type': 'Line',
                            'model_client_config': {
                                'InvocationsTimeoutInSeconds': 60*60,
                                'InvocationsMaxRetries': 2,}, },
                        'transformer_kwargs': {
                            'strategy': 'MultiRecord',
                            'assemble_with': 'Line',
                            'max_payload': 2, },
                        },
    )

Exception:

  File "//app.py", line 234, in <module>
    cli()  # pragma: no cover
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "//app.py", line 230, in batch_inference
    batch_inference_inner(input_path, predictor_path, output_path, instance_type, instance_count)
  File "//app.py", line 114, in batch_inference_inner
    if fs.get_protocol(input_path) != 'file':
  File "/opt/conda/lib/python3.9/site-packages/autogluon/cloud/predictor/cloud_predictor.py", line 556, in predict
    return self.backend.predict(
  File "/opt/conda/lib/python3.9/site-packages/autogluon/cloud/backend/sagemaker_backend.py", line 739, in predict
    pred, _ = self._predict(
  File "/opt/conda/lib/python3.9/site-packages/autogluon/cloud/backend/sagemaker_backend.py", line 1227, in _predict
    results_path = self.download_predict_results(save_path=save_path)
  File "/opt/conda/lib/python3.9/site-packages/autogluon/cloud/backend/sagemaker_backend.py", line 896, in download_predict_results
    save_path = os.path.expanduser(save_path)
  File "/opt/conda/lib/python3.9/posixpath.py", line 231, in expanduser
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not bool

Reproducible with the latest autogluon release:

FROM 763104351884.dkr.ecr.us-east-1.amazonaws.com/autogluon-training:0.8.2-gpu-py39-cu117-ubuntu20.04

RUN pip install --no-cache-dir -U autogluon.cloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant