vineelpratap commited on
Commit
4cba436
1 Parent(s): cbf5820

Update zeroshot.py

Browse files
Files changed (1) hide show
  1. zeroshot.py +9 -3
zeroshot.py CHANGED
@@ -133,12 +133,16 @@ def process(
133
  # print("after uroman")
134
  # print("len lexicon", len(lexicon))
135
  with tempfile.NamedTemporaryFile() as lexicon_file:
136
-
 
 
 
 
137
  with open(lexicon_file.name, "w") as f:
138
  idx = 10
139
  for word, spelling in lexicon.items():
140
  f.write(word + " " + spelling + "\n")
141
- if idx % 100 == 0:
142
  print(word, spelling, flush=True)
143
  idx += 1
144
 
@@ -150,11 +154,13 @@ def process(
150
  )
151
  if lmscore_usedefault:
152
  lmscore = LM_SCORE_DEFAULT if lm_path is not None else 0
 
 
153
 
154
  beam_search_decoder = ctc_decoder(
155
  lexicon=lexicon_file.name,
156
  tokens=token_file,
157
- lm=None,
158
  nbest=1,
159
  beam_size=500,
160
  beam_size_token=50,
 
133
  # print("after uroman")
134
  # print("len lexicon", len(lexicon))
135
  with tempfile.NamedTemporaryFile() as lexicon_file:
136
+ print("lm_path before", lm_path)
137
+ if lm_path is not None and not lm_path.strip():
138
+ lm_path = None
139
+ print("lm_path after", lm_path)
140
+
141
  with open(lexicon_file.name, "w") as f:
142
  idx = 10
143
  for word, spelling in lexicon.items():
144
  f.write(word + " " + spelling + "\n")
145
+ if idx % 250 == 0:
146
  print(word, spelling, flush=True)
147
  idx += 1
148
 
 
154
  )
155
  if lmscore_usedefault:
156
  lmscore = LM_SCORE_DEFAULT if lm_path is not None else 0
157
+ print("using word score", wscore)
158
+ print("using lm score", lmscore)
159
 
160
  beam_search_decoder = ctc_decoder(
161
  lexicon=lexicon_file.name,
162
  tokens=token_file,
163
+ lm=lm_path,
164
  nbest=1,
165
  beam_size=500,
166
  beam_size_token=50,