Better S4TF for fastai/swiftai setup script for Ubuntu 18.04

(Elias Kunnas) #1

Everything is changing pretty fast for Swift for Tensorflow related tools.
I was struggling to come up with an up to date working environment to run the fastai_dev/course-v3/swiftai notebooks (are they all essentially comes of each other?).
All of the earlier scripts I saw reference older non-nightly versions of Swift for Tensorflow, but those are way too old for the current notebooks.

So after I figured out all of the required bits, I made an idempotent script to set everything up in Ubuntu 18.04 to run the notebooks successfully:

By default this will download the Swift and S4TF related files and repos under ~/swift and use a conda environment called “swiftai”. Those are customizable at the top of the file.

Provided that Visual Studio Code (and npm) are installed, the script will also install sourcekit-lsp support for the Swift Development Environment extension

I will keep maintaining this script until some better way comes along.

Random notes:

  • currently Swift auto-completion in Jupyter notebooks (and the REPL!) is broken and the fix is landing only after Swift 5.1. Upstream bug.
  • some of the notebooks cause mysterious crashes. I hit this LLVM assertion error many times.
  • there’s tons of somewhat out of date documentation by now. I wonder what’s the best way to stay in the loop…
  • To use SwiftCV in the notebooks, source bashrc after running the script. It will export PKG_CONFIG_PATH so that the conda-installed headers are available for the Swift/Jupyter environment. Ubuntu repositories only had OpenCV 3, so this seemed more convenient (SwiftCV requires OpenCV 4).
6 Likes

(Jeremy Howard (Admin)) #2

Best would be to fix the docs! Let us know when you find things that are out of date :slight_smile:

0 Likes

#3

Thank you, it works for me. It’s also work with Python 3.7 on my system Ubuntu 18.04

1 Like