ioam / topographica

A general-purpose neural simulator focusing on topographic maps.
topographica.org
BSD 3-Clause "New" or "Revised" License
53 stars 32 forks source link

AttributeError: 'module' object has no attribute 'maximum' #694

Open dancehours opened 5 years ago

dancehours commented 5 years ago

Hi, I get a error from running topographica jobs,

Traceback (most recent call last): File "/scratch01/env_c/topographica_pbc/pbc_measurement.py", line 90, in load_snapshot(path+fname+'/'+snapshot_name) File "/scratch01/env_c/topographica_pbc/topo/command/init.py", line 325, in load_snapshot pickle.load(snapshot) AttributeError: 'module' object has no attribute 'maximum'

Before it worked well, suddenly this error appears, I have no idea how to solve it.

jbednar commented 5 years ago

This error seems to indicate that when you saved the snapshot last time, some code of yours previously defined an attribute named maximum, but that attribute is no longer defined in your code so that pickle is failing when it tries to restore that attribute. If maximum isn't important, you can probably put in a dummy declaration for it so that the pickle loading no longer fails, but there may be other changes needed.

dancehours commented 5 years ago

Actually I didnt define maximum in my code.I am not sure where it comes from.

dancehours commented 5 years ago

Hi, I would need to make a diagram of the gcal model. I found I can referred to the model view showed in the second image from this link http://ioam.github.io/topographica/Tutorials/gcal.html. I have a difficulty on making the off LGN's dark center bright boundary 's effect. I would like to ask, which software do you use to make that image ? Sorry for this details and technique question.

dancehours commented 5 years ago

This is the right link. https://ioam.github.io/topographica/Tutorials/gcal.html

jbednar commented 5 years ago

That's a screenshot from the Tk gui's model editor.

dancehours commented 2 years ago

This error seems to indicate that when you saved the snapshot last time, some code of yours previously defined an attribute named maximum, but that attribute is no longer defined in your code so that pickle is failing when it tries to restore that attribute. If maximum isn't important, you can probably put in a dummy declaration for it so that the pickle loading no longer fails, but there may be other changes needed.

Hi Bednar, I am not sure how to define a dummy declaration in the definition of load_snapshot properly, could you show me this ?

dancehours commented 2 years ago

Hi Bednar, I am sorry I ask the very old question now. I am stuck with this problem in my project and really need to solve it soon. Could you please give me some suggestions ?

jbednar commented 2 years ago

Sorry; it's very difficult to debug that without the running session and all your files. A message like that usually indicates that the python code you are running does not match the code that you had when you saved the pickle. At the time of the pickle, there was a module with an object 'maximum' defined, but now there isn't such an object declared in that module, so when pickle tries to restore its state, it fails. From the message I can't tell what module that might be, but if you can figure out which one it is, load the __init__.py file from it into an editor, and add a dummy declaration like class maximum(object): pass. Then maybe loading that pickle will succeed. I can't theorize why maximum would have disappeared from your source tree; maybe it's simply that you're using a different Topographica version or some other different files of your own. Sorry I can't be more help than that; Pickle files very often don't give useful error messages!