2

I have created an image classification model using pre-trained model inceptionV3. After I trained the model on my dataset I saved the model using joblib. When trying to load the model Im getting error "Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram://1ea4479d-6a25-4562-965a-428f7eb33342/variables/variables You may be trying to load on a different device from the computational device. Consider setting the experimental_io_device option in tf.saved_model.LoadOptions to the io_device such as '/job:localhost'." Any idea why is this message appearing or is it because you cant use joblib to save a model made from pre-trained model. Below is the code and the error

import joblib
joblib.dump(inceptionv3_model, 'inceptV3_model.pkl')
model_inceptionv3 = joblib.load('inceptV3_model.pkl')

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-14-8ed26b03fd7d> in <module>
      1 # loading the model
----> 2 model_inceptionv3 = joblib.load('C:/Users/Indranil/inceptV3_model.pkl')

~\anaconda3\lib\site-packages\joblib\numpy_pickle.py in load(filename, mmap_mode)
    583                     return load_compatibility(fobj)
    584 
--> 585                 obj = _unpickle(fobj, filename, mmap_mode)
    586     return obj

~\anaconda3\lib\site-packages\joblib\numpy_pickle.py in _unpickle(fobj, filename, mmap_mode)
    502     obj = None
    503     try:
--> 504         obj = unpickler.load()
    505         if unpickler.compat_mode:
    506             warnings.warn("The file '%s' has been generated with a "

~\anaconda3\lib\pickle.py in load(self)
   1208                     raise EOFError
   1209                 assert isinstance(key, bytes_types)
-> 1210                 dispatch[key[0]](self)
   1211         except _Stop as stopinst:
   1212             return stopinst.value

~\anaconda3\lib\pickle.py in load_reduce(self)
   1585         args = stack.pop()
   1586         func = stack[-1]
-> 1587         stack[-1] = func(*args)
   1588     dispatch[REDUCE[0]] = load_reduce
   1589 

~\anaconda3\lib\site-packages\keras\saving\pickle_utils.py in deserialize_model_from_bytecode(serialized_model)
     46         with tf.io.gfile.GFile(dest_path, "wb") as f:
     47           f.write(archive.extractfile(name).read())
---> 48   model = save_module.load_model(temp_dir)
     49   tf.io.gfile.rmtree(temp_dir)
     50   return model

~\anaconda3\lib\site-packages\keras\utils\traceback_utils.py in error_handler(*args, **kwargs)
     65     except Exception as e:  # pylint: disable=broad-except
     66       filtered_tb = _process_traceback_frames(e.__traceback__)
---> 67       raise e.with_traceback(filtered_tb) from None
     68     finally:
     69       del filtered_tb

~\anaconda3\lib\site-packages\tensorflow\python\saved_model\load.py in load_internal(export_dir, tags, options, loader_cls, filters)
    975                             ckpt_options, options, filters)
    976       except errors.NotFoundError as err:
--> 977         raise FileNotFoundError(
    978             str(err) + "\n You may be trying to load on a different device "
    979             "from the computational device. Consider setting the "

FileNotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram://1ea4479d-6a25-4562-965a-428f7eb33342/variables/variables
 You may be trying to load on a different device from the computational device. Consider setting the `experimental_io_device` option in `tf.saved_model.LoadOptions` to the io_device such as '/job:localhost'.
Progman
  • 16,827
  • 6
  • 33
  • 48
Indranil
  • 31
  • 6
  • Are you using different version [version change error](https://stackoverflow.com/a/48988121/18383672) of joblib to dump and load – Vignesh May 01 '22 at 09:28
  • Not sure about that. I'm just importing joblib library and following steps to save and load – Indranil May 01 '22 at 10:46

0 Answers0