Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

[Crowdsourcing] can call blueprints from command line #4254

Merged
merged 4 commits into from Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion parlai/crowdsourcing/README.md
Expand Up @@ -6,7 +6,7 @@ Code for crowdsourcing tasks that use Mephisto. See the [Mephisto quick start gu

## Running tasks

Tasks are launched by calling the appropriate run script: for instance, an ACUTE-Eval run can be launched with `python parlai/crowdsourcing/tasks/acute_eval/run.py`, followed by any appropriate flags. All run parameters are set using [Hydra](https://github.com/facebookresearch/hydra): append the flag `-c job` to your run command to see a list of all available parameters, grouped by their package name (`mephisto.blueprint`, `mephisto.task`, etc.), which determines how they are called. Each run script has a YAML file of default parameters that will be loaded, found in the `hydra_configs/conf/` subfolder of each task.
Tasks are launched by calling the appropriate run script: for instance, an ACUTE-Eval run can be launched with `python parlai/crowdsourcing/tasks/acute_eval/run.py`, followed by any appropriate flags. All run parameters are set using [Hydra](https://github.com/facebookresearch/hydra): append the flag `-c job` to your run command to see a list of all available parameters, grouped by their package name (`mephisto.blueprint`, `mephisto.task`, etc.), which determines how they are called. Each run script points to a YAML file of default parameters (including the blueprints) that will be loaded, found in the `hydra_configs/conf/` subfolder of each task. You can specify a different blueprint in a YAML file and use that YAML file to run your task (see below).
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉


### Specifying your own YAML file

Expand All @@ -24,6 +24,8 @@ mephisto:
```
If you want to quickly modify this parameter to, say, 0.6 without changing the YAML file, you can add a `mephisto.task.task_reward=0.6` string to your launch command.

You can also specify a blueprint on the command line by adding `mephisto/blueprint=my_blueprint_type` (this will override the default blueprint type if defined in the config file).

### MTurk-specific task configuration

Here is a partial list of MTurk-specific parameters that can be set in YAML files or on the command line:
Expand Down
4 changes: 2 additions & 2 deletions parlai/crowdsourcing/tasks/model_chat/README.md
Expand Up @@ -6,7 +6,7 @@ This task will collect conversations between a human and a model. After each res

## Launching

Call `run.py` to run this task with the default parameters, as set by `conf/example.yaml`. Some parameters that you can adjust include where to save data, lists of workers to soft-block, the maximum response time, etc.
Call `run.py` to run this task with the default parameters, as set by `hydra_configs/conf/example.yaml`. Some parameters that you can adjust include where to save data, lists of workers to soft-block, the maximum response time, etc.
Copy link
Contributor

Choose a reason for hiding this comment

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

ah good catch


Set `mephisto.blueprint.model_opt_path` to specify a path to a YAML file listing all models to be chatted with, as well as the ParlAI flags for running each one. See `task_config/model_opts.yaml` for an example.

Expand All @@ -26,7 +26,7 @@ In `worlds.py`, modify `ModelChatOnboardWorld.check_onboarding_answers()` to cha

## Human+model image chat

`run_image_chat.py` can be run to chat with a model about an image: each conversation will begin with a selected image, and then the human and model will chat about it.
Call `run.py conf=example_image_chat` to chat with a model about an image: each conversation will begin with a selected image, and then the human and model will chat about it. This task is run with the parameters defined in `hydra_configs/conf/example_image_chat.yaml`.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


This code replaces the old `parlai/mturk/tasks/image_chat/` and `parlai/mturk/tasks/personality_captions/` tasks, which are deprecated and can be accessed with `git checkout v0.10.0`. Those tasks also featured the ability to compare two possible captions to an image and rate which one is more engaging: this functionality has now been replaced by the [ACUTE-Eval](https://github.com/facebookresearch/ParlAI/tree/main/parlai/crowdsourcing/tasks/acute_eval) task.

Expand Down
47 changes: 0 additions & 47 deletions parlai/crowdsourcing/tasks/model_chat/run_image_chat.py

This file was deleted.

4 changes: 3 additions & 1 deletion parlai/crowdsourcing/tasks/turn_annotations_static/README.md
Expand Up @@ -5,9 +5,11 @@ Two variants of the blueprint are supported:
- `TurnAnnotationStaticBlueprint`
- The base static turn-annotations task
- Called with `python parlai/crowdsourcing/tasks/turn_annotations_static/run.py`
- (the task runs with the default parameters set in `hydra_configs/conf/example.yaml`)
- `TurnAnnotationStaticInFlightQABlueprint`
- Includes the ability to add an additional in-flight (i.e. mid-HIT) quality assurance check
- Called with `python parlai/crowdsourcing/tasks/turn_annotations_static/run_in_flight_qa.py`
- Called with `python parlai/crowdsourcing/tasks/turn_annotations_static/run.py conf=example_in_flight_qa`
- (the task runs with the parameters set in `hydra_configs/conf/example_in_flight.yaml`)

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}`.

Expand Down

This file was deleted.

Expand Up @@ -41,7 +41,7 @@
try:

import parlai.crowdsourcing.tasks.model_chat.worlds_image_chat as world_module
from parlai.crowdsourcing.tasks.model_chat.run_image_chat import TASK_DIRECTORY
from parlai.crowdsourcing.tasks.model_chat.run import TASK_DIRECTORY
from parlai.crowdsourcing.tasks.model_chat.model_chat_blueprint import (
SharedModelImageChatTaskState,
)
Expand Down