Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions requirements.bat
Original file line number Diff line number Diff line change
@@ -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

29 changes: 22 additions & 7 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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..."
Expand All @@ -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"
Expand All @@ -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"

Loading