Skip to content
Open
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 funasr_detach/auto/auto_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

try:
from funasr_detach.models.campplus.cluster_backend import ClusterBackend
except:
except ImportError:
print("If you want to use the speaker diarization, please `pip install hdbscan`")


Expand Down
4 changes: 2 additions & 2 deletions funasr_detach/datasets/audio_datasets/index_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, path):
try:
rank = dist.get_rank()
world_size = dist.get_world_size()
except:
except RuntimeError:
rank = 0
world_size = 1
logging.warning("distributed is not initialized, only single shard")
Expand All @@ -65,7 +65,7 @@ def __len__(self):
def __getitem__(self, index):
try:
data = self.contents[index]
except:
except (IndexError, KeyError):
print(index)
return data

Expand Down
2 changes: 1 addition & 1 deletion funasr_detach/models/bicif_paraformer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def inference(

# init beamsearch
is_use_ctc = (
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc is not None
)
is_use_lm = (
kwargs.get("lm_weight", 0.0) > 0.00001
Expand Down
2 changes: 1 addition & 1 deletion funasr_detach/models/contextual_paraformer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def inference(
):
# init beamsearch
is_use_ctc = (
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc is not None
)
is_use_lm = (
kwargs.get("lm_weight", 0.0) > 0.00001
Expand Down
4 changes: 2 additions & 2 deletions funasr_detach/models/paraformer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def init_beam_search(
# 1. Build ASR model
scorers = {}

if self.ctc != None:
if self.ctc is not None:
ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos)
scorers.update(ctc=ctc)
token_list = kwargs.get("token_list")
Expand Down Expand Up @@ -466,7 +466,7 @@ def inference(
):
# init beamsearch
is_use_ctc = (
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc is not None
)
is_use_lm = (
kwargs.get("lm_weight", 0.0) > 0.00001
Expand Down
2 changes: 1 addition & 1 deletion funasr_detach/models/paraformer_streaming/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def inference(

# init beamsearch
is_use_ctc = (
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc is not None
)
is_use_lm = (
kwargs.get("lm_weight", 0.0) > 0.00001
Expand Down
4 changes: 2 additions & 2 deletions funasr_detach/models/scama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def init_beam_search(
# 1. Build ASR model
scorers = {}

if self.ctc != None:
if self.ctc is not None:
ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos)
scorers.update(ctc=ctc)
token_list = kwargs.get("token_list")
Expand Down Expand Up @@ -673,7 +673,7 @@ def inference(

# init beamsearch
is_use_ctc = (
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc is not None
)
is_use_lm = (
kwargs.get("lm_weight", 0.0) > 0.00001
Expand Down
2 changes: 1 addition & 1 deletion funasr_detach/models/seaco_paraformer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def inference(

# init beamsearch
is_use_ctc = (
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc is not None
)
is_use_lm = (
kwargs.get("lm_weight", 0.0) > 0.00001
Expand Down
4 changes: 2 additions & 2 deletions funasr_detach/models/transducer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def init_beam_search(
# 1. Build ASR model
scorers = {}

if self.ctc != None:
if self.ctc is not None:
ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos)
scorers.update(ctc=ctc)
token_list = kwargs.get("token_list")
Expand Down Expand Up @@ -465,7 +465,7 @@ def inference(

# init beamsearch
is_use_ctc = (
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc != None
kwargs.get("decoding_ctc_weight", 0.0) > 0.00001 and self.ctc is not None
)
is_use_lm = (
kwargs.get("lm_weight", 0.0) > 0.00001
Expand Down
2 changes: 1 addition & 1 deletion funasr_detach/models/transformer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def init_beam_search(
# 1. Build ASR model
scorers = {}

if self.ctc != None:
if self.ctc is not None:
ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos)
scorers.update(ctc=ctc)
token_list = kwargs.get("token_list")
Expand Down
2 changes: 1 addition & 1 deletion funasr_detach/models/uniasr/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ def init_beam_search(
# 1. Build ASR model
scorers = {}

if self.ctc != None:
if self.ctc is not None:
ctc = CTCPrefixScorer(ctc=self.ctc, eos=self.eos)
scorers.update(ctc=ctc)
token_list = kwargs.get("token_list")
Expand Down