Skip to main content

The Huggingface wav2vec ASR incremental modules for the retico framework

Project description

retico-wav2vecasr

Local wav2vec ASR Module for ReTiCo

Installations and requirements

you can install the module via pip:

$ pip install retico-wav2vecasr

In order to access the ASR models, one of PyTorch, TensorFlow, or Flax need to be installed. For example, PyTorch can be installed via pip with:

$ pip install torch

Example

import retico_core
from retico_wav2vecasr import *
from retico_wav2vecasr.wav2vecasr import Wav2VecASRModule

msg = []


def callback(update_msg):
    global msg
    for x, ut in update_msg:
        if ut == retico_core.UpdateType.ADD:
            msg.append(x)
        if ut == retico_core.UpdateType.REVOKE:
            msg.remove(x)
    txt = ""
    committed = False
    for x in msg:
        txt += x.text + " "
        committed = committed or x.committed
    print(" " * 80, end="\r")
    print(f"{txt}", end="\r")
    if committed:
        msg = []
        print("")


microphone = retico_core.audio.MicrophoneModule()
asr = Wav2VecASRModule("en")


m3 = debug.CallbackModule(callback=callback)

microphone.subscribe(asr)
asr.subscribe(m3)

retico_core.network.run(asr)

print("Running the ASR. Press enter to exit")
input()

retico_core.network.stop(asr)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

retico-wav2vecasr-0.1.6.tar.gz (8.4 kB view details)

Uploaded Source

File details

Details for the file retico-wav2vecasr-0.1.6.tar.gz.

File metadata

  • Download URL: retico-wav2vecasr-0.1.6.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for retico-wav2vecasr-0.1.6.tar.gz
Algorithm Hash digest
SHA256 537814a4eebc8ed64d48e83c8c1cba5779c87bd306207284cfa1c2835c21c83a
MD5 6c82b62c9f3d8b1b788f232c5b0108a2
BLAKE2b-256 c505898aa65e7ea03590ebce88bde3880cfe06f3fbc31b3c495e9a8d408e0ba7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page