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
ability to read from Google Drive when running in Colab #100
Comments
Throwing some ideas out there, but an approach similar to using Kaggle might be worth looking into (API token as JSON file). If users can't load the token via an interactive widget, they can use environment variables to specify its path, and then proceed to download their datasets. If this works, it could be an alternative. For Google Drive, maybe a method from OAuth2 can be used. Would it be reasonable to: run a cell, browser tab opens, credentials are entered, copy token and paste it back to the cell? Another way (seems kinda hacky) is to use cookiestxt (https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg), by storing the authenticated session in your browser, uploading it to the Colab session, and loading the cookies when retrieving the files from Drive. Edit: Seems like even if any of these methods work, you'll still need to have a window of your drive contents open and probably can't write to the drive. Maybe getting PyDrive or something similar to work is a better idea. |
Have you tried using the method outlined by Conwyn here: https://forums.fast.ai/t/python-textfield-output-not-working/51000/12 |
Thanks for the ideas! There were some questions on the swift@tensorflow.org mailing list about how to do this, so I just sent an email to the list letting everyone know that there are some new ideas here :) |
I solved this problem! The solution was to allow Swift-Colab to switch between Swift mode and Python mode. In Python mode, execute the code that mounts Google Drive and uses an interactive text widget. Then, switch to Swift mode and restart the runtime. I was able to call At the time of making this comment, my solution hasn't been implemented into upstream Swift-Colab yet. It will be possible by the 2.0 release, though. |
It would be nice to read from Google Drive when running Swift in Colab.
You can do this in Python Colab: https://colab.research.google.com/notebooks/io.ipynb. So the obvious thing to try is to use Swift's Python interop to
Python.import
the necessary libraries. Unfortunately, this does not work because the Python library prompts the user for an authentication key with an interactive text widget, and the Swift Python interop does not support interactive widgets.So the right solution may be to modify the Python library so that you can pass it the authentication key directly instead of needing to paste it into a text widget. See here for a bit more detail about how it might be done: https://forums.fast.ai/t/python-textfield-output-not-working/51000/5?u=marcrasi
The text was updated successfully, but these errors were encountered: