Spaces:
Starting
on
L40S
Starting
on
L40S
File size: 1,978 Bytes
d7e58f0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
#!/usr/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# This script is for running some of the tutorials using the nightly build in
# an isolated environment. It is designed to be run in docker.
# If you run this script in this directory with
# sudo docker run --runtime=nvidia -it --rm -v $PWD/../docs/tutorials:/notebooks -v $PWD:/loc pytorch/conda-cuda bash /loc/run_tutorials.sh | tee log.txt
# it should execute some tutorials with the nightly build and resave them, and
# save a log in the current directory.
# We use nbconvert. runipy would be an alternative but it currently doesn't
# work well with plotly.
set -e
conda init bash
# shellcheck source=/dev/null
source ~/.bashrc
conda create -y -n myenv python=3.8 matplotlib ipython ipywidgets nbconvert
conda activate myenv
conda install -y -c fvcore -c iopath -c conda-forge fvcore iopath
conda install -y -c pytorch pytorch=1.6.0 cudatoolkit=10.1 torchvision
conda install -y -c pytorch3d-nightly pytorch3d
pip install plotly scikit-image
for notebook in /notebooks/*.ipynb
do
name=$(basename "$notebook")
if [[ "$name" == "dataloaders_ShapeNetCore_R2N2.ipynb" ]]
then
#skip as data not easily available
continue
fi
if [[ "$name" == "render_densepose.ipynb" ]]
then
#skip as data not easily available
continue
fi
#comment the lines which install torch, torchvision and pytorch3d
sed -Ei '/(torchvision)|(pytorch3d)/ s/!pip/!#pip/' "$notebook"
#Don't let tqdm use widgets
sed -i 's/from tqdm.notebook import tqdm/from tqdm import tqdm/' "$notebook"
echo
echo "### ### ###"
echo "starting $name"
time jupyter nbconvert --to notebook --inplace --ExecutePreprocessor.kernel_name=python3 --execute "$notebook" || true
echo "ending $name"
done
|