File size: 2,305 Bytes
0081600
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@echo off
setlocal EnableExtensions DisableDelayedExpansion
cd /d "%~dp0"

echo ============================================================
echo  The Heaven-Vector Compression Engine - Hugging Face Publish
echo  v4.0.0 OmniCrown - VERY EARLY RESEARCH PROTOTYPE
echo ============================================================
echo.
echo This script creates/reuses a PUBLIC Hugging Face repository and
echo uploads this release. HVCE may compress poorly; the README keeps
echo that warning prominent.
echo.

where python >nul 2>nul
if %errorlevel%==0 (
    set "PY_CMD=python"
) else (
    where py >nul 2>nul
    if errorlevel 1 (
        echo ERROR: Python was not found. Install Python 3.9+ first.
        pause
        exit /b 1
    )
    set "PY_CMD=py -3"
)

set "HVCE_REPO_NAME=heaven-vector-compression-engine"
set /p "NEW_REPO_NAME=Repository name [heaven-vector-compression-engine]: "
if not "%NEW_REPO_NAME%"=="" set "HVCE_REPO_NAME=%NEW_REPO_NAME%"
set "NEW_REPO_NAME="

if not "%HF_TOKEN%"=="" goto have_token

where powershell >nul 2>nul
if errorlevel 1 goto visible_prompt

for /f "usebackq delims=" %%T in (`powershell -NoProfile -Command "$s=Read-Host 'Paste Hugging Face WRITE token' -AsSecureString; $b=[Runtime.InteropServices.Marshal]::SecureStringToBSTR($s); try {[Runtime.InteropServices.Marshal]::PtrToStringBSTR($b)} finally {[Runtime.InteropServices.Marshal]::ZeroFreeBSTR($b)}"`) do set "HF_TOKEN=%%T"
goto have_token

:visible_prompt
echo WARNING: PowerShell not found, so token input cannot be masked.
set /p "HF_TOKEN=Paste Hugging Face WRITE token: "

:have_token
if "%HF_TOKEN%"=="" (
    echo ERROR: No token supplied.
    pause
    exit /b 2
)

echo.
echo Installing/updating the Hugging Face client...
call %PY_CMD% -m pip install --quiet --upgrade huggingface_hub
if errorlevel 1 (
    echo ERROR: Could not install huggingface_hub.
    set "HF_TOKEN="
    pause
    exit /b 3
)

echo.
echo Publishing...
call %PY_CMD% publish_huggingface.py
set "RC=%ERRORLEVEL%"
set "HF_TOKEN="

if not "%RC%"=="0" (
    echo.
    echo Publication failed with code %RC%.
    echo Check that the token has WRITE permission and Internet access is available.
    pause
    exit /b %RC%
)

echo.
echo Done. The write token has been cleared from this process environment.
pause
exit /b 0