Skip to content
Open
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
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,16 @@ Thumbs.db
__pycache__/
*.pyc
*.pyo
*.pyd
*.pyd
/.history

# AI model files - prevent accidental commits of large model files
*.pth
deepcheat/*.pth

# Temporary processing directories
temp_processing/
processed_clips/
processed_vids/
uploads/
evaluation_results/
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,11 @@ This system uses cutting-edge Vision Transformer deep learning technology to ana
Double click wsl-setup.bat to run it without elevated privilages. This will auto-install the conda environment and all the requirements within the new WSL you just made.


### Step 2: Prepare model for training/inferencing
### Step 2: Complete Setup

1. **Download the model**
Go to https://huggingface.co/jinggu/jing-model/blob/main/vit_g_ps14_ak_ft_ckpt_7_clean.pth and download the .pth file
The setup scripts will automatically download the required AI model (1.9GB) during installation. If the automatic download fails, you'll be provided with manual download instructions.

2. **Place the model**

Place this .pth file in the "deepcheat/VideoMAEv2" folder found in the extracted project files. Paste any other downloaded models in "deepcheat/VideoMAEv2/output" for inferencing or fine tuning.

3. **You're ready to train a model and analyze CS2 clips!**
**You're ready to train a model and analyze CS2 clips!**


### Step 3: Run the Application
Expand Down Expand Up @@ -72,10 +67,8 @@ echo "🔧 Installing dependencies..."
chmod +x install.sh
./install.sh

# Download the model file
echo "🤖 Downloading AI model (1.9GB - this will take a few minutes)..."
wget --show-progress -O deepcheat/vit_g_ps14_ak_ft_ckpt_7_clean.pth \
https://huggingface.co/jinggu/jing-model/resolve/main/vit_g_ps14_ak_ft_ckpt_7_clean.pth
# The install.sh script will automatically download the AI model
echo "🤖 AI model will be downloaded automatically during setup..."

# Ask user if they want to run the server
echo ""
Expand Down
161 changes: 159 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,157 @@ if [ -f main.py ]; then
fi
fi

echo
echo "=================================================="
echo "Downloading AI Model..."
echo "=================================================="
echo

# Create the deepcheat directory if it doesn't exist
mkdir -p deepcheat

# Download the model file - pinned to specific commit for supply chain security
MODEL_COMMIT="main" # Pin to specific commit hash in production
MODEL_URL="https://huggingface.co/jinggu/jing-model/resolve/${MODEL_COMMIT}/vit_g_ps14_ak_ft_ckpt_7_clean.pth"
MODEL_PATH="deepcheat/vit_g_ps14_ak_ft_ckpt_7_clean.pth"
EXPECTED_SHA256="23b2d3c7b4073683f68fd0e822ab01e475f670136116449d7dbfc6f87a0dfe39"

echo "Downloading AI model (1.9GB - this may take several minutes)..."
echo "From: $MODEL_URL"
echo "To: $MODEL_PATH"
echo "Expected SHA-256: $EXPECTED_SHA256"
echo

# Function to verify SHA-256 hash
verify_model_hash() {
if [ ! -f "$MODEL_PATH" ]; then
echo "❌ Model file not found for verification"
return 1
fi

echo "Verifying model integrity..."
if command -v sha256sum &> /dev/null; then
ACTUAL_HASH=$(sha256sum "$MODEL_PATH" | cut -d' ' -f1)
elif command -v shasum &> /dev/null; then
ACTUAL_HASH=$(shasum -a 256 "$MODEL_PATH" | cut -d' ' -f1)
else
echo "⚠️ Warning: No SHA-256 utility found, skipping hash verification"
return 0
fi

if [ "$ACTUAL_HASH" = "$EXPECTED_SHA256" ]; then
echo "✅ Model integrity verified (SHA-256 match)"
return 0
else
echo "❌ Model integrity check failed!"
echo " Expected: $EXPECTED_SHA256"
echo " Actual: $ACTUAL_HASH"
echo " Removing corrupted file..."
rm -f "$MODEL_PATH"
return 1
fi
}

# Try downloading with curl first (with follow redirects)
if command -v curl &> /dev/null; then
echo "Using curl to download..."
if curl -L --progress-bar -o "$MODEL_PATH" "$MODEL_URL" && verify_model_hash; then
echo "✅ Model downloaded and verified successfully with curl!"
MODEL_DOWNLOADED=true
else
echo "❌ Download or verification failed with curl, trying wget..."
MODEL_DOWNLOADED=false
fi
elif command -v wget &> /dev/null; then
echo "Using wget to download..."
if wget --show-progress -O "$MODEL_PATH" "$MODEL_URL" && verify_model_hash; then
echo "✅ Model downloaded and verified successfully with wget!"
MODEL_DOWNLOADED=true
else
echo "❌ Download or verification failed with wget..."
MODEL_DOWNLOADED=false
fi
else
echo "❌ Neither curl nor wget found..."
MODEL_DOWNLOADED=false
fi

# If download failed, provide detailed diagnostics and recovery options
if [ "$MODEL_DOWNLOADED" != true ]; then
echo
echo "=================================================="
echo "⚠️ MODEL DOWNLOAD FAILED - DIAGNOSTICS"
echo "=================================================="
echo

# Check available disk space
echo "Checking system resources..."
AVAILABLE_SPACE=$(df -h . | awk 'NR==2 {print $4}')
echo "Available disk space: $AVAILABLE_SPACE"

# Check network connectivity
echo "Testing network connectivity..."
if ping -c 1 huggingface.co >/dev/null 2>&1; then
echo "✅ Network connectivity to huggingface.co: OK"
else
echo "❌ Network connectivity to huggingface.co: FAILED"
echo " Check your internet connection or firewall settings"
fi

# Check if partial file exists
if [ -f "$MODEL_PATH" ]; then
PARTIAL_SIZE=$(du -h "$MODEL_PATH" | cut -f1)
echo "⚠️ Partial download found: $PARTIAL_SIZE"
echo " Removing incomplete file..."
rm -f "$MODEL_PATH"
fi

echo
echo "=================================================="
echo "⚠️ MANUAL DOWNLOAD REQUIRED"
echo "=================================================="
echo
echo "Please download the model manually using one of these methods:"
echo
echo "METHOD 1 - Direct download:"
echo "1. Go to: https://huggingface.co/jinggu/jing-model/blob/main/vit_g_ps14_ak_ft_ckpt_7_clean.pth"
echo "2. Click the download button"
echo "3. Save the file as: $MODEL_PATH"
echo
echo "METHOD 2 - Command line (if you have git-lfs):"
echo " git clone https://huggingface.co/jinggu/jing-model"
echo " cp jing-model/vit_g_ps14_ak_ft_ckpt_7_clean.pth $MODEL_PATH"
echo
echo "METHOD 3 - Alternative download tools:"
echo " aria2c -x 16 -s 16 '$MODEL_URL' -o '$MODEL_PATH'"
echo
echo "Expected file size: ~1.9GB (2,023,541,901 bytes)"
echo "Expected SHA-256: $EXPECTED_SHA256"
echo
echo "Common issues and solutions:"
echo "- Network timeout: Try using a VPN or different network"
echo "- Insufficient disk space: Free up at least 3GB of space"
echo "- Firewall blocking: Whitelist huggingface.co domain"
echo "- Corporate proxy: Configure proxy settings or download manually"
echo
else
# Verify the downloaded file
if [ -f "$MODEL_PATH" ]; then
FILE_SIZE=$(du -h "$MODEL_PATH" | cut -f1)
echo "Model file size: $FILE_SIZE"

# Basic size check (should be around 1.9GB)
FILE_SIZE_BYTES=$(stat -f%z "$MODEL_PATH" 2>/dev/null || stat -c%s "$MODEL_PATH" 2>/dev/null)
if [ "$FILE_SIZE_BYTES" -gt 1000000000 ]; then
echo "✅ Model file appears to be the correct size"
else
echo "⚠️ Warning: Model file seems smaller than expected"
echo " Expected: ~1.9GB, Got: $FILE_SIZE"
echo " You may need to download it manually"
fi
fi
fi

echo
echo "=================================================="
echo "Installation Complete!"
Expand All @@ -164,8 +315,14 @@ echo "1. Run: ./run.sh"
echo " (The run script will automatically activate the environment)"
echo "2. Open your browser to http://localhost:5000"
echo
echo "Note: The model weights (.pth files) need to be placed in:"
echo " deepcheat/VideoMAEv2/output/"

if [ "$MODEL_DOWNLOADED" = true ]; then
echo "✅ AI model is ready to use!"
else
echo "⚠️ Remember to download the AI model manually before using the system"
echo " Place it in: $MODEL_PATH"
fi

echo
echo "Press Enter to exit..."
read
Expand Down
Loading