Not able to save model to gs bucket using torch.save()
I am trying to save a PyTorch model to my google cloud bucket but it is always showing a &quot;FileNotFoundError error&quot;.
I already have a gs bucket and the file path I am providing is also correct. My code is running on a GCP notebook instance.
path = &quot;gs://bucket_name/model/model.pt&quot;
torch.save(model,path)

It would really help me if someone tries to upload a model to gs bucket and let me know if you could or not? It would also help me if you shared the right way to put models into gs bucket using torch.save().

try this:
import gcsfs
fs = gcsfs.GCSFileSystem(project = '&lt;enter your gc project&gt;')
with fs.open(&quot;gs://bucket_name/&quot;+f'model/model.pt', 'wb') as f:
    torch.save(model, f)


