diff --git a/requirements.bat b/requirements.bat new file mode 100644 index 0000000..6712dfb --- /dev/null +++ b/requirements.bat @@ -0,0 +1,10 @@ +@echo off +REM Transformers Examples dependency installer for Windows + +IF NOT DEFINED VIRTUAL_ENV ( + echo Warning: No virtual environment detected. Consider creating one before installing dependencies. +) + +python -m pip install --upgrade pip +python -m pip install -r requirements.txt + diff --git a/setup.sh b/setup.sh index ce9d9c5..15570ae 100755 --- a/setup.sh +++ b/setup.sh @@ -1,4 +1,8 @@ #!/bin/bash +set -euo pipefail + +trap 'echo "❌ An unexpected error occurred. Exiting setup." >&2' ERR +trap 'echo "âš ī¸ Setup interrupted." >&2' INT TERM # Transformers Examples Setup Script set -e @@ -60,26 +64,36 @@ esac echo "🚀 Setting up Transformers Examples repository..." +# Suggest Windows alternative if running in Windows-like environment +if [[ "${OSTYPE:-}" == msys* || "${OSTYPE:-}" == cygwin* || "${OSTYPE:-}" == win32* ]]; then + echo "â„šī¸ Windows users can run requirements.bat or adapt the steps in a PowerShell script." +fi + # Check if Python is installed if ! command -v python3 &> /dev/null; then echo "❌ Python 3 is not installed. Please install Python 3.7+ first." exit 1 fi -echo "✅ Python 3 found: $(python3 --version)" +python_version="$(python3 --version)" +echo "✅ Python 3 found: ${python_version}" # Create virtual environment (optional but recommended) -if $create_venv; then +if [[ "${1:-}" == "--venv" ]]; then echo "đŸ“Ļ Creating virtual environment..." python3 -m venv venv - # shellcheck disable=SC1091 + # shellcheck source=/dev/null source venv/bin/activate echo "✅ Virtual environment activated" fi # Install requirements -echo "đŸ“Ĩ Installing dependencies for profile: $profile" -pip install -r requirements.txt +echo "đŸ“Ĩ Installing dependencies..." +if [[ -z "${VIRTUAL_ENV:-}" ]]; then + echo "âš ī¸ Warning: No active virtual environment detected. Consider running with --venv or activating one manually." +fi +python3 -m pip install --upgrade pip +python3 -m pip install -r requirements.txt if [[ "$profile" == "jax" || "$profile" == "all" ]]; then echo "➕ Installing JAX ecosystem dependencies..." @@ -92,7 +106,7 @@ if [[ "$profile" == "dev" || "$profile" == "all" ]]; then fi # Check if .env file exists -if [ ! -f ".env" ]; then +if [[ ! -f ".env" ]]; then echo "âš™ī¸ Creating .env file from template..." cp .env.example .env echo "📝 Please edit .env file and add your Hugging Face token" @@ -109,6 +123,7 @@ echo " - Genel-1/ for basic transformer examples" echo " - Genel-2/ for vision transformers" echo " - 'Multi Modal'/ for multimodal examples" echo " - llama/ for LLaMA implementation" -echo "3. Run: python test-time-scaling.py for a quick test" +echo "3. Run: python3 test-time-scaling.py for a quick test" echo "" echo "📚 Check README.md for detailed usage instructions" +