Browse Source
init the operator.
Signed-off-by: wxywb <xy.wang@zilliz.com>
main
wxywb
3 years ago
2 changed files with
3 additions and
2 deletions
-
data2vec_audio.py
-
requirements.txt
|
@ -22,8 +22,8 @@ from towhee.operator.base import NNOperator |
|
|
|
|
|
|
|
|
class Data2VecAudio(NNOperator): |
|
|
class Data2VecAudio(NNOperator): |
|
|
def __init__(self, model_name = "facebook/data2vec-audio-base-960h"): |
|
|
def __init__(self, model_name = "facebook/data2vec-audio-base-960h"): |
|
|
self.model = Data2VecAudioModel.from_pretrained("facebook/data2vec-audio-base-960h") |
|
|
|
|
|
self.processor = Wav2Vec2Processor.from_pretrained("facebook/data2vec-audio-base-960h") |
|
|
|
|
|
|
|
|
self.model = Data2VecAudioModel.from_pretrained(model_name) |
|
|
|
|
|
self.processor = Wav2Vec2Processor.from_pretrained(model_name) |
|
|
|
|
|
|
|
|
def __call__(self, data): |
|
|
def __call__(self, data): |
|
|
audio = np.hstack(data).reshape(1, -1) |
|
|
audio = np.hstack(data).reshape(1, -1) |
|
|
|
@ -0,0 +1 @@ |
|
|
|
|
|
transformers>=4.18.0 |