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

ValueError: cannot find context for 'fork' on windows #208

Closed
xucian opened this issue Apr 5, 2022 · 2 comments
Closed

ValueError: cannot find context for 'fork' on windows #208

xucian opened this issue Apr 5, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@xucian
Copy link

xucian commented Apr 5, 2022

Running this code doesn't work
`
model = xgboost_ray.train(
{
# This is important to be set correctly for the problem type (multi class in our case)
'objective': objective,

                'eval_metric': self.val_metric,
                'enable_categorical': enable_categorical,
                'use_label_encoder': use_label_encoder,
                'tree_method': tree_method,
                'max_depth': max_depth,
                'n_jobs': n_jobs,
                'learning_rate': learning_rate,
                'num_parallel_tree': num_parallel_tree,
                'colsample_bylevel': colsample_bylevel,

                'sample_weight': weights.train.samples,
                'sample_weight_eval_set': [weights.val.samples],
                'feature_weights': weights.flatten_sequence_weights,

                'min_child_weight': min_child_weight,
                'gamma': gamma,
                'reg_alpha': reg_alpha,
                'reg_lambda': reg_lambda,
                'max_bin': max_bin,

                'random_state': random_state,
                'verbosity': verbosity,
            },
            train_set,
            num_boost_round=num_boost_round,
            evals=[(val_set, 'val')],
            early_stopping_rounds=self.early_stopping_rounds,
            verbose_eval=10,

            # Ray-specific params
            ray_params=RayParams(
                num_actors=1,
                cpus_per_actor=max(1, os.cpu_count()-1),
                gpus_per_actor=-1,
            )
        )`

Tried to set multiprocessing.set_start_method("spawn", force=True) before, but it doesn't work

@amogkam amogkam added the enhancement New feature or request label Apr 5, 2022
@amogkam
Copy link
Contributor

amogkam commented Apr 6, 2022

Hey @tfgstudios, thanks for raising this issue! Unfortunately xgboost-ray does not work on Windows. We require the fork method to be used for multiprocessing instead of spawn.

We will add this as an enhancement to provide support for this in the future!

@amogkam
Copy link
Contributor

amogkam commented Apr 6, 2022

Going to close this issue, but @tfgstudios please +1 this issue for adding windows support #210!

@amogkam amogkam closed this as completed Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants