dh-mc commited on
Commit
1bdff66
1 Parent(s): e5461bc

new mistral results analyzed

Browse files
llm_toolkit/translation_utils.py CHANGED
@@ -216,12 +216,18 @@ def get_metrics(df, max_output_tokens=2048):
216
  repetition_score.append(df["repetition_score"].mean())
217
  total_repetitions.append(df["total_repetitions"].mean())
218
 
219
- df["output_tokens"] = df[col].apply(
220
- lambda x: len(tokenizers[col.split("/rpp")[0]](x)["input_ids"])
 
 
 
221
  )
222
 
 
 
 
223
  num_entries_with_max_output_tokens.append(
224
- count_entries_with_max_tokens(df["output_tokens"], max_output_tokens)
225
  )
226
 
227
  metrics_df["meteor"] = meteor
@@ -230,9 +236,13 @@ def get_metrics(df, max_output_tokens=2048):
230
  metrics_df["ews_score"] = ews_score
231
  metrics_df["repetition_score"] = repetition_score
232
  metrics_df["total_repetitions"] = total_repetitions
233
- metrics_df[
234
- "num_entries_with_max_output_tokens"
235
- ] = num_entries_with_max_output_tokens
 
 
 
 
236
 
237
  return metrics_df
238
 
 
216
  repetition_score.append(df["repetition_score"].mean())
217
  total_repetitions.append(df["total_repetitions"].mean())
218
 
219
+ model = col.split("/rpp")[0]
220
+
221
+ new_col = f"ground_truth_tokens-{model}"
222
+ df[new_col] = df["english"].apply(
223
+ lambda x: len(tokenizers[model](x)["input_ids"])
224
  )
225
 
226
+ new_col = f"output_tokens-{model}"
227
+ df[new_col] = df[col].apply(lambda x: len(tokenizers[model](x)["input_ids"]))
228
+
229
  num_entries_with_max_output_tokens.append(
230
+ count_entries_with_max_tokens(df[new_col], max_output_tokens)
231
  )
232
 
233
  metrics_df["meteor"] = meteor
 
236
  metrics_df["ews_score"] = ews_score
237
  metrics_df["repetition_score"] = repetition_score
238
  metrics_df["total_repetitions"] = total_repetitions
239
+ metrics_df["num_entries_with_max_output_tokens"] = (
240
+ num_entries_with_max_output_tokens
241
+ )
242
+
243
+ metrics_df["rap"] = metrics_df.apply(
244
+ lambda x: x["meteor"] / math.log10(10 + x["total_repetitions"]), axis=1
245
+ )
246
 
247
  return metrics_df
248
 
notebooks/00_Data Analysis.ipynb CHANGED
The diff for this file is too large to render. See raw diff