File size: 4,042 Bytes
9c4b01e |
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
#!/bin/bash
# Detect the operating system
OS=$(uname -s)
# Function to install dependencies on Linux
install_linux() {
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
CFLAGS="-stdlib=libc++" CXXFLAGS="-stdlib=libc++"
apt update
apt install wget -y
apt install clang -y
apt install libc++-dev -y
apt install cmake -y
apt-get update && apt-get install -y \
build-essential \
cmake \
libopenblas-dev \
liblapack-dev \
libx11-dev \
libgtk-3-dev \
libboost-python-dev \
libjpeg \
libpng \
libjpeg8-dev \
libpng-dev \
libtiff5-dev \
libtiff-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libdc1394-22-dev \
libxine2-dev \
libavfilter-dev \
libavutil-dev \
libnvcuvid-dev \
software-properties-common \
build-essential \
checkinstall \
cmake \
make \
pkg-config \
yasm \
git \
vim \
curl \
wget \
sudo \
apt-transport-https \
libcanberra-gtk-module \
libcanberra-gtk3-module \
dbus-x11 \
iputils-ping \
python3-dev \
python3-pip \
python3-setuptools \
&& rm -rf /var/lib/apt/lists/*
apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0
apt-get -y update && apt-get install -y ffmpeg
export NVIDIA_DRIVER_CAPABILITIES=all
ln -s /usr/lib/x86_64-linux-gnu/libnvcuvid.so.1 /usr/local/cuda/lib64/libnvcuvid.so
git clone --recursive https://github.com/dmlc/decord
cd decord && mkdir build && cd build && cmake .. -DUSE_CUDA=ON -DCMAKE_BUILD_TYPE=Release && make -j2 && cd ../python && python3 setup.py install
# Install ffmpeg if necessary
# add-apt-repository ppa:jonathonf/ffmpeg-4
# apt-get update
# apt-get install -y ffmpeg libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev
}
# Function to install dependencies on macOS
install_macos() {
echo "Running on macOS"
# Install Homebrew if not installed
if ! command -v brew &> /dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
xcode-select --install
softwareupdate --all --install --force
export CC=/usr/bin/clang >> ~/.bash_profile
export CXX=/usr/bin/clang >> ~/.bash_profile
brew update
brew install wget
brew install clang
brew install cmake
brew install ffmpeg
brew install libomp
# Additional dependencies for macOS
brew install openblas lapack gtk+3 boost-python3 jpeg libpng
}
# Function to install dependencies on Windows
install_windows() {
echo "Running on Windows"
# Installation steps for Windows could involve using Chocolatey or other package managers
choco install wget
choco install llvm
choco install cmake
choco install ffmpeg
}
# Download models function
# download_models() {
# ED_MODEL_URL="https://huggingface.co/Deressa/GenConViT/resolve/main/genconvit_ed_inference.pth"
# VAE_MODEL_URL="https://huggingface.co/Deressa/GenConViT/resolve/main/genconvit_vae_inference.pth"
# ED_MODEL_PATH="./pretrained_models/genconvit_ed_inference.pth"
# VAE_MODEL_PATH="./pretrained_models/genconvit_vae_inference.pth"
# mkdir -p pretrained_models
# if [ ! -f "$ED_MODEL_PATH" ]; then
# wget -P ./pretrained_models "$ED_MODEL_URL"
# fi
# if [ ! -f "$VAE_MODEL_PATH" ]; then
# wget -P ./pretrained_models "$VAE_MODEL_URL"
# fi
# }
# Execute installation based on OS
case $OS in
Linux)
install_linux
;;
Darwin)
install_macos
;;
MINGW*|MSYS*|CYGWIN*)
install_windows
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac
# Download models (common for all OSes)
download_models
echo "Installation complete."
|