Mask_RCNN icon indicating copy to clipboard operation
Mask_RCNN copied to clipboard

'ParallelModel' object has no attribute '_base_model_initialized'

Open matt19git opened this issue 2 years ago • 2 comments

Getting this error when trying to run with multiple GPUs on AWS sagemaker. Anybody seen something like this before and know how to proceed?


AttributeError Traceback (most recent call last) /usr/local/lib/python3.9/site-packages/keras/engine/training.py in setattr(self, name, value) 352 try: --> 353 self._base_model_initialized 354 except AttributeError:

~/DigAg/mrcnn/parallel_model.py in getattribute(self, attrname) 38 return getattr(self.inner_model, attrname) ---> 39 return super(ParallelModel, self).getattribute(attrname) 40

AttributeError: 'ParallelModel' object has no attribute '_base_model_initialized'

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last) in 1 # Create model in training mode ----> 2 model = modellib.MaskRCNN(mode="training", config=config, model_dir=DEFAULT_LOGS_DIR)

~/DigAg/mrcnn/model.py in init(self, mode, config, model_dir) 1791 self.model_dir = model_dir 1792 self.set_log_dir() -> 1793 self.keras_model = self.build(mode=mode, config=config) 1794 1795 def build(self, mode, config):

~/DigAg/mrcnn/model.py in build(self, mode, config) 2031 if config.GPU_COUNT > 1: 2032 from mrcnn.parallel_model import ParallelModel -> 2033 model = ParallelModel(model, config.GPU_COUNT) 2034 2035 return model

~/DigAg/mrcnn/parallel_model.py in init(self, keras_model, gpu_count) 26 """ 27 super(ParallelModel, self).init() ---> 28 self.inner_model = keras_model 29 self.gpu_count = gpu_count 30 merged_outputs = self.make_parallel()

/usr/local/lib/python3.9/site-packages/keras/engine/training.py in setattr(self, name, value) 353 self._base_model_initialized 354 except AttributeError: --> 355 raise RuntimeError( 356 "It looks like you are subclassing Model and you " 357 "forgot to call super().__init__()."

RuntimeError: It looks like you are subclassing Model and you forgot to call super().__init__(). Always start with this line.

matt19git avatar Mar 19 '23 19:03 matt19git

The same problem here, did somebody fix it???

emiliosalazardonate avatar Feb 14 '24 14:02 emiliosalazardonate

Was this error ever fixed? Having the same problem

cmc227 avatar Jul 30 '24 20:07 cmc227