Skip to content

Commit

Permalink
fix: deprecate intialization from enums for from_sampling_strategy
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron <[email protected]>
  • Loading branch information
aarnphm committed Mar 16, 2023
1 parent 4b5580a commit 85d8548
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/whispercpp/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,16 @@ void ExportSamplingStrategiesApi(py::module &m) {
.def_static("from_strategy_type",
&SamplingStrategies::from_sampling_strategy,
"strategy_type"_a)
.def_static(
"from_strategy_type",
[](whisper_sampling_strategy *enum_) {
PyErr_WarnEx(PyExc_DeprecationWarning,
"'from_strategy_type' will not take an enum in "
"future release. Enum initialization should be "
"using 'from_enum' instead.",
1);
return SamplingStrategies::from_enum(enum_);
})
.def_static("from_enum", &SamplingStrategies::from_enum,
"strategy_enum"_a)
.def_property(
Expand Down

0 comments on commit 85d8548

Please sign in to comment.