cistrome / MIRA

Python package for analysis of multiomic single cell RNA-seq and ATAC-seq.
52 stars 7 forks source link

Topic model fails with single job #46

Open samzarr opened 3 weeks ago

samzarr commented 3 weeks ago

When training the topic model with a single job I encountered the following error:

File [~/miniconda3/envs/mira-env/lib/python3.10/site-packages/mira/topic_model/hyperparameter_optim/trainer.py:818], in BayesianTuner.fit(self, train, test)
[808] if self.n_jobs > 1:
[809]     with joblib_print_callback(self):
[810]         Parallel(n_jobs= self.n_jobs, verbose = 0)\
[811]             (delayed(_tune_step)(trial_parameters, study=self.study, callback_fn=self.get_stop_callback()) 
[812]             for _ in delay_range(remaining_trials)
[813]             )
[814]                            
[815]     else: # manually print if only using one job.
[816]         for i in delay_range(remaining_trials):
[817]                            
->  [818]        self._tune_step(trial_parameters)

AttributeError: 'BayesianTuner' object has no attribute '_tune_step'

The definition for _tune_step appears to be outside the scope of BayesianTuner. I managed to train the model by changing line 818 to: _tune_step(trial_parameters, study=self.study, callback_fn=self.get_stop_callback())

Is this a reasonable change to make? Thanks.