[Update] Add hf_xet and huggingface-hub to requirements; enhance mainloop.py for Hugging Face caching

This commit is contained in:
misyaguziya
2025-05-27 14:12:20 +09:00
parent 63d853bf7d
commit 8dac3da933
6 changed files with 25 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ a = Analysis(
['src-python\\mainloop.py'], ['src-python\\mainloop.py'],
pathex=[], pathex=[],
binaries=[], binaries=[],
datas=[('./fonts', 'fonts/'), ('.venv/Lib/site-packages/zeroconf', 'zeroconf/'), ('.venv/Lib/site-packages/openvr', 'openvr/'), ('.venv/Lib/site-packages/pykakasi', 'pykakasi/'), ('.venv/Lib/site-packages/faster_whisper', 'faster_whisper/')], datas=[('./fonts', 'fonts/'), ('.venv/Lib/site-packages/zeroconf', 'zeroconf/'), ('.venv/Lib/site-packages/openvr', 'openvr/'), ('.venv/Lib/site-packages/pykakasi', 'pykakasi/'), ('.venv/Lib/site-packages/faster_whisper', 'faster_whisper/'), ('.venv/Lib/site-packages/hf_xet', 'hf_xet/')],
hiddenimports=[], hiddenimports=[],
hookspath=[], hookspath=[],
hooksconfig={}, hooksconfig={},

View File

@@ -5,7 +5,7 @@ a = Analysis(
['src-python\\mainloop.py'], ['src-python\\mainloop.py'],
pathex=[], pathex=[],
binaries=[], binaries=[],
datas=[('./fonts', 'fonts/'), ('.venv_cuda/Lib/site-packages/zeroconf', 'zeroconf/'), ('.venv_cuda/Lib/site-packages/openvr', 'openvr/'), ('.venv_cuda/Lib/site-packages/pykakasi', 'pykakasi/'), ('.venv_cuda/Lib/site-packages/faster_whisper', 'faster_whisper/')], datas=[('./fonts', 'fonts/'), ('.venv_cuda/Lib/site-packages/zeroconf', 'zeroconf/'), ('.venv_cuda/Lib/site-packages/openvr', 'openvr/'), ('.venv_cuda/Lib/site-packages/pykakasi', 'pykakasi/'), ('.venv_cuda/Lib/site-packages/faster_whisper', 'faster_whisper/'), ('.venv/Lib/site-packages/hf_xet', 'hf_xet/')],
hiddenimports=[], hiddenimports=[],
hookspath=[], hookspath=[],
hooksconfig={}, hooksconfig={},

View File

@@ -1,6 +1,17 @@
REM .venv .venv_cuda があれば削除
if exist .venv (
rmdir /s /q .venv
)
if exist .venv_cuda (
rmdir /s /q .venv_cuda
)
REM .venv .venv_cuda を作成
python -m venv .venv python -m venv .venv
python -m venv .venv_cuda python -m venv .venv_cuda
REM .venv .venv_cuda に必要なパッケージをインストール
call .venv/Scripts/activate call .venv/Scripts/activate
python.exe -m pip install --upgrade pip python.exe -m pip install --upgrade pip
pip install --no-cache-dir --force-reinstall -r requirements.txt pip install --no-cache-dir --force-reinstall -r requirements.txt

View File

@@ -16,6 +16,8 @@ psutil==5.9.8
pykakasi==2.3.0 pykakasi==2.3.0
pycaw==20240210 pycaw==20240210
websockets==15.0.1 websockets==15.0.1
huggingface-hub==0.31.2
hf-xet==1.1.2
translators @ git+https://github.com/misyaguziya/translators@5.9.2.1 translators @ git+https://github.com/misyaguziya/translators@5.9.2.1
SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4.1 SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4.1
tinyoscquery @ git+https://github.com/cyberkitsune/tinyoscquery@0.1.3 tinyoscquery @ git+https://github.com/cyberkitsune/tinyoscquery@0.1.3

View File

@@ -17,6 +17,8 @@ psutil==5.9.8
pykakasi==2.3.0 pykakasi==2.3.0
pycaw==20240210 pycaw==20240210
websockets==15.0.1 websockets==15.0.1
huggingface-hub==0.31.2
hf-xet==1.1.2
translators @ git+https://github.com/misyaguziya/translators@5.9.2.1 translators @ git+https://github.com/misyaguziya/translators@5.9.2.1
SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4.1 SpeechRecognition @ git+https://github.com/misyaguziya/custom_speech_recognition@3.10.4.1
tinyoscquery @ git+https://github.com/cyberkitsune/tinyoscquery@0.1.3 tinyoscquery @ git+https://github.com/cyberkitsune/tinyoscquery@0.1.3

View File

@@ -1,9 +1,16 @@
import os
import sys import sys
import json import json
import time import time
from typing import Any from typing import Any
from threading import Thread from threading import Thread
from queue import Queue from queue import Queue
import warnings
warnings.filterwarnings('ignore')
huggingface_cache_dir = os.path.join(os.path.dirname(__file__), ".cache")
os.makedirs(huggingface_cache_dir, exist_ok=True)
os.environ["HF_HOME"] = os.path.join(huggingface_cache_dir)
from controller import Controller from controller import Controller
from utils import printLog, printResponse, errorLogging, encodeBase64 from utils import printLog, printResponse, errorLogging, encodeBase64
@@ -376,7 +383,7 @@ class Main:
if status == 423: if status == 423:
self.queue.put((endpoint, data)) self.queue.put((endpoint, data))
else: else:
printLog(endpoint, {"send_data":result}) printLog(endpoint, {"status": status, "send_data": result})
printResponse(status, endpoint, result) printResponse(status, endpoint, result)
time.sleep(0.1) time.sleep(0.1)