-
Notifications
You must be signed in to change notification settings - Fork 119
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
fix compat breaking: revive workaround padding in decode() #867
Merged
Yosshi999
merged 17 commits into
VOICEVOX:main
from
Yosshi999:revive_workaround_padding
Nov 20, 2024
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9daeb90
fix compat breaking: revive workaround padding in decode()
Yosshi999 d1be041
Revert "fix compat breaking: revive workaround padding in decode()"
Yosshi999 eb26303
move padding to generate_full_intermediate and margin to render_audio…
Yosshi999 0b8c9b5
fix lint
Yosshi999 2e6b018
change implementation and API
Yosshi999 101b3e7
apply suggestion, explicit panic in out of range rendering
Yosshi999 8a44a37
fix python lint
Yosshi999 a4e64db
fix rust lint
Yosshi999 7a4ad06
apply suggestion
Yosshi999 db7a3b6
refactoring
Yosshi999 510d16d
bugfix: modified stride is ignored in into_raw_vec
Yosshi999 9d1e656
doc: improve comments for margin and padding in synthesizer
Hiroshiba 88293ca
Merge pull request #1 from Hiroshiba/hiho-counter-pr-9d1e6566
Yosshi999 255a3ef
better readability
Yosshi999 ce545a9
panic / raise error in invalid range such as start > end
Yosshi999 6d45309
early return in render
Yosshi999 7c1d79c
raise valueerror in start > end
Yosshi999 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(細かいですが)
start>=0も確認した方が良さそう
あと原理上end>lengthを確認したならstart>lengthは自明そう?(なので処理が簡単になりそう)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#867 (comment)でも書きましたが、型的に無意味というかむしろそれを書いたらリンタが激怒すると思います。
(おそらく言語問わず)$\texttt{start} \leq \texttt{end}$ とは限らないと思います。
現状だと$\texttt{start} > \texttt{end}$ も、#867 (comment)の表の通り、 $\texttt{start}, \texttt{end} < \texttt{length}$ である限りは空の区間として受け取ることになるかなと。
ただ今考えたら、一貫性のために$\texttt{start} > \texttt{end}$ もついでに弾いておくという判断もありかもしれません。どうしましょうか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start > end
はRangeインスタンスの生成時に落ちるものと思ってたんですが、ドキュメントを見た感じそうでもなさそうですかね?バリデーションは積極的に通すみたいな方針にするというのをどこかで話した気がするのでこれもpanicさせましょうか
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そうですね。
Range
自体はただの二つの整数の組です。あと10..0
みたいなのも、Pythonのslice
じゃなくrange
的な使い方をする分には空のイテレータを返します。リンタには怒られますが。ですね。パニックにしちゃいましょう。パニックメッセージ的にはこう?
Python API側は
IndexError
じゃなくてValueError
にすればよさそう。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あ、30分前にコミットされてましたね。これでよさそう。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
今気付いたのですが、ONNX Runtimeに渡すのはマージン入れたやつでは?なので別に早期リターンは要らないのでは…?
あとこれ↓についてはいかがいたしましょう
#867 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
たしかに 無駄な処理を省けるという利点はあります
pythonでstart > endで落ちる例が思いつきません
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
むしろ普通のPythonではありえないからこそ、
IndexError
は避けた方がよいのではないかと思いました。ValueError
はJavaで言うIllegalArgumentException
だと理解しています。あとissubclass(IndexError, LookupError)
なので、AudioFeatureのlengthに関わらずstart > end
は不正ということで、ValueError
でいいんじゃないかなーと思った次第です。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なるほど、ValueErrorにします
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これについてですがRustの
[T]
ではが
slice index starts at 5000 but ends at 1000
というメッセージになる(i.e.range start index {i} out of range for slice of length {len}
やrange end index {i} out of range for slice of length {len}
よりも優先される)ので、それにならうという意味でもやった方がいいかなと思いました。