Question: Can someone help me with this error --------------------------------------------------------------------------- ValueError Traceback (most recent call last) in () ----> 1 data = hdf . get ( 'model_weights'
Can someone help me with this error

--------------------------------------------------------------------------- ValueError Traceback (most recent call last)in () ----> 1 data = hdf.get('model_weights') 2 #dataset = np.array(data) 3 #print ('Shape of dataset: ', dataset.shape) C:\ProgramData\Anaconda3\lib\site-packages\h5py\_hl\group.py in get(self, name, default, getclass, getlink) 206 if not (getclass or getlink): 207 try: --> 208 return self[name] 209 except KeyError: 210 return default h5py\_objects.pyx in h5py._objects.with_phil.wrapper() h5py\_objects.pyx in h5py._objects.with_phil.wrapper() C:\ProgramData\Anaconda3\lib\site-packages\h5py\_hl\group.py in __getitem__(self, name) 165 raise ValueError("Invalid HDF5 object reference") 166 else: --> 167 oid = h5o.open(self.id, self._e(name), lapl=self._lapl) 168 169 otype = h5i.get_type(oid) h5py\_objects.pyx in h5py._objects.with_phil.wrapper() h5py\_objects.pyx in h5py._objects.with_phil.wrapper() h5py\h5o.pyx in h5py.h5o.open() ValueError: Not a location (invalid object ID)
--------------------------------------------------------------------------- ValueError Traceback (most recent call last)in () ----> 1 data = hdf.get('model_weights') 2 #dataset = np.array(data) 3 #print ('Shape of dataset: ', dataset.shape) C:\ProgramData\Anaconda3\lib\site-packages\h5py\_hl\group.py in get(self, name, default, getclass, getlink) 206 if not (getclass or getlink): 207 try: --> 208 return self[name] 209 except KeyError: 210 return default h5py\_objects.pyx in h5py._objects.with_phil.wrapper() h5py\_objects.pyx in h5py._objects.with_phil.wrapper() C:\ProgramData\Anaconda3\lib\site-packages\h5py\_hl\group.py in __getitem__(self, name) 165 raise ValueError("Invalid HDF5 object reference") 166 else: --> 167 oid = h5o.open(self.id, self._e(name), lapl=self._lapl) 168 169 otype = h5i.get_type(oid) h5py\_objects.pyx in h5py._objects.with_phil.wrapper() h5py\_objects.pyx in h5py._objects.with_phil.wrapper() h5py\h5o.pyx in h5py.h5o.open() ValueError: Not a location (invalid object ID)
1 import numpy as np 2 import h5py 3 4 filename - "yolo.hs" h5 = h5py. File(filename,'r') 7 8 h5.close() In [3] 1 import numpy as np 2 import h5py 3 4 with h5py.File( 'yolo.h5', 'r) as hdf: ls = list (hdf , keys()) print(' List of datasets in this file : ", ls) List of datasets in this file: I'model_weights'] In [9]: 1 data=hdf.get('model-weights') 2 #dataset = np.array(data) 3| #print ("Shape of dataset: ", dataset.shape)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
