Skip to content

[tune] wrapper function to pass arbitrary objects through the object store to trainables#10679

Merged
richardliaw merged 5 commits intoray-project:masterfrom
krfricke:tune-pass-obj
Sep 11, 2020
Merged

[tune] wrapper function to pass arbitrary objects through the object store to trainables#10679
richardliaw merged 5 commits intoray-project:masterfrom
krfricke:tune-pass-obj

Conversation

@krfricke
Copy link
Copy Markdown
Contributor

@krfricke krfricke commented Sep 9, 2020

Why are these changes needed?

This PR adds a with_parameters wrapper function to pass arbitrary parameters to Tune trainables. It works similar to functools.partial, but it stores parameters in the Ray object store and automatically retrieves and passes them to the trainable.

Related issue number

#10305
Also answers numerous requests on Slack on how to pass parameters to trainables.

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/latest/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failure rates at https://ray-travis-tracker.herokuapp.com/.
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested (please justify below)

@richardliaw
Copy link
Copy Markdown
Contributor

We will want to fallback to pickle in a future iteration of this.

@danihinjos
Copy link
Copy Markdown

danihinjos commented May 22, 2023

Hello! Just wanted to reopen this as I'm currently trying to pass a tf.Dataset object through .with_parameters() and I keep getting the error "tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot convert a Tensor of dtype variant to a NumPy array". I've tried several ways and everything points to this method not being able to handle this object. How would you do this?

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

Successfully merging this pull request may close these issues.

3 participants