[core] AttributeError: Can't get attribute 'CheckpointConfig' on <module 'opt.config.utils' from '/home/ray/anaconda3/lib/python3.9/site-packages/opt/config/utils.py'> #48246
File /var/www/optimization-library/opt/tuners/compredict_tuner.py:513, in CompredictTuner._refit_with_ray(self, train_data, val_data)
511 trainer._param_dict['scaling_config'] = trainer.scaling_config
512 print("trainer.scaling_config ", trainer.scaling_config)
--> 513 trainer.fit()
515 # load best weights
516 model = self.trainable.build_model(config, self.input_shape, self.target_shape)
File /usr/local/lib/python3.9/site-packages/ray/train/base_trainer.py:583, in BaseTrainer.fit(self)
580 from ray.tune.tuner import Tuner, TunerInternal
581 from ray.tune import TuneError
--> 583 trainable = self.as_trainable()
584 param_space = self._extract_fields_for_tuner_param_space()
586 if self._restore_path:
File /usr/local/lib/python3.9/site-packages/ray/train/base_trainer.py:837, in BaseTrainer.as_trainable(self)
834 trainable_cls = self._generate_trainable_cls()
836 # Wrap with tune.with_parameters to handle very large values in base_config
--> 837 return tune.with_parameters(trainable_cls, **base_config)
File /usr/local/lib/python3.9/site-packages/ray/tune/trainable/util.py:293, in withparameters(trainable, **kwargs)
291 prefix = f"{str(trainable)}"
292 for k, v in kwargs.items():
--> 293 parameter_registry.put(prefix + k, v)
295 trainable_name = getattr(trainable, "name", "tune_with_parameters")
296 keys = set(kwargs.keys())
File /usr/local/lib/python3.9/site-packages/ray/tune/registry.py:296, in _ParameterRegistry.put(self, k, v)
294 self.to_flush[k] = v
295 if ray.is_initialized():
--> 296 self.flush()
File /usr/local/lib/python3.9/site-packages/ray/tune/registry.py:308, in _ParameterRegistry.flush(self)
306 self.references[k] = v
307 else:
--> 308 self.references[k] = ray.put(v)
309 self.to_flush.clear()
File /usr/local/lib/python3.9/site-packages/ray/_private/client_mode_hook.py:102, in client_mode_hook..wrapper(*args, kwargs)
98 if client_mode_should_convert():
99 # Legacy code
100 # we only convert init function if RAY_CLIENT_MODE=1
101 if func.name != "init" or is_client_mode_enabled_by_default:
--> 102 return getattr(ray, func.name)(*args, *kwargs)
103 return func(args, kwargs)
File /usr/local/lib/python3.9/site-packages/ray/util/client/api.py:52, in _ClientAPI.put(self, *args, kwargs)
44 def put(self, *args, *kwargs):
45 """put is the hook stub passed on to replace ray.put
46
47 Args:
(...)
50 kwargs: opaque keyword arguments
51 """
---> 52 return self.worker.put(args, kwargs)
File /usr/local/lib/python3.9/site-packages/ray/util/client/worker.py:496, in Worker.put(self, val, client_ref_id, _owner)
488 raise TypeError(
489 "Calling 'put' on an ObjectRef is not allowed "
490 "(similarly, returning an ObjectRef from a remote "
(...)
493 "call 'put' on it (or return it)."
494 )
495 data = dumps_from_client(val, self._client_id)
--> 496 return self._put_pickled(data, client_ref_id, _owner)
File /usr/local/lib/python3.9/site-packages/ray/util/client/worker.py:510, in Worker._put_pickled(self, data, client_ref_id, owner)
508 if not resp.valid:
509 try:
--> 510 raise cloudpickle.loads(resp.error)
511 except (pickle.UnpicklingError, TypeError):
512 logger.exception("Failed to deserialize {}".format(resp.error))
AttributeError: Can't get attribute 'CheckpointConfig' on <module 'opt.config.utils' from '/home/ray/anaconda3/lib/python3.9/site-packages/opt/config/utils.py'>
What happened + What you expected to happen
I am doing simple training using ray, but somehow it cannot get CheckPointConfig attribut.
AttributeError Traceback (most recent call last) Cell In[14], line 1 ----> 1 model_ray = self._refit_with_ray(train_data_init, val_data_init) 2 # model_direct = self._refit(train_data_init, val_data_init)
File /var/www/optimization-library/opt/tuners/compredict_tuner.py:513, in CompredictTuner._refit_with_ray(self, train_data, val_data) 511 trainer._param_dict['scaling_config'] = trainer.scaling_config 512 print("trainer.scaling_config ", trainer.scaling_config) --> 513 trainer.fit() 515 # load best weights 516 model = self.trainable.build_model(config, self.input_shape, self.target_shape)
File /usr/local/lib/python3.9/site-packages/ray/train/base_trainer.py:583, in BaseTrainer.fit(self) 580 from ray.tune.tuner import Tuner, TunerInternal 581 from ray.tune import TuneError --> 583 trainable = self.as_trainable() 584 param_space = self._extract_fields_for_tuner_param_space() 586 if self._restore_path:
File /usr/local/lib/python3.9/site-packages/ray/train/base_trainer.py:837, in BaseTrainer.as_trainable(self) 834 trainable_cls = self._generate_trainable_cls() 836 # Wrap with
tune.with_parameters
to handle very large values in base_config --> 837 return tune.with_parameters(trainable_cls, **base_config)File /usr/local/lib/python3.9/site-packages/ray/tune/trainable/util.py:293, in withparameters(trainable, **kwargs) 291 prefix = f"{str(trainable)}" 292 for k, v in kwargs.items(): --> 293 parameter_registry.put(prefix + k, v) 295 trainable_name = getattr(trainable, "name", "tune_with_parameters") 296 keys = set(kwargs.keys())
File /usr/local/lib/python3.9/site-packages/ray/tune/registry.py:296, in _ParameterRegistry.put(self, k, v) 294 self.to_flush[k] = v 295 if ray.is_initialized(): --> 296 self.flush()
File /usr/local/lib/python3.9/site-packages/ray/tune/registry.py:308, in _ParameterRegistry.flush(self) 306 self.references[k] = v 307 else: --> 308 self.references[k] = ray.put(v) 309 self.to_flush.clear()
File /usr/local/lib/python3.9/site-packages/ray/_private/auto_init_hook.py:24, in wrap_auto_init..auto_init_wrapper(*args, kwargs)
21 @wraps(fn)
22 def auto_init_wrapper(*args, *kwargs):
23 auto_init_ray()
---> 24 return fn(args, kwargs)
File /usr/local/lib/python3.9/site-packages/ray/_private/client_mode_hook.py:102, in client_mode_hook..wrapper(*args, kwargs)
98 if client_mode_should_convert():
99 # Legacy code
100 # we only convert init function if RAY_CLIENT_MODE=1
101 if func.name != "init" or is_client_mode_enabled_by_default:
--> 102 return getattr(ray, func.name)(*args, *kwargs)
103 return func(args, kwargs)
File /usr/local/lib/python3.9/site-packages/ray/util/client/api.py:52, in _ClientAPI.put(self, *args, kwargs) 44 def put(self, *args, *kwargs): 45 """put is the hook stub passed on to replace
ray.put
46 47 Args: (...) 50 kwargs: opaque keyword arguments 51 """ ---> 52 return self.worker.put(args, kwargs)File /usr/local/lib/python3.9/site-packages/ray/util/client/worker.py:496, in Worker.put(self, val, client_ref_id, _owner) 488 raise TypeError( 489 "Calling 'put' on an ObjectRef is not allowed " 490 "(similarly, returning an ObjectRef from a remote " (...) 493 "call 'put' on it (or return it)." 494 ) 495 data = dumps_from_client(val, self._client_id) --> 496 return self._put_pickled(data, client_ref_id, _owner)
File /usr/local/lib/python3.9/site-packages/ray/util/client/worker.py:510, in Worker._put_pickled(self, data, client_ref_id, owner) 508 if not resp.valid: 509 try: --> 510 raise cloudpickle.loads(resp.error) 511 except (pickle.UnpicklingError, TypeError): 512 logger.exception("Failed to deserialize {}".format(resp.error))
AttributeError: Can't get attribute 'CheckpointConfig' on <module 'opt.config.utils' from '/home/ray/anaconda3/lib/python3.9/site-packages/opt/config/utils.py'>
Versions / Dependencies
Ray: 2.6.3 Python: 3.9.15
Reproduction script
model_ray = self._refit_with_ray(train_data_init, val_data_init)
With:
Issue Severity
High: It blocks me from completing my task.