简体   繁体   中英

Save gensim doc2vec model in google drive

I want to save my Gensim doc2vec model into my notebooks folder which is in my google drive but when I run the model.save('doc2vec_model') method it is saving the model somewhere else.

  fname = get_tmpfile(f"doc2vec_{sub}_model_without_tuning")
  model.save(fname)

The model is stored the /tmp folder. tmp folder of my drive. please help me to save my model inside my drive/notebooks folder

If you use the Gensim utility function get_tmpfile() , you are asking the library to give you a file-path inside whatever directory is customarily used for temporary files. So, it's doing what you've asked.

The .save() method will take whatever path you provide, as a plain string, so if the place you want to save the model is available as a local file path, just use that path.

(Keep in mind that for most models of usual size, the .save() operation will write multiple related files, which kust be kept together to re-load properly.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM