From a6c0b96eff7a2db94d682147a08595072d80c4c0 Mon Sep 17 00:00:00 2001 From: meganung Date: Fri, 29 Oct 2021 05:49:24 -0700 Subject: [PATCH 01/10] annotation_buckets param to annotations_config_path to match mc --- .../hydra_configs/conf/example.yaml | 4 ++-- .../tasks/turn_annotations_static/run.py | 5 +++++ .../turn_annotations_blueprint.py | 11 ++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml b/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml index df3605759d7..2f8f42fad10 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml @@ -7,11 +7,11 @@ mephisto: blueprint: subtasks_per_unit: 6 task_source: ${task_dir}/webapp/build/bundle.js - data_jsonl: FIXME_TASK_DATA_PATH + data_jsonl: ${task_dir}/task_config/onboarding_in_flight.jsonl extra_source_dir: ${task_dir}/webapp/src/static units_per_assignment: 5 onboarding_qualification: turn_annotations_static - annotation_buckets: ${task_dir}/task_config/annotation_buckets.json + annotations_config_path: ${task_dir}/task_config/annotation_buckets.json response_field: False task: allowed_concurrent: 1 diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/run.py b/parlai/crowdsourcing/tasks/turn_annotations_static/run.py index 102bf632667..d588274b39a 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/run.py +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/run.py @@ -12,10 +12,15 @@ from mephisto.operations.hydra_config import register_script_config from omegaconf import DictConfig +from parlai.crowdsourcing.tasks.turn_annotations_static.turn_annotations_blueprint import ( + STATIC_BLUEPRINT_TYPE, +) from parlai.crowdsourcing.tasks.turn_annotations_static.util import run_static_task from parlai.crowdsourcing.utils.mturk import MTurkRunScriptConfig +_ = STATIC_BLUEPRINT_TYPE + TASK_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) # To run the task with your own config outside this folder (recommended!) diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py b/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py index 9b3f387d7ca..d5b7c2832dc 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py @@ -84,10 +84,11 @@ class TurnAnnotationsStaticBlueprintArgs(StaticReactBlueprintArgs): "help": "Path to data and answers for onboarding task in JSON format" }, ) - annotation_buckets: Optional[str] = field( - default=None, + annotations_config_path: str = field( + default="", metadata={ - "help": "As per Turn Annotations task, path to annotation buckets which will be checkboxes in the frontend for worker to annotate an utterance. If none provided, no checkboxes." + "help": "As per Turn Annotations task, path to annotation buckets which will be checkboxes in the frontend for worker to annotate an utterance. Set to " + " to disable checkboxes." }, ) response_field: bool = field( @@ -188,9 +189,9 @@ def get_frontend_args(self) -> Dict[str, Any]: onboarding_data = json.loads(f.read()) annotation_buckets = None - if self.args.blueprint.annotation_buckets: + if self.args.blueprint.get('annotations_config_path', ''): with open( - self.args.blueprint.annotation_buckets, "r", encoding="utf-8-sig" + self.args.blueprint.annotations_config_path, "r", encoding="utf-8-sig" ) as f: annotation_buckets = json.loads(f.read()) From 8979efe1e400d57d8c7176d28ffdf16647301601 Mon Sep 17 00:00:00 2001 From: meganung Date: Tue, 2 Nov 2021 14:05:21 -0700 Subject: [PATCH 02/10] unify the annotation buckets config file format in model chat and turn annotations static task --- .../frontend/components/checkboxes.jsx | 6 +-- .../frontend/components/message.jsx | 2 +- .../components/onboarding_components.jsx | 2 +- .../task_config/annotations_config.json | 54 ++++++++----------- .../tasks/turn_annotations_static/README.md | 2 +- .../analysis/compile_results.py | 2 +- .../hydra_configs/conf/example.yaml | 2 +- .../task_config/annotation_buckets.json | 24 --------- .../webapp/src/components/checkboxes.jsx | 11 +++- 9 files changed, 41 insertions(+), 64 deletions(-) delete mode 100644 parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotation_buckets.json diff --git a/parlai/crowdsourcing/tasks/model_chat/frontend/components/checkboxes.jsx b/parlai/crowdsourcing/tasks/model_chat/frontend/components/checkboxes.jsx index 745473ae513..6b56e8ddb72 100644 --- a/parlai/crowdsourcing/tasks/model_chat/frontend/components/checkboxes.jsx +++ b/parlai/crowdsourcing/tasks/model_chat/frontend/components/checkboxes.jsx @@ -32,7 +32,7 @@ function Checkboxes({ return (
{ - Object.keys(annotationBuckets).map(c => ( + Object.keys(annotationBuckets.config).map(c => ( { let newVal = evt.target.checked; let oldAnnotations = Object.assign({}, annotations); - oldAnnotations[annotationBuckets[c].value] = newVal; + oldAnnotations[c] = newVal; onUpdateAnnotations(oldAnnotations); }} disabled={!enabled} /> - {annotationBuckets[c].name} + {annotationBuckets.config[c].name} )) diff --git a/parlai/crowdsourcing/tasks/model_chat/frontend/components/message.jsx b/parlai/crowdsourcing/tasks/model_chat/frontend/components/message.jsx index 064bd8b5ad7..fc37d9a6860 100644 --- a/parlai/crowdsourcing/tasks/model_chat/frontend/components/message.jsx +++ b/parlai/crowdsourcing/tasks/model_chat/frontend/components/message.jsx @@ -44,7 +44,7 @@ function RenderChatMessage({ message, mephistoContext, appContext, idx }) { let thisBoxAnnotations = checkboxValues[idx]; if (!thisBoxAnnotations) { thisBoxAnnotations = Object.fromEntries( - annotationBuckets.map(bucket => [bucket.value, false]) + Object.keys(annotationBuckets.config).map(bucket => [bucket, false]) ) } checkboxes =
diff --git a/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx b/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx index c704df71d29..f197bcf33b5 100644 --- a/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx +++ b/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx @@ -127,7 +127,7 @@ function OnboardingComponent({ onboardingData, annotationBuckets, annotationQues } else { const [currentTurnAnnotations, setCurrentAnnotations] = React.useState( Array.from(Array(onboardingData.dialog.length), () => Object.fromEntries( - annotationBuckets.map(bucket => [bucket.value, false])) + Object.keys(annotationBuckets.config).map(bucket => [bucket, false])) ) ); return ( diff --git a/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json b/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json index d933db83e2f..7802e65a393 100644 --- a/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json +++ b/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json @@ -1,32 +1,24 @@ -[ - { - "value": "bucket_0", - "name": "Bucket 0", - "description": "this response implies something...0" - }, - { - "value": "bucket_1", - "name": "Bucket 1", - "description": "this response implies something...1" - }, - { - "value": "bucket_2", - "name": "Bucket 2", - "description": "this response implies something...2" - }, - { - "value": "bucket_3", - "name": "Bucket 3", - "description": "this response implies something...3" - }, - { - "value": "bucket_4", - "name": "Bucket 4", - "description": "this response implies something...4" - }, - { - "value": "none_all_good", - "name": "None, all good", - "description": "This response implies that there are no problems with the data" +{ + "config": { + "bucket_0": { + "name": "Bucket 0", + "description": "this response implies something...0" + }, + "bucket_1": { + "name": "Bucket 1", + "description": "this response implies something...1" + }, + "bucket_2": { + "name": "Bucket 2", + "description": "this response implies something...2" + }, + "bucket_3": { + "name": "Bucket 3", + "description": "this response implies something...3" + }, + "bucket_4": { + "name": "Bucket 4", + "description": "this response implies something...4" + } } -] +} \ No newline at end of file diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/README.md b/parlai/crowdsourcing/tasks/turn_annotations_static/README.md index 50d7a742762..cf9aa75bdf8 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/README.md +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/README.md @@ -11,7 +11,7 @@ Two variants of the blueprint are supported: For both variants of the blueprint, it is required to pass in your own file of conversations with `mephisto.blueprint.data_jsonl=${PATH_TO_CONVERSATIONS}`. -See `turn_annotations_blueprint.py` for various parameters of this task, including passing in custom annotation bucket definitions using the `annotation_buckets` YAML flag, being able to group multiple conversations into one HIT using the `subtasks_per_unit` flag, passing in onboarding data with answers, and being able to ask only for the final utterance as an annotation. +See `turn_annotations_blueprint.py` for various parameters of this task, including passing in custom annotation bucket definitions using the `annotations_config_path` YAML flag, being able to group multiple conversations into one HIT using the `subtasks_per_unit` flag, passing in onboarding data with answers, and being able to ask only for the final utterance as an annotation. The validation of the response field is handled by `validateFreetextResponse` function in `task_components.jsx` and checks for a minimum number of characters, words, and vowels specified by function parameters. To change this, modify the values passed in to the function call or override the function to set your own validation requirements. diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py b/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py index fbe1468476c..fe31946e407 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py @@ -20,7 +20,7 @@ class TurnAnnotationsStaticResultsCompiler(AbstractTurnAnnotationResultsCompiler """ Class to compile results from static turn annotations. - Change PROBLEM_BUCKETS in task_config/annotation_buckets.json to be the buckets that + Change PROBLEM_BUCKETS in task_config/annotation_config.json to be the buckets that you are asking crowdsource workers to annotate with. """ diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml b/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml index 2f8f42fad10..f2f3196aad7 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml @@ -11,7 +11,7 @@ mephisto: extra_source_dir: ${task_dir}/webapp/src/static units_per_assignment: 5 onboarding_qualification: turn_annotations_static - annotations_config_path: ${task_dir}/task_config/annotation_buckets.json + annotations_config_path: ${task_dir}/task_config/annotations_config.json response_field: False task: allowed_concurrent: 1 diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotation_buckets.json b/parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotation_buckets.json deleted file mode 100644 index 7802e65a393..00000000000 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotation_buckets.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "config": { - "bucket_0": { - "name": "Bucket 0", - "description": "this response implies something...0" - }, - "bucket_1": { - "name": "Bucket 1", - "description": "this response implies something...1" - }, - "bucket_2": { - "name": "Bucket 2", - "description": "this response implies something...2" - }, - "bucket_3": { - "name": "Bucket 3", - "description": "this response implies something...3" - }, - "bucket_4": { - "name": "Bucket 4", - "description": "this response implies something...4" - } - } -} \ No newline at end of file diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/webapp/src/components/checkboxes.jsx b/parlai/crowdsourcing/tasks/turn_annotations_static/webapp/src/components/checkboxes.jsx index dea02734dd8..c328d633ecf 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/webapp/src/components/checkboxes.jsx +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/webapp/src/components/checkboxes.jsx @@ -44,7 +44,16 @@ function Checkboxes({ annotationBuckets, turnIdx, onUserInputUpdate, askReason }
{ Object.keys(annotationBuckets.config).map(c => ( - handleCheckboxChange(evt, annotationBuckets, onUserInputUpdate)} />{annotationBuckets.config[c].name} + + handleCheckboxChange(evt, annotationBuckets, onUserInputUpdate)} + /> + + {annotationBuckets.config[c].name} + )) } From b05a9a43c9fd4d1aa1511383c789acc723259e43 Mon Sep 17 00:00:00 2001 From: meganung Date: Tue, 2 Nov 2021 14:56:22 -0700 Subject: [PATCH 03/10] remove task_description flag (not used) --- .../tasks/model_chat/hydra_configs/conf/example.yaml | 7 ------- .../model_chat/hydra_configs/conf/example_image_chat.yaml | 7 ------- 2 files changed, 14 deletions(-) diff --git a/parlai/crowdsourcing/tasks/model_chat/hydra_configs/conf/example.yaml b/parlai/crowdsourcing/tasks/model_chat/hydra_configs/conf/example.yaml index abe1628aebd..3dad128ad8c 100644 --- a/parlai/crowdsourcing/tasks/model_chat/hydra_configs/conf/example.yaml +++ b/parlai/crowdsourcing/tasks/model_chat/hydra_configs/conf/example.yaml @@ -22,13 +22,6 @@ mephisto: assignment_duration_in_seconds: 600 max_num_concurrent_units: 0 # 0 means infinite; set this to a positive integer to limit concurrent HITs and prevent crashes maximum_units_per_worker: 3 - task_description: | -

Task Description

-
- Dummy Task Description. - - Lorem ipsum. -

task_name: model_chat task_reward: 3 task_tags: "chat,conversation,dialog,partner" diff --git a/parlai/crowdsourcing/tasks/model_chat/hydra_configs/conf/example_image_chat.yaml b/parlai/crowdsourcing/tasks/model_chat/hydra_configs/conf/example_image_chat.yaml index f43e8c5516e..be2519643dc 100644 --- a/parlai/crowdsourcing/tasks/model_chat/hydra_configs/conf/example_image_chat.yaml +++ b/parlai/crowdsourcing/tasks/model_chat/hydra_configs/conf/example_image_chat.yaml @@ -18,13 +18,6 @@ mephisto: assignment_duration_in_seconds: 600 max_num_concurrent_units: 0 # 0 means infinite; set this to a positive integer to limit concurrent HITs and prevent crashes maximum_units_per_worker: 3 - task_description: | -

Task Description

-
- Dummy Task Description. - - Lorem ipsum. -

task_name: model_image_chat task_reward: 3 task_tags: "chat,conversation,dialog,partner,image" From cc50e5062a10195bfd7451745892f0e00b385947 Mon Sep 17 00:00:00 2001 From: meganung Date: Wed, 3 Nov 2021 08:17:23 -0700 Subject: [PATCH 04/10] chat_title->task_title --- parlai/crowdsourcing/tasks/model_chat/frontend/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parlai/crowdsourcing/tasks/model_chat/frontend/main.js b/parlai/crowdsourcing/tasks/model_chat/frontend/main.js index f7fbe0d3be3..0c66c2861b2 100644 --- a/parlai/crowdsourcing/tasks/model_chat/frontend/main.js +++ b/parlai/crowdsourcing/tasks/model_chat/frontend/main.js @@ -30,7 +30,7 @@ function MainApp() { )} renderSidePane={({ mephistoContext: { taskConfig }, appContext: { taskContext } }) => ( {(taskContext.hasOwnProperty('image_src') && taskContext['image_src']) ? ( From 21cc451b48cb9a721622f80a7390c46f6a54e0c8 Mon Sep 17 00:00:00 2001 From: meganung Date: Wed, 3 Nov 2021 11:17:43 -0700 Subject: [PATCH 05/10] move task description to html file --- .../hydra_configs/conf/example.yaml | 8 +------- .../turn_annotations_blueprint.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml b/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml index f2f3196aad7..a0b8415046f 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml @@ -13,18 +13,12 @@ mephisto: onboarding_qualification: turn_annotations_static annotations_config_path: ${task_dir}/task_config/annotations_config.json response_field: False + task_description_file: ${task_dir}/task_config/task_description.html task: allowed_concurrent: 1 assignment_duration_in_seconds: 600 max_num_concurrent_units: 0 # 0 means infinite; set this to a positive integer to limit concurrent HITs and prevent crashes maximum_units_per_worker: 5 - task_description: | -

Task Description

-
- Dummy Task Description. - - Lorem ipsum. -

task_name: turn_annotations_static task_reward: 0.3 task_tags: "chat,conversation,dialog,partner" diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py b/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py index d5b7c2832dc..f840873bcfb 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py @@ -97,6 +97,10 @@ class TurnAnnotationsStaticBlueprintArgs(StaticReactBlueprintArgs): "help": "If we want a freeform textbox input for the crowdworker to respond to the message." }, ) + task_description_file: str = field( + default=os.path.join(get_task_path(), 'task_config/task_description.html'), + metadata={"help": "Path to file of HTML to show on the task-description page"}, + ) @register_mephisto_abstraction() @@ -185,6 +189,19 @@ def get_frontend_args(self) -> Dict[str, Any]: for use by the task's frontend. """ + # Load task description from file + MISSING_TASK_DESCRIPTION_TEXT = ( + "

" "You didn't specify a task_description_file" "

" + ) + task_description = MISSING_TASK_DESCRIPTION_TEXT + if self.args.blueprint.get("task_description_file", None) is not None: + full_path = os.path.expanduser(self.args.blueprint.task_description_file) + assert os.path.exists( + full_path + ), f"Target task description path {full_path} doesn't exist" + with open(full_path, "r") as description_fp: + task_description = description_fp.read() + with open(self.args.blueprint.onboarding_data, "r", encoding="utf-8-sig") as f: onboarding_data = json.loads(f.read()) @@ -196,7 +213,7 @@ def get_frontend_args(self) -> Dict[str, Any]: annotation_buckets = json.loads(f.read()) return { - "task_description": self.args.task.get('task_description', None), + "task_description": task_description, "task_title": self.args.task.get('task_title', None), "annotation_question": self.args.blueprint.annotation_question, "onboarding_data": onboarding_data, From 7295418f641fbbb0b4155bf31a20b1f260254142 Mon Sep 17 00:00:00 2001 From: meganung Date: Thu, 4 Nov 2021 15:39:27 -0700 Subject: [PATCH 06/10] sample annotation buckets match previous ones for model chat task --- .../tasks/model_chat/task_config/annotations_config.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json b/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json index 7802e65a393..5b5e8b85c5f 100644 --- a/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json +++ b/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json @@ -19,6 +19,10 @@ "bucket_4": { "name": "Bucket 4", "description": "this response implies something...4" + }, + "none_all_good": { + "name": "None, all good", + "description": "This response implies that there are no problems with the data" } } } \ No newline at end of file From 3ff5cfa4ecee2cf84a780f80ec5f0e2edcf84d48 Mon Sep 17 00:00:00 2001 From: meganung Date: Mon, 8 Nov 2021 07:56:12 -0800 Subject: [PATCH 07/10] update tests --- .../model_chat/frontend/components/onboarding_components.jsx | 2 +- .../tasks/model_chat/task_config/annotations_config.json | 2 +- .../turn_annotations_static/hydra_configs/conf/example.yaml | 2 +- .../tasks/model_chat/expected_states/final_chat_data.json | 2 +- .../crowdsourcing/tasks/model_chat/expected_states/state.json | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx b/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx index f197bcf33b5..c9f1b0df21a 100644 --- a/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx +++ b/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx @@ -127,7 +127,7 @@ function OnboardingComponent({ onboardingData, annotationBuckets, annotationQues } else { const [currentTurnAnnotations, setCurrentAnnotations] = React.useState( Array.from(Array(onboardingData.dialog.length), () => Object.fromEntries( - Object.keys(annotationBuckets.config).map(bucket => [bucket, false])) + Object.keys(annotationBuckets.config).map(bucket => [bucket, false]) ) ); return ( diff --git a/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json b/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json index 5b5e8b85c5f..8d028c07a12 100644 --- a/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json +++ b/parlai/crowdsourcing/tasks/model_chat/task_config/annotations_config.json @@ -25,4 +25,4 @@ "description": "This response implies that there are no problems with the data" } } -} \ No newline at end of file +} diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml b/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml index a0b8415046f..cfccd034ca7 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml @@ -7,7 +7,7 @@ mephisto: blueprint: subtasks_per_unit: 6 task_source: ${task_dir}/webapp/build/bundle.js - data_jsonl: ${task_dir}/task_config/onboarding_in_flight.jsonl + data_jsonl: FIXME_TASK_DATA_PATH extra_source_dir: ${task_dir}/webapp/src/static units_per_assignment: 5 onboarding_qualification: turn_annotations_static diff --git a/tests/crowdsourcing/tasks/model_chat/expected_states/final_chat_data.json b/tests/crowdsourcing/tasks/model_chat/expected_states/final_chat_data.json index 6b3f860ff5d..a8d43fb8bbd 100644 --- a/tests/crowdsourcing/tasks/model_chat/expected_states/final_chat_data.json +++ b/tests/crowdsourcing/tasks/model_chat/expected_states/final_chat_data.json @@ -132,7 +132,7 @@ "1" ], "task_description": { - "annotations_config": "[\n {\n \"value\": \"bucket_0\",\n \"name\": \"Bucket 0\",\n \"description\": \"this response implies something...0\"\n },\n {\n \"value\": \"bucket_1\",\n \"name\": \"Bucket 1\",\n \"description\": \"this response implies something...1\"\n },\n {\n \"value\": \"bucket_2\",\n \"name\": \"Bucket 2\",\n \"description\": \"this response implies something...2\"\n },\n {\n \"value\": \"bucket_3\",\n \"name\": \"Bucket 3\",\n \"description\": \"this response implies something...3\"\n },\n {\n \"value\": \"bucket_4\",\n \"name\": \"Bucket 4\",\n \"description\": \"this response implies something...4\"\n },\n {\n \"value\": \"none_all_good\",\n \"name\": \"None, all good\",\n \"description\": \"This response implies that there are no problems with the data\"\n }\n]\n", + "annotations_config": "{\n \"config\": {\n \"bucket_0\": {\n \"name\": \"Bucket 0\",\n \"description\": \"this response implies something...0\"\n },\n \"bucket_1\": {\n \"name\": \"Bucket 1\",\n \"description\": \"this response implies something...1\"\n },\n \"bucket_2\": {\n \"name\": \"Bucket 2\",\n \"description\": \"this response implies something...2\"\n },\n \"bucket_3\": {\n \"name\": \"Bucket 3\",\n \"description\": \"this response implies something...3\"\n },\n \"bucket_4\": {\n \"name\": \"Bucket 4\",\n \"description\": \"this response implies something...4\"\n },\n \"none_all_good\": {\n \"name\": \"None, all good\",\n \"description\": \"This response implies that there are no problems with the data\"\n }\n }\n}\n", "model_nickname": "fixed_response", "model_file": "/private/home/ems/GitHub/facebookresearch/ParlAI_dev/data/models/fixed_response/model", "model_opt": { diff --git a/tests/crowdsourcing/tasks/model_chat/expected_states/state.json b/tests/crowdsourcing/tasks/model_chat/expected_states/state.json index 20020318adf..8f4d83c082c 100644 --- a/tests/crowdsourcing/tasks/model_chat/expected_states/state.json +++ b/tests/crowdsourcing/tasks/model_chat/expected_states/state.json @@ -357,7 +357,7 @@ "person2_seed_utterance": null, "personas": null, "task_description": { - "annotations_config": "[\n {\n \"value\": \"bucket_0\",\n \"name\": \"Bucket 0\",\n \"description\": \"this response implies something...0\"\n },\n {\n \"value\": \"bucket_1\",\n \"name\": \"Bucket 1\",\n \"description\": \"this response implies something...1\"\n },\n {\n \"value\": \"bucket_2\",\n \"name\": \"Bucket 2\",\n \"description\": \"this response implies something...2\"\n },\n {\n \"value\": \"bucket_3\",\n \"name\": \"Bucket 3\",\n \"description\": \"this response implies something...3\"\n },\n {\n \"value\": \"bucket_4\",\n \"name\": \"Bucket 4\",\n \"description\": \"this response implies something...4\"\n },\n {\n \"value\": \"none_all_good\",\n \"name\": \"None, all good\",\n \"description\": \"This response implies that there are no problems with the data\"\n }\n]\n", + "annotations_config": "{\n \"config\": {\n \"bucket_0\": {\n \"name\": \"Bucket 0\",\n \"description\": \"this response implies something...0\"\n },\n \"bucket_1\": {\n \"name\": \"Bucket 1\",\n \"description\": \"this response implies something...1\"\n },\n \"bucket_2\": {\n \"name\": \"Bucket 2\",\n \"description\": \"this response implies something...2\"\n },\n \"bucket_3\": {\n \"name\": \"Bucket 3\",\n \"description\": \"this response implies something...3\"\n },\n \"bucket_4\": {\n \"name\": \"Bucket 4\",\n \"description\": \"this response implies something...4\"\n },\n \"none_all_good\": {\n \"name\": \"None, all good\",\n \"description\": \"This response implies that there are no problems with the data\"\n }\n }\n}\n", "model_nickname": "fixed_response", "model_opt": { "init_opt": null, @@ -515,7 +515,7 @@ "hit_ids": ["1"], "assignment_ids": ["1"], "task_description": { - "annotations_config": "[\n {\n \"value\": \"bucket_0\",\n \"name\": \"Bucket 0\",\n \"description\": \"this response implies something...0\"\n },\n {\n \"value\": \"bucket_1\",\n \"name\": \"Bucket 1\",\n \"description\": \"this response implies something...1\"\n },\n {\n \"value\": \"bucket_2\",\n \"name\": \"Bucket 2\",\n \"description\": \"this response implies something...2\"\n },\n {\n \"value\": \"bucket_3\",\n \"name\": \"Bucket 3\",\n \"description\": \"this response implies something...3\"\n },\n {\n \"value\": \"bucket_4\",\n \"name\": \"Bucket 4\",\n \"description\": \"this response implies something...4\"\n },\n {\n \"value\": \"none_all_good\",\n \"name\": \"None, all good\",\n \"description\": \"This response implies that there are no problems with the data\"\n }\n]\n", + "annotations_config": "{\n \"config\": {\n \"bucket_0\": {\n \"name\": \"Bucket 0\",\n \"description\": \"this response implies something...0\"\n },\n \"bucket_1\": {\n \"name\": \"Bucket 1\",\n \"description\": \"this response implies something...1\"\n },\n \"bucket_2\": {\n \"name\": \"Bucket 2\",\n \"description\": \"this response implies something...2\"\n },\n \"bucket_3\": {\n \"name\": \"Bucket 3\",\n \"description\": \"this response implies something...3\"\n },\n \"bucket_4\": {\n \"name\": \"Bucket 4\",\n \"description\": \"this response implies something...4\"\n },\n \"none_all_good\": {\n \"name\": \"None, all good\",\n \"description\": \"This response implies that there are no problems with the data\"\n }\n }\n}\n", "model_nickname": "fixed_response", "model_file": null, "model_opt": { From f5ce295af863c9d009bde3ddb3bcf66ecca32dc1 Mon Sep 17 00:00:00 2001 From: meganung Date: Tue, 16 Nov 2021 12:54:27 -0800 Subject: [PATCH 08/10] add task config files --- .../task_config/annotations_config.json | 24 +++++++++++++++++++ .../task_config/task_description.html | 7 ++++++ 2 files changed, 31 insertions(+) create mode 100644 parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotations_config.json create mode 100644 parlai/crowdsourcing/tasks/turn_annotations_static/task_config/task_description.html diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotations_config.json b/parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotations_config.json new file mode 100644 index 00000000000..7802e65a393 --- /dev/null +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotations_config.json @@ -0,0 +1,24 @@ +{ + "config": { + "bucket_0": { + "name": "Bucket 0", + "description": "this response implies something...0" + }, + "bucket_1": { + "name": "Bucket 1", + "description": "this response implies something...1" + }, + "bucket_2": { + "name": "Bucket 2", + "description": "this response implies something...2" + }, + "bucket_3": { + "name": "Bucket 3", + "description": "this response implies something...3" + }, + "bucket_4": { + "name": "Bucket 4", + "description": "this response implies something...4" + } + } +} \ No newline at end of file diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/task_config/task_description.html b/parlai/crowdsourcing/tasks/turn_annotations_static/task_config/task_description.html new file mode 100644 index 00000000000..dc7bddcf2a6 --- /dev/null +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/task_config/task_description.html @@ -0,0 +1,7 @@ +
+

Task Description

+
+Dummy Task Description. +Lorem ipsum. +turnannotations +

From 68473a892b17f229a383b7cdbd293ceab458551d Mon Sep 17 00:00:00 2001 From: meganung Date: Tue, 16 Nov 2021 13:10:28 -0800 Subject: [PATCH 09/10] PR fixes --- .../turn_annotations_static/analysis/compile_results.py | 2 +- .../turn_annotations_static/turn_annotations_blueprint.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py b/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py index fe31946e407..a976a8d4264 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py @@ -20,7 +20,7 @@ class TurnAnnotationsStaticResultsCompiler(AbstractTurnAnnotationResultsCompiler """ Class to compile results from static turn annotations. - Change PROBLEM_BUCKETS in task_config/annotation_config.json to be the buckets that + Change PROBLEM_BUCKETS in task_config/annotations_config.json to be the buckets that you are asking crowdsource workers to annotate with. """ diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py b/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py index f840873bcfb..5b573c0e7e6 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/turn_annotations_blueprint.py @@ -190,10 +190,7 @@ def get_frontend_args(self) -> Dict[str, Any]: """ # Load task description from file - MISSING_TASK_DESCRIPTION_TEXT = ( - "

" "You didn't specify a task_description_file" "

" - ) - task_description = MISSING_TASK_DESCRIPTION_TEXT + task_description = "

" "You didn't specify a task_description_file" "

" if self.args.blueprint.get("task_description_file", None) is not None: full_path = os.path.expanduser(self.args.blueprint.task_description_file) assert os.path.exists( From b23b2ca21752dd6b52119e88ed32b3cbeda4463d Mon Sep 17 00:00:00 2001 From: meganung Date: Mon, 22 Nov 2021 07:49:25 -0800 Subject: [PATCH 10/10] model chat task only supports checkboxes right now --- .../tasks/model_chat/frontend/components/checkboxes.jsx | 3 ++- .../model_chat/frontend/components/onboarding_components.jsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/parlai/crowdsourcing/tasks/model_chat/frontend/components/checkboxes.jsx b/parlai/crowdsourcing/tasks/model_chat/frontend/components/checkboxes.jsx index 6b56e8ddb72..79379d77854 100644 --- a/parlai/crowdsourcing/tasks/model_chat/frontend/components/checkboxes.jsx +++ b/parlai/crowdsourcing/tasks/model_chat/frontend/components/checkboxes.jsx @@ -28,7 +28,8 @@ function Checkboxes({ if (!askReason) { reasonComponent = ''; } - let input_type = annotationBuckets.type !== undefined ? annotationBuckets.type : "checkbox"; + // TODO: add support for radio input type + let input_type = "checkbox"; return (
{ diff --git a/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx b/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx index c9f1b0df21a..f197bcf33b5 100644 --- a/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx +++ b/parlai/crowdsourcing/tasks/model_chat/frontend/components/onboarding_components.jsx @@ -127,7 +127,7 @@ function OnboardingComponent({ onboardingData, annotationBuckets, annotationQues } else { const [currentTurnAnnotations, setCurrentAnnotations] = React.useState( Array.from(Array(onboardingData.dialog.length), () => Object.fromEntries( - Object.keys(annotationBuckets.config).map(bucket => [bucket, false]) + Object.keys(annotationBuckets.config).map(bucket => [bucket, false])) ) ); return (