Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copying file from gdrive not working in colab #226

Open
nameofname opened this issue Aug 6, 2020 · 1 comment · Fixed by leetfin/gpt-2-simple#1
Open

Copying file from gdrive not working in colab #226

nameofname opened this issue Aug 6, 2020 · 1 comment · Fixed by leetfin/gpt-2-simple#1

Comments

@nameofname
Copy link

Hi all - amazing repo - small issue: I can't supply a file path outside of the root directory in my gdrive to copy_file_from_gdrive

Code is here :
https://github.com/minimaxir/gpt-2-simple/blob/master/gpt_2_simple/gpt_2.py#L618

file_name = "/content/drive/My Drive/training_data/single_sentence.txt"

ff = open(file_name)
print(ff.read())

gpt2.copy_file_from_gdrive(file_name)

Error message :

my content: Amrozi accused his brother, whom he called "the witness", of deliberately distorting his evidence. >>>> Referring to him as only "the witness", Amrozi accused his brother of deliberately distorting his evidence.

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-20-d97f2d19870d> in <module>()
      5 print('my content: ' + ff.read())
      6 
----> 7 gpt2.copy_file_from_gdrive(file_name)
      8 # gpt2.copy
      9 

1 frames
/usr/lib/python3.6/shutil.py in copyfile(src, dst, follow_symlinks)
    118         os.symlink(os.readlink(src), dst)
    119     else:
--> 120         with open(src, 'rb') as fsrc:
    121             with open(dst, 'wb') as fdst:
    122                 copyfileobj(fsrc, fdst)

FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/My Drive//content/drive/My Drive/training_data/single_sentence.txt'
@nameofname
Copy link
Author

I should also say that if I provide a path relative to /content/drive/My Drive/ it still doesn't work, ie. "training_data/some_file.txt"

I created a PR for this :
#227

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant