Repository navigation
get error when try to load a .pkl #215
Description
Activity
the error message complete:
FileNotFoundError Traceback (most recent call last)
File c:\users\tyofo\appdata\local\programs\python\python39\lib\site-packages\pygad\pygad.py:2213, in load(filename)
2212 with open(filename + ".pkl", 'rb') as file:
-> 2213 ga_in = cloudpickle.load(file)
2214 except FileNotFoundError:File c:\users\tyofo\appdata\local\programs\python\python39\lib\site-packages\keras\saving\pickle_utils.py:47, in deserialize_model_from_bytecode(serialized_model)
46 f.write(archive.extractfile(name).read())
---> 47 model = save_module.load_model(temp_dir)
48 tf.io.gfile.rmtree(temp_dir)File c:\users\tyofo\appdata\local\programs\python\python39\lib\site-packages\keras\utils\traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
68 # To get the full stack trace, call:
69 #tf.debugging.disable_traceback_filtering()
---> 70 raise e.with_traceback(filtered_tb) from None
71 finally:File c:\users\tyofo\appdata\local\programs\python\python39\lib\site-packages\tensorflow\python\saved_model\load.py:933, in load_partial(export_dir, filters, tags, options)
932 except errors.NotFoundError as err:
--> 933 raise FileNotFoundError(
934 str(err) + "\n You may be trying to load on a different device "
935 "from the computational device. Consider setting the "
936 "experimental_io_deviceoption intf.saved_model.LoadOptions"
937 "to the io_device such as '/job:localhost'.")
938 root = loader.get(0)FileNotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram://e787696c-9043-4614-8a19-b5a25761d5fc/variables/variables
You may be trying to load on a different device from the computational device. Consider setting theexperimental_io_deviceoption intf.saved_model.LoadOptionsto the io_device such as '/job:localhost'.During handling of the above exception, another exception occurred:
FileNotFoundError Traceback (most recent call last)
Cell In[20], line 1
----> 1 loaded_ga_instance = pygad.load(filename="midas")File c:\users\tyofo\appdata\local\programs\python\python39\lib\site-packages\pygad\pygad.py:2215, in load(filename)
2213 ga_in = cloudpickle.load(file)
2214 except FileNotFoundError:
-> 2215 raise FileNotFoundError("Error reading the file {filename}. Please check your inputs.".format(filename=filename))
2216 except:
2217 # raise BaseException("Error loading the file. If the file already exists, please reload all the functions previously used (e.g. fitness function).")
2218 raise BaseException("Error loading the file.")FileNotFoundError: Error reading the file midas. Please check your inputs.
Can you share a working code to try? I doubt the issue is due to
SavedModel, not pickling the PyGAD instance.
i can't load my work for my project this very annoying, and i not understand clearly the error
when i have finish to execute : ga_instance.run()
i save the work with : ga_instance.save("midas")
i get a warnings:
WARNING:tensorflow:Compiled the loaded model, but the compiled metrics have yet to be built.
model.compile_metricswill be empty until you train or evaluate the model.INFO:tensorflow:Assets written to: ram://5541c4a9-5e22-4f3e-a6cc-dca25eaf7fed/assets
WARNING:tensorflow:Compiled the loaded model, but the compiled metrics have yet to be built.
model.compile_metricswill be empty until you train or evaluate the model.INFO:tensorflow:Assets written to: ram://d206d322-d2d8-4a59-912f-15c31ea96a03/assets
i execute: loaded_ga_instance = pygad.load(filename="midas")
i got this error:
FileNotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram://e787696c-9043-4614-8a19-b5a25761d5fc/variables/variables
You may be trying to load on a different device from the computational device. Consider setting the
experimental_io_deviceoption intf.saved_model.LoadOptionsto the io_device such as '/job:localhost'.During handling of the above exception, another exception occurred:
FileNotFoundError: Error reading the file midas. Please check your inputs.
how i resolve this error please ??