Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.sh #12

Open
JuvenileLocksmith opened this issue Apr 12, 2024 · 1 comment
Open

setup.sh #12

JuvenileLocksmith opened this issue Apr 12, 2024 · 1 comment

Comments

@JuvenileLocksmith
Copy link

#!/bin/bash

# Helper function to check if a command exists
command_exists() {
    command -v "$1" &> /dev/null
}

# Install FFMPEG
os_name=$(uname -s)
echo "Operating system detected: $os_name"

# Check if ffmpeg is installed
if ! command_exists ffmpeg; then
    echo "FFmpeg is not installed. Installing now..."
    case "$os_name" in
        Linux*)
            distro=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
            if [[ $distro == *"Arch"* ]]; then
                sudo pacman -Sy ffmpeg --noconfirm
            elif [[ $distro == *"Ubuntu"* ]] || [[ $distro == *"Debian"* ]]; then
                sudo apt-get update
                sudo apt-get install ffmpeg -y
                sudo apt-get install python3-venv -y
            else
                echo "Unsupported Linux distribution: $distro"
                exit 1
            fi
            ;;
        *)
            echo "Unsupported operating system: $os_name"
            exit 1
            ;;
    esac
else
    echo "FFmpeg is already installed."
fi

# Check if CUDA is installed and accessible
if [ -z "$(ls /usr/local/cuda-*/bin/nvcc 2>/dev/null)" ]; then
    echo "CUDA is not installed or not properly configured."
    echo "Please install or configure CUDA."
    echo "CPU will be used for inference."
else
    cuda_version=$(/usr/local/cuda/bin/nvcc --version | grep release | sed 's/.*release //' | sed 's/,.*//')
    echo "CUDA version $cuda_version detected."
fi

# Create and activate a virtual environment
venv_dir=".lip-wise"
if [ ! -d "$venv_dir" ]; then
    python3 -m venv "$venv_dir"
fi
source "$venv_dir/bin/activate"

# Install Python packages
pip install -U pip
pip install -r requirements.txt

# Copy architecture files to the virtual environment
python_version=$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
arch_target_dir="$venv_dir/lib/python${python_version}/site-packages/basicsr/archs"

mkdir -p "$arch_target_dir"
cp archs/* "$arch_target_dir/"

# Run file_check.py
python ./helpers/file_check.py
@pawansharmaaaa
Copy link
Owner

Issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants