Skip to content
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

【Hackathon 8th No.7】Python版本适配 3 #3969

Merged
merged 6 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/other/g2p/get_g2p_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_baker_data(root_dir):
alignment_fp, includeEmptyIntervals=True)
# only with baker's annotation
utt_id = alignment.tierNameList[0].split(".")[0]
intervals = alignment.tierDict[alignment.tierNameList[0]].entryList
intervals = alignment.getTier(alignment.tierNameList[0]).entries
phones = []
for interval in intervals:
label = interval.label
Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/server/restful/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TTSRequest(BaseModel):
speed: float = 1.0
volume: float = 1.0
sample_rate: int = 0
save_path: str = None
save_path: Optional[str] = None


#****************************************************************************************/
Expand Down
3 changes: 2 additions & 1 deletion paddlespeech/server/restful/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import List
from typing import Optional

from pydantic import BaseModel

Expand Down Expand Up @@ -62,7 +63,7 @@ class TTSResult(BaseModel):
volume: float = 1.0
sample_rate: int
duration: float
save_path: str = None
save_path: Optional[str] = None
audio: str


Expand Down
4 changes: 2 additions & 2 deletions paddlespeech/t2s/exps/ernie_sat/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ def _readtg(tg_path: str, lang: str='en', fs: int=24000, n_shift: int=300):
ends = []
words = []

for interval in alignment.tierDict['words'].entryList:
for interval in alignment.getTier('words').entries:
word = interval.label
if word:
words.append(word)
for interval in alignment.tierDict['phones'].entryList:
for interval in alignment.getTier('phones').entries:
phone = interval.label
phones.append(phone)
ends.append(interval.end)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
"paddleslim>=2.3.4",
"ppdiffusers>=0.9.0",
"paddlespeech_feat",
"praatio>=5.0.0, <=5.1.1",
"praatio>=6.0.0",
"prettytable",
"pydantic>=1.10.14, <2.0",
"pydantic",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check #3715 whether work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix with Optional[str]

"pypinyin<=0.44.0",
"pypinyin-dict",
"python-dateutil",
Expand Down
2 changes: 1 addition & 1 deletion utils/gen_duration_from_textgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def readtg(tg_path, sample_rate=24000, n_shift=300):
alignment = textgrid.openTextgrid(tg_path, includeEmptyIntervals=True)
phones = []
ends = []
for interval in alignment.tierDict["phones"].entryList:
for interval in alignment.getTier("phones").entries:
phone = interval.label
phones.append(phone)
ends.append(interval.end)
Expand Down