In de tip MKVToolNix hebben we online SRT ondetitels laten vertalen door AI. Om allerlei redenen kan het gebruik van online AI diensten niet de ideale oplossing zijn. De op Hugging Face aangeboden AI diensten kan je ook lokaal installeren en gebruiken. Deze tip toont hoe je dit kunt verwezenlijken met het eerder gebruikte SRT AI vertaalsysteem op Hugging Face. Voor het gebruiken van deze SRT AI vertaler heb je geen speciale hardware nodig. Voor deze tip heb ik volledig succesvol een oude laptop daterend van 2013, zonder afzonderlijke grafische kaart gebruikt.
Dit kan op twee verschillende manieren:
De handleiding om een Hugging Face AI systeem lokaal te installeren kan je vinden in het menu (knop pet drie punten). De optie Run locally toont de Docker handleiding. De optie Clone repository de handleiding om zelf een gepaste omgeving aan te maken en de broncode te downloaden.
Wij gaan aan de slag met de Clone Repository.
Zoals je merkt is dit een beknopte handleiding. Waarbij de eerste regel ons al doorverwijst naar een https://git-lfs.com.
Ziehier de praktijk. We beginnen met de installatie van git-lfs.
dany@pindabook:~$ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
[sudo] wachtwoord voor root:
Detected operating system as debian/bookworm.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Detected apt version as 2.6.1
Running apt-get update... done.
Installing debian-archive-keyring which is needed for installing
apt-transport-https on many Debian systems.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/github_git-lfs.list...done.
Importing packagecloud gpg key... Packagecloud gpg key imported to /etc/apt/keyrings/github_git-lfs-archive-keyring.gpg
done.
Running apt-get update... done.
The repository is setup! You can now install packages.
Zoals uit de melding blijkt werd er een softwarebron aan het systeem toegevoegd en kunnen we nu de extra software installeren. Om straks op een eenvoudige manier alles terug te verwijderen, maken we gebruik van een Python omgeving, waarvoor we eveneens extra software nodig hebben. Beiden installeren we met:
dany@pindabook:~$ sudo apt install git-lfs python3-venv
Pakketlijsten worden ingelezen... Klaar
Boom van vereisten wordt opgebouwd... Klaar
De statusinformatie wordt gelezen... Klaar
De volgende extra pakketten zullen geïnstalleerd worden:
python3-distutils python3-lib2to3 python3-pip-whl python3-setuptools-whl python3.11-venv
De volgende NIEUWE pakketten zullen geïnstalleerd worden:
git-lfs python3-distutils python3-lib2to3 python3-pip-whl python3-setuptools-whl python3-venv python3.11-venv
0 opgewaardeerd, 7 nieuw geïnstalleerd, 0 te verwijderen en 0 niet opgewaardeerd.
Er moeten 11,5 MB aan archieven opgehaald worden.
Na deze bewerking zal er 22,3 MB extra schijfruimte gebruikt worden.
Wilt u doorgaan? [J/n]
Ophalen:1 http://deb.debian.org/debian bookworm/main amd64 python3-lib2to3 all 3.11.2-3 [76,3 kB]
Ophalen:2 http://deb.debian.org/debian bookworm/main amd64 python3-distutils all 3.11.2-3 [131 kB]
Ophalen:3 http://deb.debian.org/debian bookworm/main amd64 python3-pip-whl all 23.0.1+dfsg-1 [1.717 kB]
Ophalen:4 http://deb.debian.org/debian bookworm/main amd64 python3-setuptools-whl all 66.1.1-1+deb12u1 [1.112 kB]
Ophalen:5 http://deb.debian.org/debian bookworm/main amd64 python3.11-venv amd64 3.11.2-6+deb12u6 [5.896 B]
Ophalen:6 http://deb.debian.org/debian bookworm/main amd64 python3-venv amd64 3.11.2-1+b1 [1.200 B]
Ophalen:7 https://packagecloud.io/github/git-lfs/debian bookworm/main amd64 git-lfs amd64 3.6.1 [8.488 kB]
11,5 MB opgehaald in 1s (8.512 kB/s)
Voorheen niet geselecteerd pakket git-lfs wordt geselecteerd.
(Database wordt ingelezen ... 173860 bestanden en mappen momenteel geïnstalleerd.)
Uitpakken van .../0-git-lfs_3.6.1_amd64.deb wordt voorbereid...
Bezig met uitpakken van git-lfs (3.6.1) ...
...
Voorheen niet geselecteerd pakket python3-venv wordt geselecteerd.
Uitpakken van .../6-python3-venv_3.11.2-1+b1_amd64.deb wordt voorbereid...
Bezig met uitpakken van python3-venv (3.11.2-1+b1) ...
Instellen van python3-setuptools-whl (66.1.1-1+deb12u1) ...
Instellen van python3-pip-whl (23.0.1+dfsg-1) ...
Instellen van git-lfs (3.6.1) ...
Git LFS initialized.
Instellen van python3-lib2to3 (3.11.2-3) ...
Instellen van python3-distutils (3.11.2-3) ...
Instellen van python3.11-venv (3.11.2-6+deb12u6) ...
Instellen van python3-venv (3.11.2-1+b1) ...
Bezig met afhandelen van triggers voor man-db (2.11.2-2) ...
Voor de ons experiment geïsoleerde Python omgeving maken we een map aan. En openen we de aangemaakte map om er verder in te werken.
dany@pindabook:~$mkdir srttranslate
dany@pindabook:~$cd srttranslate/
Deze map isoleren we van de rest van ons systeem met de volgende twee opdrachten:
dany@pindabook:~/srttranslate$python3 -m venv .
dany@pindabook:~/srttranslate$source bin/activate
(srttranslate) dany@pindabook:~/srttranslate$
Aan (srttranslate)
voor de prompt merken we dat we in de geïsoleerde Python omgeving werken.
Alle Python onderdelen die we hier nu installeren, inclusief de Hugging Face onderdelen worden in deze geïsoleerde omgeving (map) opgeslagen.
We beginnen met het downloaden (clonen) van de Hugging Face onderdelen voor onze AI SRT vertaler.
(srttranslate) dany@pindabook:~/srttranslate$ git clone https://huggingface.co/spaces/Lenylvt/SRT_Translation
Cloning into 'SRT_Translation'...
remote: Enumerating objects: 64, done.
remote: Counting objects: 100% (60/60), done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 64 (delta 34), reused 0 (delta 0), pack-reused 4 (from 1)
Unpacking objects: 100% (64/64), 23.40 KiB | 855.00 KiB/s, done.
Mocht je nu reeds de AI SRT vertaler opstarten, zou je telkens meldingen krijgen van ontbrekende Python onderdelen (bibliotheken). Na het op deze manier achterhalen van alle afhankelijkheden, kwam ik tot de volgende allesomvattende Python installatie opdracht:
(srttranslate) dany@pindabook:~/srttranslate$ pip install huggingface_hub streamlit requests panda transformers pysrt tqdm sentencepiece torch sacremoses
Collecting huggingface_hub
Downloading huggingface_hub-0.32.4-py3-none-any.whl (512 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 512.1/512.1 kB 7.8 MB/s eta 0:00:00
Collecting streamlit
Downloading streamlit-1.45.1-py3-none-any.whl (9.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.9/9.9 MB 15.6 MB/s eta 0:00:00
Collecting requests
Downloading requests-2.32.3-py3-none-any.whl (64 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.9/64.9 kB 3.5 MB/s eta 0:00:00
Collecting panda
Downloading panda-0.3.1.tar.gz (5.8 kB)
Preparing metadata (setup.py) ... done
Collecting transformers
Downloading transformers-4.52.4-py3-none-any.whl (10.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.5/10.5 MB 15.5 MB/s eta 0:00:00
Collecting pysrt
Downloading pysrt-1.1.2.tar.gz (104 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 104.4/104.4 kB 5.3 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting tqdm
Downloading tqdm-4.67.1-py3-none-any.whl (78 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.5/78.5 kB 4.4 MB/s eta 0:00:00
Collecting sentencepiece
Downloading sentencepiece-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 15.4 MB/s eta 0:00:00
Collecting torch
Downloading torch-2.7.1-cp311-cp311-manylinux_2_28_x86_64.whl (821.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 821.2/821.2 MB 1.6 MB/s eta 0:00:00
Collecting sacremoses
Downloading sacremoses-0.1.1-py3-none-any.whl (897 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 897.5/897.5 kB 13.1 MB/s eta 0:00:00
Collecting filelock
Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
Collecting fsspec>=2023.5.0
Downloading fsspec-2025.5.1-py3-none-any.whl (199 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.1/199.1 kB 9.1 MB/s eta 0:00:00
Collecting packaging>=20.9
Downloading packaging-25.0-py3-none-any.whl (66 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.5/66.5 kB 3.7 MB/s eta 0:00:00
Collecting pyyaml>=5.1
Downloading PyYAML-6.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (762 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 763.0/763.0 kB 12.6 MB/s eta 0:00:00
Collecting typing-extensions>=3.7.4.3
Downloading typing_extensions-4.14.0-py3-none-any.whl (43 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.8/43.8 kB 2.7 MB/s eta 0:00:00
Collecting hf-xet<2.0.0,>=1.1.2
Downloading hf_xet-1.1.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.8/4.8 MB 15.3 MB/s eta 0:00:00
Collecting altair<6,>=4.0
Downloading altair-5.5.0-py3-none-any.whl (731 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 731.2/731.2 kB 13.9 MB/s eta 0:00:00
Collecting blinker<2,>=1.5.0
Downloading blinker-1.9.0-py3-none-any.whl (8.5 kB)
Collecting cachetools<6,>=4.0
Downloading cachetools-5.5.2-py3-none-any.whl (10 kB)
Collecting click<9,>=7.0
Downloading click-8.2.1-py3-none-any.whl (102 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 102.2/102.2 kB 5.7 MB/s eta 0:00:00
Collecting numpy<3,>=1.23
Downloading numpy-2.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.8/16.8 MB 14.3 MB/s eta 0:00:00
Collecting packaging>=20.9
Downloading packaging-24.2-py3-none-any.whl (65 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.5/65.5 kB 3.7 MB/s eta 0:00:00
Collecting pandas<3,>=1.4.0
Downloading pandas-2.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.4/12.4 MB 14.9 MB/s eta 0:00:00
Collecting pillow<12,>=7.1.0
Downloading pillow-11.2.1-cp311-cp311-manylinux_2_28_x86_64.whl (4.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.6/4.6 MB 14.8 MB/s eta 0:00:00
Collecting protobuf<7,>=3.20
Downloading protobuf-6.31.1-cp39-abi3-manylinux2014_x86_64.whl (321 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 321.1/321.1 kB 8.7 MB/s eta 0:00:00
Collecting pyarrow>=7.0
Downloading pyarrow-20.0.0-cp311-cp311-manylinux_2_28_x86_64.whl (42.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.3/42.3 MB 11.7 MB/s eta 0:00:00
Collecting tenacity<10,>=8.1.0
Downloading tenacity-9.1.2-py3-none-any.whl (28 kB)
Collecting toml<2,>=0.10.1
Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting watchdog<7,>=2.1.5
Downloading watchdog-6.0.0-py3-none-manylinux2014_x86_64.whl (79 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.1/79.1 kB 4.5 MB/s eta 0:00:00
Collecting gitpython!=3.1.19,<4,>=3.0.7
Downloading GitPython-3.1.44-py3-none-any.whl (207 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 207.6/207.6 kB 8.5 MB/s eta 0:00:00
Collecting pydeck<1,>=0.8.0b4
Downloading pydeck-0.9.1-py2.py3-none-any.whl (6.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.9/6.9 MB 15.6 MB/s eta 0:00:00
Collecting tornado<7,>=6.0.3
Downloading tornado-6.5.1-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (443 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 443.3/443.3 kB 9.7 MB/s eta 0:00:00
Collecting charset-normalizer<4,>=2
Downloading charset_normalizer-3.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (147 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 147.3/147.3 kB 5.6 MB/s eta 0:00:00
Collecting idna<4,>=2.5
Downloading idna-3.10-py3-none-any.whl (70 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.4/70.4 kB 4.4 MB/s eta 0:00:00
Collecting urllib3<3,>=1.21.1
Downloading urllib3-2.4.0-py3-none-any.whl (128 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 128.7/128.7 kB 6.6 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
Downloading certifi-2025.4.26-py3-none-any.whl (159 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 159.6/159.6 kB 9.3 MB/s eta 0:00:00
Requirement already satisfied: setuptools in ./lib/python3.11/site-packages (from panda) (66.1.1)
Collecting regex!=2019.12.17
Downloading regex-2024.11.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (792 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 792.7/792.7 kB 13.2 MB/s eta 0:00:00
Collecting tokenizers<0.22,>=0.21
Downloading tokenizers-0.21.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 15.6 MB/s eta 0:00:00
Collecting safetensors>=0.4.3
Downloading safetensors-0.5.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (471 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 471.6/471.6 kB 10.7 MB/s eta 0:00:00
Collecting chardet
Downloading chardet-5.2.0-py3-none-any.whl (199 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.4/199.4 kB 6.5 MB/s eta 0:00:00
Collecting sympy>=1.13.3
Downloading sympy-1.14.0-py3-none-any.whl (6.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.3/6.3 MB 15.8 MB/s eta 0:00:00
Collecting networkx
Downloading networkx-3.5-py3-none-any.whl (2.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 16.6 MB/s eta 0:00:00
Collecting jinja2
Downloading jinja2-3.1.6-py3-none-any.whl (134 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.9/134.9 kB 6.1 MB/s eta 0:00:00
Collecting nvidia-cuda-nvrtc-cu12==12.6.77
Downloading nvidia_cuda_nvrtc_cu12-12.6.77-py3-none-manylinux2014_x86_64.whl (23.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.7/23.7 MB 13.5 MB/s eta 0:00:00
Collecting nvidia-cuda-runtime-cu12==12.6.77
Downloading nvidia_cuda_runtime_cu12-12.6.77-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (897 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 897.7/897.7 kB 10.7 MB/s eta 0:00:00
Collecting nvidia-cuda-cupti-cu12==12.6.80
Downloading nvidia_cuda_cupti_cu12-12.6.80-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (8.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.9/8.9 MB 15.4 MB/s eta 0:00:00
Collecting nvidia-cudnn-cu12==9.5.1.17
Downloading nvidia_cudnn_cu12-9.5.1.17-py3-none-manylinux_2_28_x86_64.whl (571.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 571.0/571.0 MB 2.0 MB/s eta 0:00:00
Collecting nvidia-cublas-cu12==12.6.4.1
Downloading nvidia_cublas_cu12-12.6.4.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (393.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 393.1/393.1 MB 2.9 MB/s eta 0:00:00
Collecting nvidia-cufft-cu12==11.3.0.4
Downloading nvidia_cufft_cu12-11.3.0.4-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (200.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 200.2/200.2 MB 4.4 MB/s eta 0:00:00
Collecting nvidia-curand-cu12==10.3.7.77
Downloading nvidia_curand_cu12-10.3.7.77-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (56.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.3/56.3 MB 9.1 MB/s eta 0:00:00
Collecting nvidia-cusolver-cu12==11.7.1.2
Downloading nvidia_cusolver_cu12-11.7.1.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (158.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 158.2/158.2 MB 5.7 MB/s eta 0:00:00
Collecting nvidia-cusparse-cu12==12.5.4.2
Downloading nvidia_cusparse_cu12-12.5.4.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (216.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 216.6/216.6 MB 4.7 MB/s eta 0:00:00
Collecting nvidia-cusparselt-cu12==0.6.3
Downloading nvidia_cusparselt_cu12-0.6.3-py3-none-manylinux2014_x86_64.whl (156.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 156.8/156.8 MB 4.5 MB/s eta 0:00:00
Collecting nvidia-nccl-cu12==2.26.2
Downloading nvidia_nccl_cu12-2.26.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (201.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 201.3/201.3 MB 4.4 MB/s eta 0:00:00
Collecting nvidia-nvtx-cu12==12.6.77
Downloading nvidia_nvtx_cu12-12.6.77-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (89 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.3/89.3 kB 6.3 MB/s eta 0:00:00
Collecting nvidia-nvjitlink-cu12==12.6.85
Downloading nvidia_nvjitlink_cu12-12.6.85-py3-none-manylinux2010_x86_64.manylinux_2_12_x86_64.whl (19.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.7/19.7 MB 13.9 MB/s eta 0:00:00
Collecting nvidia-cufile-cu12==1.11.1.6
Downloading nvidia_cufile_cu12-1.11.1.6-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 14.4 MB/s eta 0:00:00
Collecting triton==3.3.1
Downloading triton-3.3.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (155.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.7/155.7 MB 6.0 MB/s eta 0:00:00
Collecting joblib
Downloading joblib-1.5.1-py3-none-any.whl (307 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 307.7/307.7 kB 10.2 MB/s eta 0:00:00
Collecting jsonschema>=3.0
Downloading jsonschema-4.24.0-py3-none-any.whl (88 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.7/88.7 kB 4.6 MB/s eta 0:00:00
Collecting narwhals>=1.14.2
Downloading narwhals-1.41.1-py3-none-any.whl (358 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 358.0/358.0 kB 9.7 MB/s eta 0:00:00
Collecting gitdb<5,>=4.0.1
Downloading gitdb-4.0.12-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 2.9 MB/s eta 0:00:00
Collecting python-dateutil>=2.8.2
Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 229.9/229.9 kB 9.3 MB/s eta 0:00:00
Collecting pytz>=2020.1
Downloading pytz-2025.2-py2.py3-none-any.whl (509 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 509.2/509.2 kB 12.6 MB/s eta 0:00:00
Collecting tzdata>=2022.7
Downloading tzdata-2025.2-py2.py3-none-any.whl (347 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 347.8/347.8 kB 10.3 MB/s eta 0:00:00
Collecting MarkupSafe>=2.0
Downloading MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23 kB)
Collecting mpmath<1.4,>=1.1.0
Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 12.0 MB/s eta 0:00:00
Collecting smmap<6,>=3.0.1
Downloading smmap-5.0.2-py3-none-any.whl (24 kB)
Collecting attrs>=22.2.0
Downloading attrs-25.3.0-py3-none-any.whl (63 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.8/63.8 kB 4.3 MB/s eta 0:00:00
Collecting jsonschema-specifications>=2023.03.6
Downloading jsonschema_specifications-2025.4.1-py3-none-any.whl (18 kB)
Collecting referencing>=0.28.4
Downloading referencing-0.36.2-py3-none-any.whl (26 kB)
Collecting rpds-py>=0.7.1
Downloading rpds_py-0.25.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (386 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 387.0/387.0 kB 10.5 MB/s eta 0:00:00
Collecting six>=1.5
Downloading six-1.17.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: sentencepiece, pytz, nvidia-cusparselt-cu12, mpmath, watchdog, urllib3, tzdata, typing-extensions, triton, tqdm, tornado, toml, tenacity, sympy, smmap, six, safetensors, rpds-py, regex, pyyaml, pyarrow, pr
otobuf, pillow, packaging, nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufile-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, numpy, networkx,
narwhals, MarkupSafe, joblib, idna, hf-xet, fsspec, filelock, click, charset-normalizer, chardet, certifi, cachetools, blinker, attrs, sacremoses, requests, referencing, python-dateutil, pysrt, nvidia-cusparse-cu12, nvidia-cufft-cu12,
nvidia-cudnn-cu12, jinja2, gitdb, pydeck, pandas, panda, nvidia-cusolver-cu12, jsonschema-specifications, huggingface_hub, gitpython, torch, tokenizers, jsonschema, transformers, altair, streamlit
DEPRECATION: pysrt is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacemen
t is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for pysrt ... done
DEPRECATION: panda is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacemen
t is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for panda ... done
Successfully installed MarkupSafe-3.0.2 altair-5.5.0 attrs-25.3.0 blinker-1.9.0 cachetools-5.5.2 certifi-2025.4.26 chardet-5.2.0 charset-normalizer-3.4.2 click-8.2.1 filelock-3.18.0 fsspec-2025.5.1 gitdb-4.0.12 gitpython-3.1.44 hf-xet-1
.1.3 huggingface_hub-0.32.4 idna-3.10 jinja2-3.1.6 joblib-1.5.1 jsonschema-4.24.0 jsonschema-specifications-2025.4.1 mpmath-1.3.0 narwhals-1.41.1 networkx-3.5 numpy-2.2.6 nvidia-cublas-cu12-12.6.4.1 nvidia-cuda-cupti-cu12-12.6.80 nvidia
-cuda-nvrtc-cu12-12.6.77 nvidia-cuda-runtime-cu12-12.6.77 nvidia-cudnn-cu12-9.5.1.17 nvidia-cufft-cu12-11.3.0.4 nvidia-cufile-cu12-1.11.1.6 nvidia-curand-cu12-10.3.7.77 nvidia-cusolver-cu12-11.7.1.2 nvidia-cusparse-cu12-12.5.4.2 nvidia-
cusparselt-cu12-0.6.3 nvidia-nccl-cu12-2.26.2 nvidia-nvjitlink-cu12-12.6.85 nvidia-nvtx-cu12-12.6.77 packaging-24.2 panda-0.3.1 pandas-2.3.0 pillow-11.2.1 protobuf-6.31.1 pyarrow-20.0.0 pydeck-0.9.1 pysrt-1.1.2 python-dateutil-2.9.0.pos
t0 pytz-2025.2 pyyaml-6.0.2 referencing-0.36.2 regex-2024.11.6 requests-2.32.3 rpds-py-0.25.1 sacremoses-0.1.1 safetensors-0.5.3 sentencepiece-0.2.0 six-1.17.0 smmap-5.0.2 streamlit-1.45.1 sympy-1.14.0 tenacity-9.1.2 tokenizers-0.21.1 t
oml-0.10.2 torch-2.7.1 tornado-6.5.1 tqdm-4.67.1 transformers-4.52.4 triton-3.3.1 typing-extensions-4.14.0 tzdata-2025.2 urllib3-2.4.0 watchdog-6.0.0
Nu de installatie is afgewerkt, kunnen we de geïsoleerde Python omgeving deactiveren en de map verlaten.
(srttranslate) dany@pindabook:~/srttranslate$deactivate
dany@pindabook:~/srttranslate$cd
Zoals in de tip MKVToolNix maken we opnieuw gebruik van een MKVToolNix voorbeeldbestand. Deze keer een ondertitel die we downloaden met:
dany@pindabook:~$ wget -O "Vanilla Sky.en.srt" https://mkvtoolnix.download/samples/vsshort-en.srt
--2025-06-06 18:31:32-- https://mkvtoolnix.download/samples/vsshort-en.srt
Herleiden van mkvtoolnix.download (mkvtoolnix.download)... 2a01:4f8:262:fc01::7, 142.132.213.39
Verbinding maken met mkvtoolnix.download (mkvtoolnix.download)|2a01:4f8:262:fc01::7|:443... verbonden.
HTTP-verzoek is verzonden; wachten op antwoord... 200 OK
Lengte: 1202 (1,2K) [application/x-subrip]
Wordt opgeslagen als: ‘Vanilla Sky.en.srt’
Vanilla Sky.en.srt 100%[==============================================>] 1,17K --.-KB/s in 0s
2025-06-06 18:31:33 (11,7 MB/s) - '‘Vanilla Sky.en.srt’' opgeslagen [1202/1202]
We controleren kort de inhoud met:
dany@pindabook:~$ head Vanilla\ Sky.en.srt
1
00:00:04,700 --> 00:00:06,736
where are you going so early?
2
00:00:06,900 --> 00:00:09,494
Don't record any more messages
on my alarm clock.
3
En starten onze lokale AI SRT vertaler via Streamlit, een Python programma om webapplicaties te starten.
dany@pindabook:~$ srttranslate/bin/streamlit run srttranslate/SRT_Translation/app.py
Collecting usage statistics. To deactivate, set browser.gatherUsageStats to false.
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
Network URL: http://192.168.129.29:8501
External URL: http://91.180.5.20:8501
De getoonde melding toont ons alle noodzakelijke gegevens om onze AI SRT vertaler via een webbrowser te starten. Onderstaande voorbeeld is ingevuld om onze SRT ondertitel naar het Nederlands te vertalen. Bij de eerste vertaling moeten onze SRT vertaler nog onderdelen van het internet halen, waardoor het vertalen zelf niet direct zal starten.
Dankzij de meldingen in de terminal kunnen we het proces volgen. Na het voltooien van de vertaling, kan je de vertaalde ondertitel downloaden. De webpagina kan je dan sluiten en de vertaler zelf sluit je in de terminal af met de sneltoets Ctrl+c.
2025-06-06 18:39:20.145 Examining the path of torch.classes raised:
Traceback (most recent call last):
File "/home/dany/srttranslate/lib/python3.11/site-packages/streamlit/web/bootstrap.py", line 347, in run
if asyncio.get_running_loop().is_running():
^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dany/srttranslate/lib/python3.11/site-packages/streamlit/watcher/local_sources_watcher.py", line 217,
in get_module_paths
potential_paths = extract_paths(module)
^^^^^^^^^^^^^^^^^^^^^
File "/home/dany/srttranslate/lib/python3.11/site-packages/streamlit/watcher/local_sources_watcher.py", line 210,
in <lambda>
lambda m: list(m.__path__._path),
^^^^^^^^^^^^^^^^
File "/home/dany/srttranslate/lib/python3.11/site-packages/torch/_classes.py", line 13, in __getattr__
proxy = torch._C._get_custom_class_python_wrapper(self.name, attr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Tried to instantiate class '__path__._path', but it does not exist! Ensure that it is registered via t
orch::class_
tokenizer_config.json: 100%|██████████████████████████████████████████████████████| 42.0/42.0 [00:00<00:00, 193kB/s]
source.spm: 100%|████████████████████████████████████████████████████████████████| 790k/790k [00:00<00:00, 4.49MB/s]
target.spm: 100%|████████████████████████████████████████████████████████████████| 814k/814k [00:00<00:00, 4.68MB/s]
vocab.json: 100%|██████████████████████████████████████████████████████████████| 1.66M/1.66M [00:00<00:00, 26.7MB/s]
config.json: 100%|█████████████████████████████████████████████████████████████| 1.38k/1.38k [00:00<00:00, 7.23MB/s]
pytorch_model.bin: 100%|█████████████████████████████████████████████████████████| 316M/316M [00:17<00:00, 17.6MB/s]
generation_config.json: 100%|██████████████████████████████████████████████████████| 293/293 [00:00<00:00, 1.57MB/s]
model.safetensors: 100%|█████████████████████████████████████████████████████████| 316M/316M [00:18<00:00, 17.5MB/s]
2025-06-06 18:41:05.380 Examining the path of torch.classes raised:
Traceback (most recent call last):
File "/home/dany/srttranslate/lib/python3.11/site-packages/streamlit/web/bootstrap.py", line 347, in run
if asyncio.get_running_loop().is_running():
^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dany/srttranslate/lib/python3.11/site-packages/streamlit/watcher/local_sources_watcher.py", line 217,
in get_module_paths
potential_paths = extract_paths(module)
^^^^^^^^^^^^^^^^^^^^^
File "/home/dany/srttranslate/lib/python3.11/site-packages/streamlit/watcher/local_sources_watcher.py", line 210,
in <lambda>
lambda m: list(m.__path__._path),
^^^^^^^^^^^^^^^^
File "/home/dany/srttranslate/lib/python3.11/site-packages/torch/_classes.py", line 13, in __getattr__
proxy = torch._C._get_custom_class_python_wrapper(self.name, attr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Tried to instantiate class '__path__._path', but it does not exist! Ensure that it is registered via t
orch::class_
^C
Stopping...
Een korte controle van de gedownloade vertaling:
dany@pindabook:~$ head Downloads/translated_subtitles.srt
1
00:00:04,700 --> 00:00:06,736
Waar ga je zo vroeg heen?
2
00:00:06,900 --> 00:00:09,494
Geen berichten meer opnemen
Op mijn wekker.
3
Missie geslaagd.
dany@pindabook:~$ sudo apt purge git-lfs python3-venv
[sudo] wachtwoord voor root:
Pakketlijsten worden ingelezen... Klaar
Boom van vereisten wordt opgebouwd... Klaar
De statusinformatie wordt gelezen... Klaar
De volgende pakketten zullen VERWIJDERD worden:
git-lfs* python3-venv*
0 opgewaardeerd, 0 nieuw geïnstalleerd, 2 te verwijderen en 0 niet opgewaardeerd.
Na deze bewerking zal er 18,1 MB schijfruimte vrijkomen.
Wilt u doorgaan? [J/n]
(Database wordt ingelezen ... 174057 bestanden en mappen momenteel geïnstalleerd.)
git-lfs (3.6.1) wordt verwijderd ...
System Git LFS configuration has been removed.
python3-venv (3.11.2-1+b1) wordt verwijderd ...
Bezig met afhandelen van triggers voor man-db (2.11.2-2) ...
dany@pindabook:~$ sudo apt autoremove
Pakketlijsten worden ingelezen... Klaar
Boom van vereisten wordt opgebouwd... Klaar
De statusinformatie wordt gelezen... Klaar
0 opgewaardeerd, 0 nieuw geïnstalleerd, 0 te verwijderen en 0 niet opgewaardeerd.
dany@pindabook:~$ sudo rm -r srttranslate/
dany@pindabook:~$ rm -r .cache/huggingface/
dany@pindabook:~$ rm Downloads/translated_subtitles.srt Vanilla\ Sky.en.srt