Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
feat(labeler): allow user fixing the question
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed Oct 21, 2021
1 parent 7e4ef64 commit fcc801b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
9 changes: 7 additions & 2 deletions docs/components/labeler.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion finetuner/labeler/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<sidebar :labeler-config="labeler_config" :view-template="view_template" :tags="tags" :is-busy="is_busy"
:progress-stats="progress_stats" :positive-rate="positive_rate" :negative-rate="negative_rate"
:advanced-config="advanced_config" :save-progress="saveProgress"
:next-batch="next_batch" :ask-same="ask_same_question"></sidebar>
:next-batch="next_batch"></sidebar>
<div class="b-example-divider"></div>
<div class="flex-grow-1 p-1 overflow-hidden">
<div class="d-flex flex-column h-100">
Expand Down
5 changes: 2 additions & 3 deletions finetuner/labeler/ui/js/components/sidebar.vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const sidebar = {
advancedConfig: Object,
saveProgress: Function,
nextBatch: Function,
askSame: Function
},
template: `
<div class="d-flex flex-column flex-shrink-0 p-3 sidebar">
Expand Down Expand Up @@ -80,10 +79,10 @@ const sidebar = {
</div>
</div>
<div class="row my-1">
<label class="col-sm-6 col-form-label">Keep asking same</label>
<label class="col-sm-6 col-form-label">Keep same question</label>
<div class="col-sm-6 d-flex align-items-center justify-content-center">
<input class="form-check-input" type="checkbox"
v-model="labelerConfig.same_question" v-on:input="askSame()">
v-model="labelerConfig.same_question" v-on:input="nextBatch(true, false)">
</div>
</div>
<div class="row my-1">
Expand Down
9 changes: 3 additions & 6 deletions finetuner/labeler/ui/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fcc801b

Please sign in to comment.