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

TypeError: __init__() got an unexpected keyword argument 'checkpoint_callback' #11

Closed
wershofe opened this issue Nov 30, 2022 · 3 comments

Comments

@wershofe
Copy link

Hi
I just tried running the Norman data tutorial and get the following error:

model.train(max_epochs=2000,
use_gpu=True,
batch_size=1024,
early_stopping=True,
plan_kwargs=trainer_params,
early_stopping_patience=15,
check_val_every_n_epoch=5,
save_path='/home/mohsen/projects/cpa/lightning_logs/Norman2019_prep_new/',
)

TypeError Traceback (most recent call last)
Cell In [16], line 1
----> 1 model.train(max_epochs=2000,
2 use_gpu=True,
3 batch_size=1024,
4 early_stopping=True,
5 plan_kwargs=trainer_params,
6 early_stopping_patience=15,
7 check_val_every_n_epoch=5,
8 save_path='/home/mohsen/projects/cpa/lightning_logs/Norman2019_prep_new/',
9 )

File ~/miniconda3/envs/envCPA/lib/python3.9/site-packages/cpa/_model.py:317, in CPA.train(self, max_epochs, use_gpu, train_size, validation_size, batch_size, early_stopping, plan_kwargs, hyperopt, save_path, **trainer_kwargs)
314 checkpoint = SaveBestState(monitor='cpa_metric', mode='max', period=20, verbose=False)
315 trainer_kwargs['callbacks'].append(checkpoint)
--> 317 runner = TrainRunner(
318 self,
319 training_plan=self.training_plan,
320 data_splitter=data_splitter,
321 max_epochs=max_epochs,
322 use_gpu=use_gpu,
323 early_stopping_monitor="cpa_metric",
324 early_stopping_mode='max',
325 checkpoint_callback=True,
326 **trainer_kwargs,
327 )
328 runner()
330 self.epoch_history = pd.DataFrame().from_dict(self.training_plan.epoch_history)

File ~/miniconda3/envs/envCPA/lib/python3.9/site-packages/scvi/train/_trainrunner.py:67, in TrainRunner.init(self, model, training_plan, data_splitter, max_epochs, use_gpu, **trainer_kwargs)
65 self.lightning_devices = lightning_devices
66 self.device = device
---> 67 self.trainer = Trainer(
68 max_epochs=max_epochs,
69 accelerator=accelerator,
70 devices=lightning_devices,
71 gpus=None,
72 **trainer_kwargs,
73 )

File ~/miniconda3/envs/envCPA/lib/python3.9/site-packages/scvi/train/_trainer.py:141, in Trainer.init(self, gpus, benchmark, flush_logs_every_n_steps, check_val_every_n_epoch, max_epochs, default_root_dir, enable_checkpointing, num_sanity_val_steps, enable_model_summary, early_stopping, early_stopping_monitor, early_stopping_min_delta, early_stopping_patience, early_stopping_mode, enable_progress_bar, progress_bar_refresh_rate, simple_progress_bar, logger, log_every_n_steps, replace_sampler_ddp, **kwargs)
138 if logger is None:
139 logger = SimpleLogger()
--> 141 super().init(
142 gpus=gpus,
143 benchmark=benchmark,
144 check_val_every_n_epoch=check_val_every_n_epoch,
145 max_epochs=max_epochs,
146 default_root_dir=default_root_dir,
147 enable_checkpointing=enable_checkpointing,
148 num_sanity_val_steps=num_sanity_val_steps,
149 enable_model_summary=enable_model_summary,
150 logger=logger,
151 log_every_n_steps=log_every_n_steps,
152 replace_sampler_ddp=replace_sampler_ddp,
153 enable_progress_bar=enable_progress_bar,
154 **kwargs,
155 )

File ~/miniconda3/envs/envCPA/lib/python3.9/site-packages/pytorch_lightning/utilities/argparse.py:345, in _defaults_from_env_vars..insert_env_defaults(self, *args, **kwargs)
342 kwargs = dict(list(env_variables.items()) + list(kwargs.items()))
344 # all args were already moved to kwargs
--> 345 return fn(self, **kwargs)

TypeError: init() got an unexpected keyword argument 'checkpoint_callback'

Are you able to advise how to solve?

Thanks
Esther

@yanwu2014
Copy link

I'm also seeing this error when I try to run CPA with a CPU, doesn't seem to happen with a GPU

@yanwu2014
Copy link

Ok I think I figured it out: the latest versions of scvi-tools and pytorch-lightning have an updated API which is breaking

I was able to get CPA to run by installing the earliest version of scvi-tools required:
pip3 install scvi-tools==0.16.4

@PierreBoyeau
Copy link

Another working solution for me was to pin python to be 3.10.
It seems like the issue is that the package requires an up-to-date lightning version, which requires python>=3.8

Naghipourfar added a commit that referenced this issue Aug 31, 2023
…ning techniques added

- Mixup added
- Documentation added for most of functions
- Tutorial notebooks for Combo Sci-plex and Norman et al. updated
- FocalLoss added for adversarial training
- More efficient pre-processing algorithm added
- unnecessary methods removed
- GSM notebook removed
- dependencies has been updated
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

No branches or pull requests

4 participants