File size: 3,328 Bytes
9bb4147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@echo off

REM AutoMosaRakku Triton Cache Prebuild Tool

REM Creates Triton cache to prevent timeout during first object removal

setlocal EnableDelayedExpansion
chcp 65001 >nul 2>&1



REM Ensure working directory is the parent directory (distribution root)

REM Create_Cache.bat is now in setup/ subdirectory, so we need to go up one level
pushd "%~dp0.."



REM Isolate from any system Python (same reason as Setup.bat)
set PYTHONNOUSERSITE=1
set PYTHONPATH=

echo.
echo ========================================================
echo AutoMosaRakku Triton Cache Prebuild Tool
echo ========================================================
echo.
echo This tool creates Triton cache for object removal feature.
echo Prevents long processing time and timeouts on first use.
echo.
echo Note: This process may take several minutes.
echo.

if not defined AUTOPILOT pause

echo.
echo [START] Starting Triton cache creation...
echo.



REM Configure MSVC environment (required for triton-windows)
echo [CONFIG] Setting up MSVC environment...
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" (
    call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" >nul 2>&1
    echo [OK] MSVC Build Tools environment configured
) else if exist "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" (
    call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" >nul 2>&1
    echo [OK] MSVC Community environment configured
) else (
    echo [WARNING] MSVC not found. Please run Setup.bat first.
)



REM Execute cache creation using secure launcher (handles encrypted files)
echo.
echo [EXEC] Running encrypted environment cache creation...
echo Current directory: %CD%
python_base\python.exe runtime\secure_launcher_v2.py --cache-only



REM Check execution result
if %errorlevel% equ 0 (
    echo.
    echo ========================================================
    echo [SUCCESS] Triton cache creation completed
    echo ========================================================
    echo.
    echo Object removal processing will be faster next time.
    echo Start the application and try the object removal feature.
    echo.
) else (
    echo.
    echo ========================================================
    echo [FAILED] Triton cache creation failed
    echo ========================================================
    echo.
    echo Troubleshooting:
    echo 1. Make sure Setup.bat has been executed and completed
    echo 2. Ensure NVIDIA GPU drivers are up to date
    echo 3. Run this batch file with administrator privileges
    echo.
)

echo Cache directory check:
if exist "%USERPROFILE%\.triton\cache" (
    echo [OK] %USERPROFILE%\.triton\cache
    dir "%USERPROFILE%\.triton\cache" /b | find /c /v "" > nul
    if not errorlevel 1 (
        for /f %%i in ('dir "%USERPROFILE%\.triton\cache" /b ^| find /c /v ""') do echo     Cache files count: %%i
    )
) else (
    echo [INFO] Triton cache directory was not created
)

echo.
if not defined AUTOPILOT (
    echo Batch execution completed. Press any key to exit...
    pause >nul
)



REM Restore original directory
popd