From fcc801b62c9ffa31e310fdfbfdb4c674be42401e Mon Sep 17 00:00:00 2001 From: Han Xiao Date: Thu, 21 Oct 2021 23:07:48 +0200 Subject: [PATCH] feat(labeler): allow user fixing the question --- docs/components/labeler.md | 9 +++++++-- finetuner/labeler/ui/index.html | 2 +- finetuner/labeler/ui/js/components/sidebar.vue.js | 5 ++--- finetuner/labeler/ui/js/main.js | 9 +++------ 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/components/labeler.md b/docs/components/labeler.md index 84b2ba3cd..58cdaba04 100644 --- a/docs/components/labeler.md +++ b/docs/components/labeler.md @@ -116,8 +116,10 @@ The view section collects the configs determining how frontend renders the quest - `Field`: represents the field of `Document` your question data come from. - `Tags Key`: when you select `Field` as `.tags`, this textbox will show up, asking you to further specify which `.tags` key your question data comes from. - `Content Type`: you need to select the right content type to have the correct rendering on the the question data. -- `Examples/View`: The maximum number of labeling examples on the frontend. -- `TopK/Examples`: The maximum number of results for each example on the frontend. +- `Questions/session`: The maximum number of labeling examples on the frontend. +- `TopK/Question`: The maximum number of results for each example on the frontend. +- `Start question`: The starting index of the question +- `Keep same question`: If set, then `Start question` and `Questions/session` are locked. You will always get the same questions for labeling. ````{tip} If your question panel looks like the image below, this means rendering is not setup correctly. You need to change `Field`, `Content Type` and `Tags Key` to correct the render setup. @@ -129,6 +131,9 @@ If your question panel looks like the image below, this means rendering is not s ```` +```{tip} +You can use `Keep same question` to debug your model: by fixing the query and observing how the model behaves after learning from your new labels. +``` #### Progress diff --git a/finetuner/labeler/ui/index.html b/finetuner/labeler/ui/index.html index 45f04f825..e78c7864d 100644 --- a/finetuner/labeler/ui/index.html +++ b/finetuner/labeler/ui/index.html @@ -23,7 +23,7 @@ + :next-batch="next_batch">
diff --git a/finetuner/labeler/ui/js/components/sidebar.vue.js b/finetuner/labeler/ui/js/components/sidebar.vue.js index 71153f750..1ed892d41 100644 --- a/finetuner/labeler/ui/js/components/sidebar.vue.js +++ b/finetuner/labeler/ui/js/components/sidebar.vue.js @@ -10,7 +10,6 @@ const sidebar = { advancedConfig: Object, saveProgress: Function, nextBatch: Function, - askSame: Function }, template: `
- +
+ v-model="labelerConfig.same_question" v-on:input="nextBatch(true, false)">
diff --git a/finetuner/labeler/ui/js/main.js b/finetuner/labeler/ui/js/main.js index 87a5ae28e..550ee8e66 100644 --- a/finetuner/labeler/ui/js/main.js +++ b/finetuner/labeler/ui/js/main.js @@ -160,16 +160,13 @@ const app = new Vue({ return doc.tags[app.labeler_config.tags] } }, - ask_same_question: function () { - app.labeler_config.example_per_view = 1 - app.next_batch(true, false) - }, next_batch: function (clear_exist=true, update_start_idx=true) { if (clear_exist) { app.cur_batch = [] } - let end_idx = app.labeler_config.start_idx + (app.labeler_config.example_per_view - app.cur_batch.length) - if (end_idx < app.labeler_config.start_idx) { + let new_examples_to_query = Math.max(0, app.labeler_config.example_per_view - app.cur_batch.length) + let end_idx = app.labeler_config.start_idx + new_examples_to_query + if (end_idx <= app.labeler_config.start_idx) { return } app.is_busy = true