Made-With-ML icon indicating copy to clipboard operation
Made-With-ML copied to clipboard

Getting TypeError: __init__() takes 2 positional arguments but 4 were given

Open minyoungjeong0812 opened this issue 1 year ago • 2 comments

Hi, I am following your made-with-ML tutorial and currently at the experiment tracking step. When I ran the following code after specifying a run config based on ML flow callbacks, I am getting Getting TypeError: init() takes 2 positional arguments but 4 were given . Could you please help?

# Dataset
ds = load_data()
train_ds, val_ds = stratify_split(ds, stratify="tag", test_size=test_size)

# Preprocess
preprocessor = CustomPreprocessor()
train_ds = preprocessor.fit_transform(train_ds)
val_ds = preprocessor.transform(val_ds)
train_ds = train_ds.materialize()
val_ds = val_ds.materialize()

# Trainer
trainer = TorchTrainer(
    train_loop_per_worker=train_loop_per_worker,
    train_loop_config=train_loop_config,
    scaling_config=scaling_config,
    run_config=run_config,  # uses RunConfig with MLflow callback
    datasets={"train": train_ds, "val": val_ds},
    dataset_config=dataset_config,
    preprocessor=preprocessor,
)

# Train
results = trainer.fit()

minyoungjeong0812 avatar Feb 06 '24 03:02 minyoungjeong0812

Hi @minyoungjeong0812

I ran into the same error which seems to be a bug in ray release 2.7.0 being fixed in 2.7.1:

https://github.com/ray-project/ray/releases/tag/ray-2.7.1

I just upgraded to the version 2.7.1 here and got it properly working after updating the dependencies.

python3 -m pip install -r requirements.txt

bvahdat avatar Mar 17 '24 10:03 bvahdat

Hi, I'm still experiencing the same issue even after updating Ray to versions 2.7.1 and 2.7.2. I currently have setuptools version 69.5.1 installed. @minyoungjeong0812 @bvahdat Any assistance would be greatly appreciated. Thank you!

NikhilK-crypto avatar Jul 31 '24 19:07 NikhilK-crypto