gesistsa / grafzahl

🧛 fine-tuning Transformers for text data from within R
https://gesistsa.github.io/grafzahl/
GNU General Public License v3.0
41 stars 2 forks source link

Make it work on Colab #18

Closed chainsawriot closed 5 months ago

chainsawriot commented 1 year ago

The idea probably would be: Make grafzahl usable with non-Conda Python, e.g. the Python provided by Colab. As of writing, that's 3.8.

Install all the Python dependencies: pandas, emoji, tqdm, simpletransformers

chainsawriot commented 5 months ago

Initial experiment suggests this is possible with Colab's R runtime.

system("python3 -m pip install simpletransformers", intern = TRUE)
install.packages("reticulate")
writeLines("import torch\ndef py_detect_cuda():\n    return(torch.cuda.is_available())", "cuda2.py")
reticulate::source_python("cuda2.py")
py_detect_cuda()
chainsawriot commented 5 months ago

Initial idea is to rewrite this:

https://github.com/chainsawriot/grafzahl/blob/d0e91b24ba2402d214b9a65bcc628e68a20e37b8/R/setup.R#L54-L70

chainsawriot commented 5 months ago