Python начать моделированиеPython

Программы на Python
Ответить Пред. темаСлед. тема
Гость
 Python начать моделирование

Сообщение Гость »


Добрый день, у меня проблемы с обучением ИИ. Я украл весь код из одного видео и пытаюсь сделать его лучше.
вот код:

Код: Выделить всё

import torch
import sounddevice as sd
import speech_recognition as sr
import time
import numpy
from glob import glob

device = torch.device('cpu')
model, decoder, utils = torch.hub.load(repo_or_dir='snakers4/silero-models',
model='silero_stt',
language='ua',
device=device)
(read_batch, split_into_batches,
read_audio, prepare_model_input) = utils

def callback(_r, audio):
try:

print("Распознание ...")

with open('speech.wav', 'wb') as f:
f.write(audio.get_wav_data())

test_files = glob('speech.wav')
batches = split_into_batches(test_files, batch_size=10)
input = prepare_model_input(read_batch(batches[0]),
device=device)

output = model(input)
for example in output:
print(decoder(example.cpu()))

except sr.UnknownValueError:
print("[log] Голос не распознан!")

r = sr.Recognizer()
r.pause_threshold = 0.5
m = sr.Microphone(device_index=1)

with m as source:
r.adjust_for_ambient_noise(source)

stop_listening = r.listen_in_background(m, callback)
while True: time.sleep(0.1)
and in console i see that:

Код: Выделить всё

Warning (from warnings module):
File "C:\Users\Ukraine\AppData\Roaming\Python\Python311\site-packages\torch\hub.py", line 294
warnings.warn(
UserWarning: You are about to download and run code from an untrusted repository. In a future release, this won't be allowed. To add the repository to your trusted list, change the command to {calling_fn}(..., trust_repo=False) and a command prompt will appear asking for an explicit confirmation of trust, or load(..., trust_repo=True), which will assume that the prompt is to be answered with 'yes'. You can also use load(..., trust_repo='check') which will only prompt for confirmation if the repo is not already trusted. This will eventually be the default behaviour
Downloading: "https://github.com/snakers4/silero-models/zipball/master" to C:\Users\Ukraine/.cache\torch\hub\master.zip

0.0%
0.0%
0.0%
0.0%
0.0%
0.1%
0.1%
0.1%
0.1%
0.1%
0.1%
0.1%
0.1%
0.1%
0.1%
0.1%
0.2%
0.2%
... and more, more, more...

30.3%
30.3%
30.3%
Traceback (most recent call last):
File "C:\Users\Ukraine\Documents\pyProjects\ayko\_stt.py", line 9, in 
model, decoder, utils = torch.hub.load(repo_or_dir='snakers4/silero-models',
File "C:\Users\Ukraine\AppData\Roaming\Python\Python311\site-packages\torch\hub.py", line 566, in load
model = _load_local(repo_or_dir, model, *args, **kwargs)
File "C:\Users\Ukraine\AppData\Roaming\Python\Python311\site-packages\torch\hub.py", line 595, in _load_local
model = entry(*args, **kwargs)
File "C:\Users\Ukraine/.cache\torch\hub\snakers4_silero-models_master\src\silero\silero.py", line 33, in silero_stt
model, decoder = init_jit_model(model_url=models.stt_models.get(language).get(version).get(jit_model),
File "C:\Users\Ukraine/.cache\torch\hub\snakers4_silero-models_master\src\silero\utils.py", line 130, in init_jit_model
model = torch.jit.load(model_path, map_location=device)
File "C:\Users\Ukraine\AppData\Roaming\Python\Python311\site-packages\torch\jit\_serialization.py", line 159, in load
cpp_module = torch._C.import_ir_module(cu, str(f), map_location, _extra_files, _restore_shapes)  # type: ignore[call-arg]
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
Troubles in

Код: Выделить всё

C:\Users\Ukraine\.cache\torch\hub\snakers4_silero-models_master
and i read that i need to remove this folder for dissaperence this trouble, but i did it 3 time and alway i have trouble in 30%. I connected to Ethernet Port, have models ets.


Источник: https://stackoverflow.com/questions/781 ... t-modeling
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Ошибка реакции-native-vision-camera при попытке начать запись «захват/неизвестно» при попытке начать запись видео
    Anonymous » » в форуме Android
    0 Ответы
    146 Просмотры
    Последнее сообщение Anonymous
  • Ребята, я хочу начать программировать на C# и не хочу использовать Chatgpt, с чего мне начать? [закрыто]
    Anonymous » » в форуме C#
    0 Ответы
    35 Просмотры
    Последнее сообщение Anonymous
  • Прогнозное моделирование лечения ВИЧ/СПИДа в Python — выбор функций
    Гость » » в форуме Python
    0 Ответы
    19 Просмотры
    Последнее сообщение Гость
  • Моделирование логической схемы в Python
    Anonymous » » в форуме Python
    0 Ответы
    21 Просмотры
    Последнее сообщение Anonymous
  • Моделирование рулетки на Python
    Anonymous » » в форуме Python
    0 Ответы
    13 Просмотры
    Последнее сообщение Anonymous

Вернуться в «Python»