Ray Tune fit() function File Not Found on Windows

93 Views Asked by At

I'm trying out Raytune, the code looks like this:

def ray_tune_lgbm_train(config):

    X_train = ctgan_syn_X_train.copy()
    y_train = y_train.copy()
    
    opt_X_train, opt_X_val, opt_y_train, opt_y_val = train_test_split(x_train, y_train, test_size=0.2)
    train_set = lgb.Dataset(opt_X_train, label=opt_y_train)
    valid_set = lgb.Dataset(opt_X_val, label=opt_y_val)
    
    lgbm_model = lgb.train(
        config,
        train_set,
        valid_sets=[valid_set],
        valid_names=['lgbm_valid'],
        verbose_eval=False,
        callbacks=[
            TuneReportCheckpointCallback(
                {
                    'average_precision': 'val_avp',
                    'auc': 'val_auc',
                }
            )
        ],
    )
    y_val_pred = lgbm_model.predict(opt_X_val)
    session.report(
        {
            "AUC": roc_auc_score(opt_y_val, y_val_pred),
            "done": True,
        }
    )
    
    
config = {
    "objective": "binary",
    "metric": "auc",
    "random_state": 10,
    "verbosity": -1,
    "boosting": "gbdt",
    "num_threads": 4,

    "num_leaves": tune.randint(4, 30),
    "learning_rate": tune.loguniform(0.005, 1.0),
    "bagging_fraction": tune.uniform(0.1, 1.0),
    "feature_fraction": tune.uniform(0.1, 1.0),
    "bagging_freq": tune.randint(10, 30),
    "min_data_in_leaf": tune.randint(1000, 3000),
    "num_iterations": tune.randint(1000, 3000)
}

tuner = tune.Tuner(
    ray_tune_lgbm_train,
    tune_config=tune.TuneConfig(
        metric='auc',
        mode="max",
        scheduler=ASHAScheduler(),
        num_samples=5,
    ),
    param_space=config,
)

results = tuner.fit()

I'm using Windows, the error I got was:

File ~\anaconda3\envs\secret_guest\lib\site-packages\tensorboardX\record_writer.py:58, in open_file(path) 57 prefix = path.split(':')[0] ---> 58 factory = REGISTERED_FACTORIES[prefix] 59 return factory.open(path)

KeyError: 'C'

FileNotFoundError: [Errno 2] No such file or directory: 'C:\ray_results\ray_tune_lgbm_train_2023-09-13_23-23-51\ray_tune_lgbm_train_23db6_00002_2_bagging_fraction=0.7080,bagging_freq=15,feature_fraction=0.4676,learning_rate=0.1459,min_data_in_2023-09-13_23-23-58\events.out.tfevents.1694661844.DESKTOP-BB1U7JL'

I do find the output folders but can't find file events.out.tfevents.1694661844.DESKTOP-BB1U7JL. Do you know how to solve this error?

0

There are 0 best solutions below