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

Add batch-evaluate mode #47

Merged
merged 5 commits into from
Jun 25, 2024
Merged

Conversation

contramundum53
Copy link
Member

Kurobako has evaluate subcommand that evaluates a problem at a given set of params. However, when we want to repeatedly evaluate different sets of params and the problem needs to load a large dataset, this is inefficient because the problem reloads the dataset every time. We add batch-evaluate subcommand that uses stdio to repeatedly evaluate sets of params without reloading the process.

@coveralls
Copy link

coveralls commented Aug 16, 2022

Pull Request Test Coverage Report for Build 2961163548

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 41 (0.0%) changed or added relevant lines in 2 files are covered.
  • 258 unchanged lines in 8 files lost coverage.
  • Overall coverage decreased (-0.02%) to 9.487%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/main.rs 0 4 0.0%
src/batch_eval.rs 0 37 0.0%
Files with Coverage Reduction New Missed Lines %
../../../.cargo/registry/src/github.com-1ecc6299db9ec823/trackable-0.2.23/src/macros.rs 5 0.0%
../../../.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.12.1/src/error.rs 6 0.0%
kurobako_core/src/registry.rs 8 0.0%
kurobako_core/src/trial.rs 10 0.0%
kurobako_problems/src/sigopt.rs 40 0.0%
src/plot/slice.rs 45 0.0%
src/plot/pareto_front.rs 46 0.0%
src/plot/curve.rs 98 0.0%
Totals Coverage Status
Change from base Build 2668460033: -0.02%
Covered Lines: 1092
Relevant Lines: 11510

💛 - Coveralls

src/batch_eval.rs Outdated Show resolved Hide resolved
impl BatchEvaluateOpt {
/// Evaluates the given parameters.
pub fn run(&self) -> Result<()> {
let mut rx: MessageReceiver<BatchEvaluateMessage, _> = MessageReceiver::new(io::stdin());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we can use kurobako_core::json::load() function (https://github.com/optuna/kurobako/blob/master/kurobako_core/src/json.rs#L19) to read parameters from the stdin until it reaches EOS.
IMO, the load function is simpler than MessageReceiver for this purpose and, by using the load function, we could remove BatchEvaluateMessage enum as it would be sufficient to define a minimum struct like the following:

#[derive(Deug, Deserialize)]
struct EvalCall {
    params: Params,
    step: Option<u64>
}

impl BatchEvaluateOpt {
    pub fn run(&self) -> Result<()> {
        let calls: Vec<EvalCall> = track!(kurobako_core::json::load(io::stdin()))?;
        ...
    }
}

Thanks for pointing that out!

Co-authored-by: Takeru Ohta <[email protected]>
@sile
Copy link
Member

sile commented Aug 16, 2022

FYI: I just created #48 to fix CI (lint) failure.

Copy link
Member

@HideakiImamura HideakiImamura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@HideakiImamura
Copy link
Member

Let me merge this PR with my one approval since we need this feature.

@HideakiImamura HideakiImamura merged commit bd67e50 into optuna:master Jun 25, 2024
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.

None yet

4 participants