question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot save trained model after loading it AttributeError: 'list' object has no attribute 'tolist'

See original GitHub issue

Hello,

I wanted to train model a bit more after some epochs. I had it saved and I loaded it and then I performed training. Loss function started to becoming smaller from the point where the previous model was saved, but after training it was not possible to save this newly trained model again.

Here’s a listing with error:

Traceback (most recent call last):
  File ".../Programming/keras-retinanet-master/examples/train_csv.py", line 125, in <module>
    model.save(os.path.join('snapshots', 'resnet50_csv_final.h5'))
  File ".../MasterEnv/lib/python3.6/site-packages/keras/engine/topology.py", line 2556, in save
    save_model(self, filepath, overwrite, include_optimizer)
  File ".../MasterEnv/lib/python3.6/site-packages/keras/models.py", line 107, in save_model
    'config': model.get_config()
  File ".../MasterEnv/lib/python3.6/site-packages/keras/engine/topology.py", line 2329, in get_config
    layer_config = layer.get_config()
  File ".../Programming/keras-retinanet-master/keras_retinanet/layers/_misc.py", line 66, in get_config
    'ratios' : self.ratios.tolist(),
AttributeError: 'list' object has no attribute 'tolist'

I was following the script train_csv.py I checked alread if saving to other file will fix it and setting override attribute to True is not resolving it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
WernherVonDatacommented, Dec 3, 2017

Everything is working now - sorry for late comment - I didn’t have an opportunity to verify this issue 😃 And thanks for fix

0reactions
de-vri-escommented, Dec 3, 2017

Good to hear, thanks for reporting back 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'list' object has no attribute 'tolist' - Stack Overflow
I did a workaround using numpy. import face_recognition import os import json import numpy as np encodearr=[] for i in range(0, ...
Read more >
'list' object has no attribute 'values' when we are using append ...
It is basically what the error message says. The problem is this: y =y.values().astype(int). y is a list and lists do not have...
Read more >
attributeerror: 'list' object has no attribute 'patches' - You.com
The Python AttributeError: 'list' object has no attribute occurs when we access an attribute that doesn't exist on a list. To solve the...
Read more >
How to Save and Load Your Keras Deep Learning Model
You learned how to save your trained models to files, later load them ... “AttributeError: 'KerasClassifier' object has no attribute 'save'”.
Read more >
series object has no attribute columns
Series Object Has No Attribute ColumnsValues exactly lists series object has no attribute 'tolist on characters that appear in the Series is of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found