Skip to content

How to re-train or continue training ?!?! #19

Open
@thusinh1969

Description

@thusinh1969

Hi,

Great stuffs really. I walked through your code a lot, but still not sure how to reload weights to continue training should I terminate in the middle for some reasons.

I edited train.py:
...
if "reload_weight_checkpoint" in self.config.keys() and self.config["reload_weight_checkpoint"]!="":
self.model.load_weights(self.config["reload_weight_checkpoint"])
... right before fit.

--> ERROR:

ValueError Traceback (most recent call last)
in
----> 1 history = trainer.train()

D:\AI\Human_Pose\DeepLabV3-Plus\deeplabv3plus\train.py in train(self)
188
189 if "reload_weight_checkpoint" in self.config.keys() and self.config["reload_weight_checkpoint"]!="":
--> 190 self.model.load_weights(self.config["reload_weight_checkpoint"])
191
192 history = self.model.fit(

~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\engine\training.py in load_weights(self, filepath, by_name, skip_mismatch, options)
2220 'load_weights requires h5py when loading weights from HDF5.')
2221 if not self._is_graph_network and not self.built:
-> 2222 raise ValueError(
2223 'Unable to load weights saved in HDF5 format into a subclassed '
2224 'Model which has not created its variables yet. Call the Model '

ValueError: Unable to load weights saved in HDF5 format into a subclassed Model which has not created its variables yet. Call the Model first, then load the weights.

Thanks much.
Steve

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions