Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleChenCc committed Nov 30, 2021
1 parent e867f3b commit d2fab32
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions paddlespeech/s2t/frontend/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ def read_manifest(
manifest = []
with jsonlines.open(manifest_path, 'r') as reader:
for json_data in reader:
feat_len = json_data["feat_shape"][
0] if 'feat_shape' in json_data else 1.0
token_len = json_data["token_shape"][
0] if 'token_shape' in json_data else 1.0
feat_len = json_data["input"][0]["shape"][
0] if 'shape' in json_data["input"][0] else 1.0
token_len = json_data["output"][0]["shape"][
0] if 'shape' in json_data["output"][0] else 1.0
conditions = [
feat_len >= min_input_len,
feat_len <= max_input_len,
Expand Down
2 changes: 1 addition & 1 deletion paddlespeech/s2t/io/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _batch_shuffle(indices, batch_size, epoch, clipped=False):
"""
rng = np.random.RandomState(epoch)
shift_len = rng.randint(0, batch_size - 1)
batch_indices = list(zip(* [iter(indices[shift_len:])] * batch_size))
batch_indices = list(zip(*[iter(indices[shift_len:])] * batch_size))
rng.shuffle(batch_indices)
batch_indices = [item for batch in batch_indices for item in batch]
assert clipped is False
Expand Down
3 changes: 3 additions & 0 deletions paddlespeech/s2t/utils/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def load_parameters(self,
"""
configs = {}

if len(checkpoint_path) == 0 or checkpoint_path == "None":
checkpoint_path = None

if checkpoint_path is not None:
pass
elif checkpoint_dir is not None and record_file is not None:
Expand Down

0 comments on commit d2fab32

Please sign in to comment.