New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example on README doesn't work #8
Comments
I came accross the same problem. import rx
import rx.operators as ops And there is a typo: |
Hey @KannebTo: Thanks. I renamed |
Hello, thank you for reporting these typos. As for the |
Hey @abhinavkulkarni , just leave |
Hey @KannebTo, Here's the error I get after renaming >>> import rx
>>> import rx.operators as ops
>>> from sources import MicrophoneAudioSource
/home/user/miniconda3/envs/diarization/lib/python3.8/site-packages/torchaudio/backend/utils.py:46: UserWarning: "torchaudio.USE_SOUNDFILE_LEGACY_INTERFACE" flag is deprecated and will be removed in 0.9.0. Please remove the use of flag.
warnings.warn(
>>> from functional import FrameWiseModel, ChunkWiseModel, OverlappedSpeechPenalty, EmbeddingNormalization
>>>
>>> mic = MicrophoneAudioSource(sample_rate=16000)
>>>
>>> # Initialize independent modules
... segmentation = FrameWiseModel("pyannote/segmentation")
>>> embedding = ChunkWiseModel("pyannote/embedding")
>>> ops = OverlappedSpeechPenalty(gamma=3, beta=10)
>>> normalization = EmbeddingNormalization(norm=1)
>>>
>>> # Branch the microphone stream to calculate segmentation
... segmentation_stream = mic.stream.pipe(ops.map(segmentation))
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
AttributeError: 'OverlappedSpeechPenalty' object has no attribute 'map'
>>> # Join audio and segmentation stream to calculate speaker embeddings
... embedding_stream = rx.zip(mic.stream, segmentation_stream).pipe(
... ops.starmap(lambda wave, seg: (wave, osp(seg))),
... ops.starmap(embedding),
... ops.map(normalization)
... )
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
NameError: name 'segmentation_stream' is not defined
>>>
>>> embedding_stream.suscribe(on_next=lambda emb: print(emb.shape))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'embedding_stream' is not defined
>>>
>>> mic.read() I am running this from the |
|
from sources import MicrophoneAudioSource
from functional import FrameWiseModel, ChunkWiseModel, OverlappedSpeechPenalty, EmbeddingNormalization
import rx
import rx.operators as ops
mic = MicrophoneAudioSource(sample_rate=16000)
# Initialize independent modules
segmentation = FrameWiseModel("pyannote/segmentation")
embedding = ChunkWiseModel("pyannote/embedding")
osp = OverlappedSpeechPenalty(gamma=3, beta=10)
normalization = EmbeddingNormalization(norm=1)
# Branch the microphone stream to calculate segmentation
segmentation_stream = mic.stream.pipe(ops.map(segmentation))
# Join audio and segmentation stream to calculate speaker embeddings
embedding_stream = rx.zip(mic.stream, segmentation_stream).pipe(
ops.starmap(lambda wave, seg: (wave, osp(seg))),
ops.starmap(embedding),
ops.map(normalization)
)
embedding_stream.subscribe(on_next=lambda emb: print(emb.shape))
mic.read() |
This should be fixed now. |
Thanks, it works! |
Thanks! Yes it works with the But i have another issue with the audio access, probably due to my audio setup:
This is strange because I'm running this in a Docker container and I also use the |
@KannebTo would you mind creating a separate issue for this? Thanks! |
Hi,
The following example on top level README doesn't work:
First of all there is a type in declaring variable
ops
(it's been declared asosp
).Secondly, in line
segmentation_stream = mic.stream.pipe(ops.map(segmentation))
, there is no method namedmap
in variableops
.Thanks!
The text was updated successfully, but these errors were encountered: