Skip to content

Small modifications to enhance the baseline performance like dev EM = 75%#1

Merged
akeyhero merged 2 commits intomainfrom
fix-bugs-on-making-spans
Mar 1, 2022
Merged

Small modifications to enhance the baseline performance like dev EM = 75%#1
akeyhero merged 2 commits intomainfrom
fix-bugs-on-making-spans

Conversation

@akeyhero
Copy link
Owner

@akeyhero akeyhero commented Mar 1, 2022

Thank you for sharing the great Japanese dataset!

I would like to share my changes to make baseline performance better by 10%+ (in exact match).

Inference log:

  1/3939 | EM: 1.0000, F1: 1.0000
        (Sample) pred: "奈良", answer: "奈良"
Token indices sequence length is longer than the specified maximum sequence length for this model (538 > 512). Running this sequence through the model will result in indexing errors
  201/3939 | EM: 0.7861, F1: 0.8720
        (Sample) pred: "スティーブンズ・プリンター社", answer: "スティーブンズ・プリンター社"
  401/3939 | EM: 0.7781, F1: 0.8698
        (Sample) pred: "湿潤状態", answer: "湿潤状態"
  601/3939 | EM: 0.7604, F1: 0.8593
        (Sample) pred: "1881年", answer: "1881年"
  801/3939 | EM: 0.7491, F1: 0.8490
        (Sample) pred: "器具メーカー", answer: "光源メーカー"
  1001/3939 | EM: 0.7652, F1: 0.8555
        (Sample) pred: "Graduation", answer: "Graduation"
  1201/3939 | EM: 0.7619, F1: 0.8515
        (Sample) pred: "黒田孝高", answer: "黒田孝高"
  1401/3939 | EM: 0.7523, F1: 0.8445
        (Sample) pred: "煙害", answer: "煙害"
  1601/3939 | EM: 0.7552, F1: 0.8440
        (Sample) pred: "カルロス門", answer: "カルロス門"
  1801/3939 | EM: 0.7601, F1: 0.8479
        (Sample) pred: "「一心寮」", answer: "「一心寮」"
  2001/3939 | EM: 0.7651, F1: 0.8517
        (Sample) pred: "2015年7月18日", answer: "2015年7月18日"
  2201/3939 | EM: 0.7665, F1: 0.8517
        (Sample) pred: "SE車", answer: "SE車"
  2401/3939 | EM: 0.7668, F1: 0.8523
        (Sample) pred: "久原房之助", answer: "久原房之助"
  2601/3939 | EM: 0.7655, F1: 0.8507
        (Sample) pred: "1900年", answer: "地方議員"
  2801/3939 | EM: 0.7608, F1: 0.8491
        (Sample) pred: "藤山一郎", answer: "東海林太郎"
  3001/3939 | EM: 0.7614, F1: 0.8503
        (Sample) pred: "フィリップ・ファンデンベルク", answer: "フィリップ・ファンデンベルク"
  3201/3939 | EM: 0.7619, F1: 0.8500
        (Sample) pred: "大峯奥駈道", answer: "大峯奥駈道"
  3401/3939 | EM: 0.7601, F1: 0.8482
        (Sample) pred: "エラーヒューゼン", answer: "アルリック・エラーヒューゼン"
  3601/3939 | EM: 0.7540, F1: 0.8435
        (Sample) pred: "「道路標示黄色見本」", answer: "「道路標示黄色見本」"
  3801/3939 | EM: 0.7506, F1: 0.8402
        (Sample) pred: "『ヘントの祭壇画』", answer: "『ヘントの祭壇画』"
F1 score: 0.8404927719328006
Exact Match: 0.751967504442752

Performance by types:

スクリーンショット 2022-03-01 15 26 33

@akeyhero akeyhero force-pushed the fix-bugs-on-making-spans branch from 7941903 to 48ccd5a Compare March 1, 2022 05:34
" answer_start_index = ctx_start\n",
" answer_end_index = len(offsets) - 1\n",
" while offsets[answer_start_index][0] < start_char:\n",
" while offsets[answer_start_index][1] < start_char:\n",
Copy link
Owner Author

@akeyhero akeyhero Mar 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One may not like this change, but I prefer inclusive answer chunks.

e.g.:
Original answer: 九十分
Previous answer chunk: 九十
Proposed answer chunk: 九十分間

"\n",
" for i in range(0, input_len - max_seq_len + stride, stride):\n",
" step = max_seq_len - question_len - stride\n",
" for i in range(0, max(context_len - stride, step), step):\n",
Copy link
Owner Author

@akeyhero akeyhero Mar 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A stride is an overlapping token length in the Hugging Face manner.

" val += [padding] * pad_len\n",
" return val\n",
"\n",
" for i in range(0, input_len - max_seq_len + stride, stride):\n",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This range will be empty when input_len <= max_seq_len - stride

@akeyhero akeyhero changed the title Fix bugs and then improve performance like dev EM = 75% modify the notebook slightly and then improve performance like dev EM = 75% Mar 1, 2022
@akeyhero akeyhero changed the title modify the notebook slightly and then improve performance like dev EM = 75% Modify the notebook slightly and then improve performance like dev EM = 75% Mar 1, 2022
@akeyhero akeyhero changed the title Modify the notebook slightly and then improve performance like dev EM = 75% Small modifications and then improving performance like dev EM = 75% Mar 1, 2022
@akeyhero akeyhero changed the title Small modifications and then improving performance like dev EM = 75% Small modifications to improving performance like dev EM = 75% Mar 1, 2022
Comment on lines -488 to -489
" while offsets[answer_end_index][1] > start_char + len(answer):\n",
" answer_end_index -= 1\n",
Copy link
Owner Author

@akeyhero akeyhero Mar 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will get a smaller index number by 1 when the following token length is >= 2.

@akeyhero akeyhero changed the title Small modifications to improving performance like dev EM = 75% Small modifications to enhance the baseline performance like dev EM = 75% Mar 1, 2022
@akeyhero akeyhero merged commit d665090 into main Mar 1, 2022
@akeyhero akeyhero deleted the fix-bugs-on-making-spans branch March 1, 2022 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant