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"
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..8d028c07a12 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,28 @@
-[
- {
- "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"
+ },
+ "none_all_good": {
+ "name": "None, all good",
+ "description": "This response implies that there are no problems with the data"
+ }
}
-]
+}
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..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_buckets.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/hydra_configs/conf/example.yaml b/parlai/crowdsourcing/tasks/turn_annotations_static/hydra_configs/conf/example.yaml
index df3605759d7..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
@@ -11,20 +11,14 @@ mephisto:
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/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/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/task_config/annotation_buckets.json b/parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotations_config.json
similarity index 100%
rename from parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotation_buckets.json
rename to parlai/crowdsourcing/tasks/turn_annotations_static/task_config/annotations_config.json
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 @@
+
+
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..5b573c0e7e6 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(
@@ -96,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()
@@ -184,18 +189,28 @@ def get_frontend_args(self) -> Dict[str, Any]:
for use by the task's frontend.
"""
+ # Load task description from file
+ 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(
+ 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())
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())
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,
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 }