mimosa-ai / script.sh
vivekk3's picture
Upload folder using huggingface_hub
9c4b01e verified
#!/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."