* add docker

* fix unit error > Type promotion

* fix url
pull/4011/head
张春乔 3 weeks ago committed by GitHub
parent f54df909d0
commit f8dc325256
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,17 @@
FROM registry.baidubce.com/paddlepaddle/paddle:3.0.0b1
LABEL maintainer="ext_paddle_oss@baidu.com"
RUN apt-get update \
&& apt-get install libsndfile-dev libsndfile1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 https://github.com/PaddlePaddle/PaddleSpeech.git /home/PaddleSpeech
RUN pip3 uninstall mccabe -y ; exit 0;
RUN pip3 install multiprocess==0.70.12 importlib-metadata==4.2.0 dill==0.3.4
WORKDIR /home/PaddleSpeech/
RUN python setup.py bdist_wheel
RUN pip install dist/*.whl -i https://pypi.tuna.tsinghua.edu.cn/simple
CMD ['bash']

@ -65,14 +65,16 @@ def reverse_pad_list_with_sos_eos(r_hyps,
max_len = paddle.max(r_hyps_lens)
index_range = paddle.arange(0, max_len, 1)
seq_len_expand = r_hyps_lens.unsqueeze(1)
seq_mask = seq_len_expand > index_range # (beam, max_len)
seq_mask = seq_len_expand > index_range.astype(
seq_len_expand.dtype) # (beam, max_len)
index = (seq_len_expand - 1) - index_range # (beam, max_len)
index = (seq_len_expand - 1) - index_range.astype(
seq_len_expand.dtype) # (beam, max_len)
# >>> index
# >>> tensor([[ 2, 1, 0],
# >>> [ 2, 1, 0],
# >>> [ 0, -1, -2]])
index = index * seq_mask
index = index * seq_mask.astype(index.dtype)
# >>> index
# >>> tensor([[2, 1, 0],
@ -103,7 +105,8 @@ def reverse_pad_list_with_sos_eos(r_hyps,
# >>> tensor([[3, 2, 1],
# >>> [4, 8, 9],
# >>> [2, 2, 2]])
r_hyps = paddle.where(seq_mask, r_hyps, eos)
r_hyps = paddle.where(seq_mask, r_hyps,
paddle.to_tensor(eos, dtype=r_hyps.dtype))
# >>> r_hyps
# >>> tensor([[3, 2, 1],
# >>> [4, 8, 9],

Loading…
Cancel
Save