IsADirectoryError: [Errno 21] Is a directory

The data already readed ,any help

from google.colab import drive
drive.mount('/content/drive')
!unzip  "/content/drive/MyDrive/NADI2021_DEV.1.0.zip"


data_path = 'Data/'
models_path = 'Models/'
if not os.path.exists(data_path):    
    os.makedirs(data_path)
if not os.path.exists(models_path):    
    os.makedirs(models_path)

.
.
.
.
.
.
.

# load model
embed_epoch = 1
model_embed = load_model(model_embed,embed_epoch,'embed')
model_embed.to(device)
Loading model from Models/saved_embed_epoch1.txt
---------------------------------------------------------------------------
IsADirectoryError                         Traceback (most recent call last)
<ipython-input-145-da43c88e687e> in <module>()
      1 # load model
      2 embed_epoch = 1
----> 3 model_embed = load_model(model_embed,embed_epoch,'embed')
      4 model_embed.to(device)
      5 # load model

3 frames
/usr/local/lib/python3.6/dist-packages/torch/serialization.py in __init__(self, name, mode)
    209 class _open_file(_opener):
    210     def __init__(self, name, mode):
--> 211         super(_open_file, self).__init__(open(name, mode))
    212 
    213     def __exit__(self, *args):

IsADirectoryError: [Errno 21] Is a directory: 'Models/'

The error is raised, since you are passing a path to a directory instead of a model checkpoint.
Make sure to pass the path to the file instead of the dir.

3 Likes