Closed FallenVibe closed 1 year ago
I made this to see what my favorite Korean rust streamers are talking about. Happy to hear others also find it useful!
Silero VAD requires torchaudio, which I added to requirements.txt. Simply running "pip install torchaudio" should fix it. I can't reproduce the issue with afreecatv. Is it only on one specific channel / after some time? Also, please try to run the same channel / quality directly in streamlink, i.e. "streamlink URL quality". If the issue persists, it is an issue with streamlink's afreeca plugin and should be reported to their issue tracker. Seems like there is already some stuff related to 400 errors on there.
Error logs for everything.
Pulling:
**PS J:\Projects\Python\Translator\stream-translator> git pull**
Already up to date.
Requirements.txt
**PS J:\Projects\Python\Translator\stream-translator> pip install -r requirements.txt**
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu113
Collecting git+https://github.com/openai/whisper.git (from -r requirements.txt (line 9))
Cloning https://github.com/openai/whisper.git to c:\users\main account\appdata\local\temp\pip-req-build-tl7vlmwl
Running command git clone --filter=blob:none --quiet https://github.com/openai/whisper.git 'C:\Users\Main Account\AppData\Local\Temp\pip-req-build-tl7
vlmwl'
Resolved https://github.com/openai/whisper.git to commit 9e653bd0ea0f1e9493cb4939733e9de249493cfb
Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from -r requirements.txt (line 1
)) (1.23.3)
Requirement already satisfied: tqdm in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from -r requirements.txt (line 2)
) (4.64.1)
Requirement already satisfied: more-itertools in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from -r requirements.tx
t (line 3)) (8.14.0)
Requirement already satisfied: torch in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from -r requirements.txt (line 5
)) (1.12.1+cu116)
Requirement already satisfied: torchaudio in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from -r requirements.txt (l
ine 6)) (0.12.1+cu116)
Requirement already satisfied: transformers>=4.19.0 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from -r requireme
nts.txt (line 7)) (4.22.2)
Requirement already satisfied: ffmpeg-python==0.2.0 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from -r requireme
nts.txt (line 8)) (0.2.0)
Requirement already satisfied: streamlink in j:\projects\python\translator\giraffe\lib\site-packages (from -r requirements.txt (line 10)) (5.0.1)
Requirement already satisfied: future in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from ffmpeg-python==0.2.0->-r r
equirements.txt (line 8)) (0.18.2)
Requirement already satisfied: colorama in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from tqdm->-r requirements.tx
t (line 2)) (0.4.5)
Requirement already satisfied: typing-extensions in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from torch->-r requi
rements.txt (line 5)) (4.3.0)
Requirement already satisfied: packaging>=20.0 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from transformers>=4.1
9.0->-r requirements.txt (line 7)) (21.3)
Requirement already satisfied: requests in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from transformers>=4.19.0->-r
requirements.txt (line 7)) (2.28.1)
Requirement already satisfied: huggingface-hub<1.0,>=0.9.0 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from trans
formers>=4.19.0->-r requirements.txt (line 7)) (0.10.0)
Requirement already satisfied: regex!=2019.12.17 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from transformers>=4
.19.0->-r requirements.txt (line 7)) (2022.9.13)
Requirement already satisfied: filelock in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from transformers>=4.19.0->-r
requirements.txt (line 7)) (3.8.0)
Requirement already satisfied: pyyaml>=5.1 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from transformers>=4.19.0-
>-r requirements.txt (line 7)) (6.0)
Requirement already satisfied: tokenizers!=0.11.3,<0.13,>=0.11.1 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from
transformers>=4.19.0->-r requirements.txt (line 7)) (0.12.1)
Requirement already satisfied: pycryptodome<4,>=3.4.3 in j:\projects\python\translator\giraffe\lib\site-packages (from streamlink->-r requirements.txt (
line 10)) (3.15.0)
Requirement already satisfied: pycountry in j:\projects\python\translator\giraffe\lib\site-packages (from streamlink->-r requirements.txt (line 10)) (22
.3.5)
Requirement already satisfied: lxml<5.0,>=4.6.4 in j:\projects\python\translator\giraffe\lib\site-packages (from streamlink->-r requirements.txt (line 1
0)) (4.9.1)
Requirement already satisfied: PySocks!=1.5.7,>=1.5.6 in j:\projects\python\translator\giraffe\lib\site-packages (from streamlink->-r requirements.txt (
line 10)) (1.7.1)
Requirement already satisfied: websocket-client<2.0,>=1.2.1 in j:\projects\python\translator\giraffe\lib\site-packages (from streamlink->-r requirements
.txt (line 10)) (1.4.1)
Requirement already satisfied: isodate in j:\projects\python\translator\giraffe\lib\site-packages (from streamlink->-r requirements.txt (line 10)) (0.6.
1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from packagin
g>=20.0->transformers>=4.19.0->-r requirements.txt (line 7)) (3.0.9)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from requests->tran
sformers>=4.19.0->-r requirements.txt (line 7)) (2022.9.24)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from requests
->transformers>=4.19.0->-r requirements.txt (line 7)) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from requests->transforme
rs>=4.19.0->-r requirements.txt (line 7)) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from requests->t
ransformers>=4.19.0->-r requirements.txt (line 7)) (1.26.12)
Requirement already satisfied: six in j:\projects\python\translator\giraffe\lib\site-packages (from isodate->streamlink->-r requirements.txt (line 10))
(1.16.0)
Requirement already satisfied: setuptools in j:\projects\python\translator\giraffe\lib\site-packages (from pycountry->streamlink->-r requirements.txt (l
ine 10)) (57.0.0)
Installing Torchaudio
**PS J:\Projects\Python\Translator\stream-translator> pip install torchaudio**
Requirement already satisfied: torchaudio in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (0.12.1+cu116)
Requirement already satisfied: torch==1.12.1 in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from torchaudio) (1.12.1
+cu116)
Requirement already satisfied: typing-extensions in c:\users\main account\appdata\local\programs\python\python39\lib\site-packages (from torch==1.12.1->
torchaudio) (4.3.0)
Using the program
**PS J:\Projects\Python\Translator\stream-translator> python translator.py twitch.tv/penta --task transcribe --model small**
Loading model...
Using cache found in C:\Users\Main Account/.cache\torch\hub\snakers4_silero-vad_master
Traceback (most recent call last):
File "J:\Projects\Python\Translator\stream-translator\translator.py", line 226, in <module>
cli()
File "J:\Projects\Python\Translator\stream-translator\translator.py", line 222, in cli
main(url, **args)
File "J:\Projects\Python\Translator\stream-translator\translator.py", line 117, in main
vad = VAD()
File "J:\Projects\Python\Translator\stream-translator\vad.py", line 9, in __init__
self.model, _ = torch.hub.load(
File "C:\Users\Main Account\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\hub.py", line 540, in load
model = _load_local(repo_or_dir, model, *args, **kwargs)
File "C:\Users\Main Account\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\hub.py", line 566, in _load_local
hub_module = _import_module(MODULE_HUBCONF, hubconf_path)
File "C:\Users\Main Account\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\hub.py", line 89, in _import_module
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\Main Account/.cache\torch\hub\snakers4_silero-vad_master\hubconf.py", line 4, in <module>
from utils_vad import (init_jit_model,
File "C:\Users\Main Account/.cache\torch\hub\snakers4_silero-vad_master\utils_vad.py", line 2, in <module>
import torchaudio
File "C:\Users\Main Account\AppData\Local\Programs\Python\Python39\lib\site-packages\torchaudio\__init__.py", line 1, in <module>
from torchaudio import ( # noqa: F401
File "C:\Users\Main Account\AppData\Local\Programs\Python\Python39\lib\site-packages\torchaudio\_extension.py", line 103, in <module>
_init_extension()
File "C:\Users\Main Account\AppData\Local\Programs\Python\Python39\lib\site-packages\torchaudio\_extension.py", line 88, in _init_extension
_load_lib("libtorchaudio")
File "C:\Users\Main Account\AppData\Local\Programs\Python\Python39\lib\site-packages\torchaudio\_extension.py", line 51, in _load_lib
torch.ops.load_library(path)
File "C:\Users\Main Account\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\_ops.py", line 255, in load_library
ctypes.CDLL(path)
File "C:\Users\Main Account\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\Main Account\AppData\Local\Programs\Python\Python39\Lib\site-packages\torchaudio\lib\libtorchaudio.py
d' (or one of its dependencies). Try using the full path with constructor syntax.
Seems like the torchaudio install is broken somehow. Could you maybe try installing in a new virtual environment?
Alright I setup a new virtual environment, and it the issue still persists. However, when I disable VAD with --disable_vad it's working properly.
And I've confirmed that the 400 error is Streamlink itself.
torchaudio is gone from dependencies now. As for the 400 error, you could try different settings as suggested here. You can set these settings in the streamlink config file which will then also be used when stream-translator calls streamlink. E.g. hls-segment-threads=10
Amazing, I was able to work everything out. No longer getting the 400ClientError through Streamlink for afreeca and everything is now working perfectly! Silero VAD also seems to help the translations for me. This is absolutely the best. Thank you so much!
Thank you for the work you're putting into this! I'd love to buy you a coffee.
The latest pull with Silero VAD seems to have broken it for me. Unsure if it's just requirements.txt missing some new dependency, though the older version does mostly work still.
The PREVIOUS VERSION, Afreeca was throwing a 400 Client Error I was going to put an issue up for, here's those logs:
Here's my logs below for the latest version with Silero VAD: