Skip to content
This repository was archived by the owner on Oct 11, 2023. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1347 commits
Select commit Hold shift + click to select a range
b9bb853
styled report box
JustinPinero Apr 22, 2021
f263147
Merge branch 'get-agent-status-stub' into exp
JustinPinero Apr 22, 2021
0b46acc
Merge pull request #193 from facebookresearch/get-agent-status-stub
JackUrb Apr 22, 2021
447c741
refactored message styles
JustinPinero Apr 22, 2021
4010cc1
added exp reward indicator
JustinPinero Apr 22, 2021
4737fe9
connecting reward feature to back end
JustinPinero Apr 22, 2021
29989dc
Adding missing fields to frontend events
JackUrb Apr 22, 2021
1c227c9
Merge pull request #196 from facebookresearch/ensure-correct-data-passed
JustinPinero Apr 22, 2021
9ad64e0
fixing reward route
JustinPinero Apr 22, 2021
4caee92
complete merge
JustinPinero Apr 22, 2021
03fad9e
connected exp award feature, updated WSDataSource to filter by event_…
JustinPinero Apr 22, 2021
d522e72
fixed logout test
JustinPinero Apr 23, 2021
bdfa96f
pre merge
JustinPinero Apr 23, 2021
661f854
Missing one event_id pass
JackUrb Apr 23, 2021
d88cd43
Merge pull request #198 from facebookresearch/event-id-match
JustinPinero Apr 23, 2021
10fef0e
premerge
JustinPinero Apr 23, 2021
41d2255
Merge branch 'master' into wiring-front-to-back
JustinPinero Apr 23, 2021
2036db5
safe reset of convos
jaseweston Apr 23, 2021
2c6df99
connected and tested exp gift and receiving features
JustinPinero Apr 23, 2021
c1bf213
removed changes and console logs for testing, added disconnect from w…
JustinPinero Apr 23, 2021
6eec440
removed p tag in p tag on side bar
JustinPinero Apr 23, 2021
6d7d62d
removed misc testing console logs in game app
JustinPinero Apr 23, 2021
0b3e701
removed last of console logs from landing app, removed legacy code fr…
JustinPinero Apr 23, 2021
586a33b
added session exp state
JustinPinero Apr 24, 2021
87161f5
fixed player gift xp from being off by 1
JustinPinero Apr 24, 2021
f4b4ccb
Merge pull request #199 from facebookresearch/bugz1
jaseweston Apr 26, 2021
274ecdc
changed sessionDisconnect to disconnectFromSession
JustinPinero Apr 26, 2021
73c7101
exp awarded changed from text to event_data.reward
JustinPinero Apr 26, 2021
f7bdf50
obscenity message now replaces trigger message by event_id
JustinPinero Apr 26, 2021
10d524e
obscenity message now replaces trigger message by event_id
JustinPinero Apr 26, 2021
cc5aeaa
obscenity message now replaces trigger message by event_id
JustinPinero Apr 26, 2021
4c97ccc
fixed state mapping function in obscenity condition in message reducer
JustinPinero Apr 26, 2021
a01b4c2
fixed location punctuation and added refresh to idle disconnect text
JustinPinero Apr 26, 2021
5753763
Merge pull request #194 from facebookresearch/exp
JackUrb Apr 26, 2021
c2055ca
Merge branch 'master' into wiring-front-to-back
JackUrb Apr 26, 2021
58b3a80
Merge pull request #197 from facebookresearch/wiring-front-to-back
JackUrb Apr 26, 2021
da98b49
fixed reward button
JustinPinero Apr 27, 2021
dd75f54
fixed live changes to giftXP and added sessionGiftExpSpent state
JustinPinero Apr 27, 2021
4767819
Fixed obscenity filter
JustinPinero Apr 27, 2021
3e5bda9
undid base_soul.py changes for testing
JustinPinero Apr 27, 2021
66b6301
added styling to reload text in idleness message
JustinPinero Apr 27, 2021
2eb13c2
added styling to reload text in idleness message
JustinPinero Apr 27, 2021
74058c9
added styling to reload text in idleness message
JustinPinero Apr 27, 2021
70e3ccf
Merge pull request #200 from facebookresearch/wiring-front-to-back
JustinPinero Apr 28, 2021
7cd37e7
Making exp for quests come through as SystemMessageEvent
JackUrb Apr 28, 2021
8695baa
Fix action-soul-dialogue bug
JackUrb Apr 28, 2021
5868f42
Remove debug
JackUrb Apr 28, 2021
fa13683
Actually fixing the bug
JackUrb Apr 28, 2021
f3fec84
fixed main page sizing, side bar now scrolls
JustinPinero Apr 28, 2021
1722ce0
Fixing hit->block->death bug
JackUrb Apr 28, 2021
1965b8d
Fixing up context on unsafe utterance
JackUrb Apr 28, 2021
b5f1a0e
Merge pull request #201 from facebookresearch/backend-fixes-and-quests
JackUrb Apr 28, 2021
8c1999a
small intro fix
jaseweston Apr 29, 2021
87ab8f1
Merge pull request #202 from facebookresearch/bugz4
JackUrb Apr 29, 2021
5a4d048
fixed undefined actor error in message component
JustinPinero Apr 29, 2021
0feee62
added checks for props before any use of to upper
JustinPinero Apr 29, 2021
795044e
fixed system message agent header
JustinPinero Apr 29, 2021
128038d
Merge pull request #203 from facebookresearch/pre-alpha-fixes2
JackUrb Apr 29, 2021
612a56a
fixed scroll issues in side bar and main page
JustinPinero Apr 29, 2021
a4e6db2
Merge pull request #204 from facebookresearch/pre-alpha-fixes2
JackUrb Apr 29, 2021
bc72898
add missing missions
jaseweston Apr 29, 2021
8dac513
added star shine animation
JustinPinero Apr 29, 2021
32a0639
added star shine animation
JustinPinero Apr 29, 2021
9ed557c
events are totally broken
jaseweston Apr 30, 2021
0e1e8a9
Merge pull request #206 from facebookresearch/bugz6
JackUrb Apr 30, 2021
1c4e996
Merge pull request #205 from facebookresearch/bugz5
JackUrb Apr 30, 2021
25f7c78
Fixes and enhancements to use_events
JackUrb Apr 30, 2021
2f2c3da
styled soul spawn entry
JustinPinero Apr 30, 2021
cc25aab
Another round of backend fixes
JackUrb Apr 30, 2021
04e2184
Also fix debug logging?
JackUrb Apr 30, 2021
357b40a
Skip dialogue safety check on DEBUG
JackUrb Apr 30, 2021
07b77df
Usage limit to scrolls
JackUrb Apr 30, 2021
cbbfd51
Merge pull request #208 from facebookresearch/more-event-fixes
JackUrb Apr 30, 2021
dbf1d7c
added check for quest completion to reducer
JustinPinero Apr 30, 2021
be06c4c
added Mission success entry and total exp to progress bar
JustinPinero Apr 30, 2021
64e1bf8
fixed border on soul spawn event entry
JustinPinero Apr 30, 2021
912f47e
adding copy to tutorial page
JustinPinero May 3, 2021
c293791
added images to experience points topic
JustinPinero May 3, 2021
2a4f76f
adding images to experience points system topic
JustinPinero May 3, 2021
5ec2481
removed glowing effect from character description on soul spawn event
JustinPinero May 3, 2021
830faed
Merge pull request #207 from facebookresearch/stars
JustinPinero May 3, 2021
9d23f32
Merge branch 'master' into mission-entry
JustinPinero May 3, 2021
119d10b
Merge pull request #209 from facebookresearch/mission-entry
JustinPinero May 3, 2021
f454bb2
Merge branch 'master' into tutorialpage
JustinPinero May 3, 2021
f73bcd0
added imagee to experience points system
JustinPinero May 3, 2021
9f38425
added images to character basics
JustinPinero May 3, 2021
e6a8814
Proper serialization and deserialization of UseEvent
JackUrb May 3, 2021
f68beda
dozing fix
JackUrb May 3, 2021
52b31df
added image styles for tutorial page
JustinPinero May 3, 2021
561b8b5
added sizing styles to experience points system topic images
JustinPinero May 3, 2021
b732718
added image styles to character basics
JustinPinero May 3, 2021
bb9c65a
Death message
JackUrb May 3, 2021
d7d30c9
Death has better messaging
JackUrb May 3, 2021
097cd04
added and styled action images
JustinPinero May 3, 2021
f87d417
resized tutorial header subheader and text classes
JustinPinero May 3, 2021
03a2071
styled tutorial text
JustinPinero May 3, 2021
dda1b21
removed tutorial header
JustinPinero May 3, 2021
71c28e9
added back link to tutorial pagee
JustinPinero May 3, 2021
4fc698c
added Character header to soulspawn event
JustinPinero May 3, 2021
57028c2
styled stars and added shrinking animation and slide animation to mes…
JustinPinero May 4, 2021
b49d9db
added character map util function for default character emojis
JustinPinero May 4, 2021
22675a6
fixed images being transparent with background
JustinPinero May 4, 2021
8fb9433
removed inline styling and added soulspawn-subheader class
JustinPinero May 4, 2021
a76b3c8
comment out previous code for emoji mapping for later use
JustinPinero May 4, 2021
7a1d5df
Merge pull request #212 from facebookresearch/soulspawn-fix
JustinPinero May 4, 2021
3e8be24
Merge pull request #211 from facebookresearch/tutorialpage
JustinPinero May 4, 2021
b2d42f0
Merge pull request #214 from facebookresearch/default-emojis
JustinPinero May 4, 2021
3df0bb9
Merge pull request #213 from facebookresearch/star-animation
JustinPinero May 4, 2021
014d927
Merge pull request #215 from facebookresearch/pre-alpha-fixes3
JustinPinero May 4, 2021
248a7fa
Merge pull request #210 from facebookresearch/more-pre-launch-fixes
JackUrb May 4, 2021
ee65fe0
fixed type in exprience points system
JustinPinero May 4, 2021
ae53d5d
fixed character subheader placement
JustinPinero May 4, 2021
11a39ee
Merge pull request #216 from facebookresearch/tutorialpage
JustinPinero May 4, 2021
e7f2b03
Merge pull request #217 from facebookresearch/soulspawn-fix
JustinPinero May 4, 2021
a657ccd
update help commands
jaseweston May 4, 2021
6432d55
Merge pull request #218 from facebookresearch/bugz7
JackUrb May 4, 2021
2cb9bb9
added modal component and instruction modal state
JustinPinero May 4, 2021
79a13a7
Fixing doubled context on unsafe message
JackUrb May 4, 2021
4d42294
Parsing events with capitalization
JackUrb May 4, 2021
2e52e1f
Fixing grammar in leave and arrive events
JackUrb May 4, 2021
0d830ff
Merge pull request #219 from facebookresearch/more-pre-launch-fixes-2
JackUrb May 4, 2021
15fcda4
added header to instruction modal content
JustinPinero May 4, 2021
dcfa168
added copy to modal and back functionality to tutorial page back button
JustinPinero May 4, 2021
2b580c7
styled instruction modal and added tutorial screenshots
JustinPinero May 4, 2021
e009d1d
added closes functionality to modal
JustinPinero May 4, 2021
dad4476
added new back button to terms and about pages
JustinPinero May 4, 2021
de37591
Merge pull request #220 from facebookresearch/instruction-modal
JackUrb May 4, 2021
fa9e6b7
set modal to not render unless player xp<=10
JustinPinero May 4, 2021
5880a1d
Merge pull request #221 from facebookresearch/instruction-modal
JackUrb May 4, 2021
251063d
fixed typo in minitutorial
JustinPinero May 5, 2021
829b561
Update index.js
JackUrb May 5, 2021
d2508ab
Merge pull request #222 from facebookresearch/copy-corrections
JackUrb May 5, 2021
0fb7dd2
added help entry
JustinPinero May 5, 2021
73c96ef
updated styles
JustinPinero May 5, 2021
1bce452
Merge pull request #223 from facebookresearch/help-entry
JustinPinero May 5, 2021
291172d
added send button and styles to chat input component
JustinPinero May 6, 2021
76333ab
generative start features
jaseweston May 6, 2021
0202de5
moar
jaseweston May 6, 2021
70f4aca
Merge pull request #225 from facebookresearch/bugz7
jaseweston May 7, 2021
6e28b8d
requirements change
jaseweston May 7, 2021
565dd76
Merge pull request #227 from facebookresearch/requirements2
jaseweston May 7, 2021
67ccfae
Merge pull request #224 from facebookresearch/sendbutton
JustinPinero May 7, 2021
46d197d
aadded play button to bottom of tutorial page
JustinPinero May 10, 2021
a00596c
added status entry
JustinPinero May 10, 2021
586ec95
humanz (#228)
jaseweston May 10, 2021
d039da1
added and styled inventory message entry
JustinPinero May 10, 2021
bc2d41f
added button revisions
JustinPinero May 11, 2021
9d6da90
Update Actions.js
JackUrb May 11, 2021
515312d
fixed mobile styling for entry
JustinPinero May 11, 2021
0c559e1
Merge pull request #230 from facebookresearch/status-entry
JustinPinero May 11, 2021
73027b4
Merge pull request #229 from facebookresearch/tutorial-button
JustinPinero May 11, 2021
972d725
Merge branch 'entry-button-revisions' into inventory-message
JustinPinero May 11, 2021
5d132d0
resolved conflicts
JustinPinero May 11, 2021
7a211d6
restyled inventory message and made it responsive
JustinPinero May 11, 2021
8f67ce5
Merge pull request #231 from facebookresearch/inventory-message
JustinPinero May 11, 2021
fafb2f7
refactored status message
JustinPinero May 11, 2021
6c8f474
restyled help entry with requested revisions
JustinPinero May 11, 2021
20e5726
Added and styled Quest component and added it to entry component
JustinPinero May 11, 2021
47b59b9
Merge pull request #232 from facebookresearch/help-entry
JustinPinero May 11, 2021
3d283e8
Merge branch 'entry-button-revisions' into quest-entry
JustinPinero May 11, 2021
27e98c4
merged other entries and removed console logs
JustinPinero May 11, 2021
33b51d4
Merge pull request #233 from facebookresearch/quest-entry
JustinPinero May 11, 2021
b429296
merged all branches
JustinPinero May 11, 2021
73c9c04
restyled home page
JustinPinero May 12, 2021
b4fa629
fixed sizing bug
JustinPinero May 12, 2021
036a2bf
refactored landing app
JustinPinero May 12, 2021
7a3c4fc
restyled aboutpage
JustinPinero May 12, 2021
a031a3d
restyled tutorialpage
JustinPinero May 12, 2021
51e2752
restyled terms page
JustinPinero May 12, 2021
ad55310
restyled login page
JustinPinero May 12, 2021
75661be
restyled error page and logout page
JustinPinero May 12, 2021
dd577ea
styling gameapp
JustinPinero May 12, 2021
1ac36ff
Merge pull request #234 from facebookresearch/entry-button-revisions
JustinPinero May 12, 2021
bf267c7
restyling chatlog for mobile
JustinPinero May 12, 2021
5e2c71e
added media queries to entry styles
JustinPinero May 12, 2021
8450929
added isMobile state and restyled modal
JustinPinero May 12, 2021
3ac2298
added drawer feature
JustinPinero May 12, 2021
270a8fa
added resize state and event listener
JustinPinero May 12, 2021
631bbae
added glowing button component removed typos in gameapp/styles.css bu…
JustinPinero May 13, 2021
ba159f0
added mobile frame header
JustinPinero May 13, 2021
80efa4c
added toggleswitch, header, and buttons to mobile frame
JustinPinero May 13, 2021
bc95170
connected mobile frame to gameapp
JustinPinero May 13, 2021
b200afd
styled toggle and header
JustinPinero May 13, 2021
bbf8b5d
fixed responsive sizing in mobile frame
JustinPinero May 13, 2021
b352064
fixed speech bubble tails responsiveness
JustinPinero May 13, 2021
e2cd944
fixed chat icon positioning in mobile view
JustinPinero May 13, 2021
fb47886
fixing chatlog styles
JustinPinero May 13, 2021
7e5fde6
fixed chat alignment issues in mobile ui
JustinPinero May 13, 2021
0225c65
Merge pull request #235 from facebookresearch/mobile-gameapp
JustinPinero May 13, 2021
7aeac58
Merge pull request #236 from facebookresearch/mobile-landingapp
JustinPinero May 13, 2021
18e217c
added tooltip and lable to sidebar toggle switch
JustinPinero May 13, 2021
b6fcec3
Merge pull request #237 from facebookresearch/mobile-restyling
JustinPinero May 13, 2021
a46d00b
fixed spacing issue from help message (#238)
JustinPinero May 14, 2021
02ec6ed
Mobile restyling Fixes (#239)
JustinPinero May 17, 2021
1073970
fixed fonts on level dispaly and progress bar, changed logout button …
JustinPinero May 26, 2021
4c1e578
fixed sizing of messages, sizing of text, send button styling
JustinPinero May 26, 2021
475ea76
Merge pull request #242 from facebookresearch/ui-fixes-3
JustinPinero Jun 10, 2021
643bb5d
parse actions with wierd quotes (#244)
JackUrb Jun 14, 2021
7b9b396
Updating parser for multithreading (#251)
JackUrb Aug 9, 2021
7fa6605
added say and do buttons added documentation
JustinPinero Aug 20, 2021
6e53c89
removed unused code and added more documentation to chatdisplay compo…
JustinPinero Aug 20, 2021
118a438
adding mobile style fixes to progress bar and level display
JustinPinero Aug 23, 2021
33868e8
wired tell feature
JustinPinero Aug 24, 2021
ae54785
fixed repsonsive styling of player info icons on mobile
JustinPinero Aug 24, 2021
66244c4
adding redux
JustinPinero Aug 25, 2021
d902725
added redux and redux toolkit
JustinPinero Aug 31, 2021
e93bf67
added typescript to game app
JustinPinero Aug 31, 2021
817e784
Server data browsing scripts and fixes (#255)
JackUrb Sep 1, 2021
9a9be9d
Requirements fix (#258)
JackUrb Sep 1, 2021
475ffba
Human to player (#259)
JackUrb Sep 1, 2021
d3837c2
Crowdsourcing UI (#261)
JackUrb Sep 1, 2021
68640bc
Fixing npc assignment bug (#263)
JackUrb Sep 7, 2021
c83984e
added redux foundation, added personal info slices, added xp, giftxp,…
JustinPinero Sep 8, 2021
65746ea
added increaseXp and decrementGiftXp to reducer actions
JustinPinero Sep 8, 2021
e9d4f2f
added foundation for redux websocket integration
JustinPinero Sep 9, 2021
13a8a70
added documentation to slices, wired xp and giftxp redux state into e…
JustinPinero Sep 10, 2021
13b8a2e
removed passed props from experience info components
JustinPinero Sep 10, 2021
12506bd
added sessioninfo section to features, added session xp slice, added …
JustinPinero Sep 10, 2021
4547328
removed xp props from sidebar
JustinPinero Sep 10, 2021
5c42499
fixed emoji picker redux action, added view slice
JustinPinero Sep 13, 2021
9cc7403
Added documentation to GamePage for new state and useEffects, removed…
JustinPinero Sep 13, 2021
f4496b0
added chatInput Slice
JustinPinero Sep 13, 2021
90f79e1
restructured messages and types, restyling messages
JustinPinero Sep 13, 2021
fc69fed
fixed overlapping system messages
JustinPinero Sep 13, 2021
eb89633
restructured message types and styles, fixed help message overlap bug…
JustinPinero Sep 14, 2021
a6d2e00
restyled help message for both mobile and desktop
JustinPinero Sep 14, 2021
784c85e
Multi-agent chat first pass (#264)
JackUrb Sep 14, 2021
519f3cb
removed console logs, unused code, added substantial documentation, r…
JustinPinero Sep 14, 2021
6cfcb03
added styling for safari browser, added styling for mobile, fixed mai…
JustinPinero Sep 14, 2021
2b9ddb7
building tutorial popover
JustinPinero Sep 16, 2021
32f15cb
added info button
JustinPinero Sep 16, 2021
c369b33
added tutorial popover component, added gamecopy file with tutorial c…
JustinPinero Sep 16, 2021
f5a42d5
added tooltips to both chat display and sidebar
JustinPinero Sep 16, 2021
9b4f8c9
added help mode, added on click tool tips to playerinfo, Character i…
JustinPinero Sep 22, 2021
9713b81
added tooltips and animations to quest message, status message, agent…
JustinPinero Sep 22, 2021
ea63ee3
added tooltips and animations for inventory, send button, chat input,…
JustinPinero Sep 22, 2021
7d14f99
added infobutton component, added render condition to infobutton in s…
JustinPinero Sep 24, 2021
0350863
fixed toggle to clear tooltips during switch when in help mode
JustinPinero Sep 24, 2021
be8a582
added and styled final tool tips, fixed cycle tooltips on chat bar, f…
JustinPinero Sep 24, 2021
79eeed9
Merge pull request #267 from facebookresearch/help-mode
JustinPinero Sep 24, 2021
73a0935
Merge pull request #265 from facebookresearch/gameapp-ui-update4
JustinPinero Sep 27, 2021
cee8d88
Added lightqa readme that shows how to run seq2seq2seq interactively …
leox1v Oct 13, 2021
ae75d8d
Creating a light world object from an instance of the old graph (#269)
mojtaba-komeili Oct 14, 2021
8b62f36
Updated lightqa readme with new checkpoints. (#270)
leox1v Oct 15, 2021
f051a33
Clarifying the equipped objects (#271)
mojtaba-komeili Oct 20, 2021
87e2711
Documentation time (#273)
JackUrb Jan 24, 2022
cd09544
Creating `light` master script for ParlAI tooling (#274)
JackUrb Jan 24, 2022
5b1ca94
Base LIGHT-QA commit
JackUrb Jan 26, 2022
67af203
Merge branch 'main' into light-qa-merge
JackUrb Aug 31, 2022
3462dfb
Removing post-merge dropped files
JackUrb Aug 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions projects/lightqa/crowdsourcing/acute_eval/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
task_config/pairings_files/
task_config/acute_results/
block_list.txt
webapp/package-lock.json
68 changes: 68 additions & 0 deletions projects/lightqa/crowdsourcing/acute_eval/acute_eval_blueprint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env python3

# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from dataclasses import dataclass, field
from typing import ClassVar, Type, TYPE_CHECKING, Dict, Any

from mephisto.operations.registry import register_mephisto_abstraction
from parlai.crowdsourcing.tasks.acute_eval.fast_acute_blueprint import (
FastAcuteBlueprint,
FastAcuteBlueprintArgs,
)
from parlai_internal.projects.light.lightqa.crowdsourcing.acute_eval.acute_eval_builder import (
LightQAAcuteBuilder,
)

if TYPE_CHECKING:
from mephisto.abstractions.blueprint import TaskBuilder

LIGHTQA_FAST_BLUEPRINT_TYPE = "lightqa_fast_acute_eval"


@dataclass
class LightQAFastAcuteBlueprintArgs(FastAcuteBlueprintArgs):
_blueprint_type: str = LIGHTQA_FAST_BLUEPRINT_TYPE
additional_task_description_prefix: str = field(
default="Thats the default",
metadata={
"help": "Additional text to show on the left pane in the beginning of the text."
},
)
dialogues_input_dir: str = field(
default="",
metadata={"help": "Input directory from which to load the dialogue files."},
)
add_history: bool = field(
default=False,
metadata={"help": "Add a history to the chat."},
)
add_knowledge: bool = field(
default=True,
metadata={"help": "Add knowledge to the chat."},
)


@register_mephisto_abstraction()
class LightQAFastAcuteBlueprint(FastAcuteBlueprint):
"""
Subclass of FastAcuteEvalBlueprint with params for fast ACUTE runs.
"""

TaskBuilderClass: ClassVar[Type["TaskBuilder"]] = LightQAAcuteBuilder
ArgsClass = LightQAFastAcuteBlueprintArgs
BLUEPRINT_TYPE = LIGHTQA_FAST_BLUEPRINT_TYPE

def get_frontend_args(self) -> Dict[str, Any]:
"""
Specifies what options within a task_config should be forwarded to the client
for use by the task's frontend.
"""
return {
**super().get_frontend_args(),
**{
"additional_task_description_prefix": self.args.blueprint.additional_task_description_prefix,
},
}
18 changes: 18 additions & 0 deletions projects/lightqa/crowdsourcing/acute_eval/acute_eval_builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3

# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os

from parlai.crowdsourcing.tasks.acute_eval.acute_eval_builder import AcuteEvalBuilder


class LightQAAcuteBuilder(AcuteEvalBuilder):
"""
Subclass of AcuteEvalBuilder to specify a local frontend build directory.
"""

ACUTE_TASK_DIR = os.path.dirname(os.path.abspath(__file__))
FRONTEND_SOURCE_DIR = os.path.join(ACUTE_TASK_DIR, "webapp")
FRONTEND_BUILD_DIR = os.path.join(FRONTEND_SOURCE_DIR, "build")
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#@package _global_
mephisto:
blueprint:
acute_eval_type: knowledgeable
subtasks_per_unit: 4
root_dir: ${task_dir}/task_config
randomize_conversations: True
task: nq_open
matchups_per_pair: 1
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: 1 # important for replicability and reliability
task_description: "Evaluate quality of conversations through comparison."
task_name: acute_eval_${current_time}
task_reward: 0.5
task_tags: "chat,evaluation,comparison,conversation"
task_title: "Which Conversational Partner is Better?"
additional_task_description_prefix: "On the right you see two chat windows with the same structure: First, a longer context from a Wikipedia article, followed by a question about this topic."
mturk:
worker_blocklist_paths: "parlai_standard"
154 changes: 154 additions & 0 deletions projects/lightqa/crowdsourcing/acute_eval/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
#!/usr/bin/env python3

# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import os
import datetime
import json
from dataclasses import dataclass, field
from typing import List, Any, Dict, Optional

import hydra
from mephisto.operations.operator import Operator
from mephisto.operations.hydra_config import register_script_config
from mephisto.tools.scripts import load_db_and_process_config
from omegaconf import DictConfig
from parlai.crowdsourcing.utils.mturk import MTurkRunScriptConfig
from parlai.crowdsourcing.tasks.acute_eval.fast_eval import (
ACUTE_EVAL_TYPES,
FastAcuteExecutor,
)

from parlai_internal.projects.light.lightqa.crowdsourcing.acute_eval.util import (
TASK_DIRECTORY,
download_parlai_worker_blocklist,
)
from parlai_internal.projects.light.lightqa.crowdsourcing.acute_eval.acute_eval_blueprint import (
LIGHTQA_FAST_BLUEPRINT_TYPE,
)
from parlai_internal.crowdsourcing.block_list import ALLOW_LIST_QUAL_ID
from parlai_internal.projects.light.lightqa.crowdsourcing.acute_eval.acute_eval_blueprint import (
LightQAFastAcuteBlueprint,
)

"""
Read parlai/crowdsourcing/README.md to learn how to launch
crowdsourcing tasks with this script.
"""

ACUTE_EVAL_TYPES = {
**ACUTE_EVAL_TYPES,
**{
"knowledgeable": {
"question": "If you had to say that one speaker is more knowledgeable and one is more ignorant, who is more knowledgeable?",
"s1_choice": "<Speaker 1> is more knowledgeable",
"s2_choice": "<Speaker 2> is more knowledgeable",
}
},
}


class LightFastAcuteExecutor(FastAcuteExecutor):
def __init__(self, args: DictConfig):
self.args = args
self.fast_acute_args = self.args.mephisto.blueprint

# models + task
self.task: str = self.fast_acute_args.task
self.pairings_filepath = None

# question config for running ACUTE
self.question_config: Dict[str, str] = ACUTE_EVAL_TYPES[
self.fast_acute_args.acute_eval_type
]

self.run_id = self.args.mephisto.task.task_name

if args.mturk.worker_blocklist_paths == "parlai_standard":
args.mturk.worker_blocklist_paths = download_parlai_worker_blocklist()

def _load_pairings_file(self):
"""
Load pairings file.

Need to set:
- self.pairings_filepath
- self.models
- self.combos
"""
self.pairings_filepath = os.path.join(
self.fast_acute_args.root_dir, "pairings_files", "pairings.jsonl"
)
self._load_models()

def _load_models(self):
with open(self.pairings_filepath, "r") as f:
convs = [json.loads(line) for line in f]
self.models = list(
set([model for conv in convs for model in conv["speakers_to_eval"]])
)
combos = list(
set([",".join(sorted(conv["speakers_to_eval"])) for conv in convs])
)
self.combos = [tuple(combo.split(",")) for combo in combos]
self.models.sort()

def run_acute_eval(self):
"""
Run ACUTE Eval.
"""
self.set_up_acute_eval()
db, cfg = load_db_and_process_config(self.args)
print(f"*** RUN ID: {cfg.mephisto.task.task_name} ***")
operator = Operator(db)
shared_state = LightQAFastAcuteBlueprint.SharedStateClass()
shared_state.mturk_specific_qualifications = [
{
"QualificationTypeId": ALLOW_LIST_QUAL_ID,
"Comparator": "Exists",
"ActionsGuarded": "DiscoverPreviewAndAccept",
},
]
operator.validate_and_run_config(
run_config=cfg.mephisto, shared_state=shared_state
)
operator.wait_for_runs_then_shutdown(
skip_input=True, log_rate=cfg.monitoring_log_rate
)


defaults = [
{"mephisto/blueprint": LIGHTQA_FAST_BLUEPRINT_TYPE},
{"mephisto/architect": "local"},
{"mephisto/provider": "mock"},
{"conf": "conf_fast"},
]


@dataclass
class LightQAScriptConfig(MTurkRunScriptConfig):
defaults: List[Any] = field(default_factory=lambda: defaults)
task_dir: str = TASK_DIRECTORY
monitoring_log_rate: int = field(
default=30,
metadata={
"help": "Frequency in seconds of logging the monitoring of the crowdsourcing task"
},
)


register_script_config(name="lightqa_scriptconfig", module=LightQAScriptConfig)


@hydra.main(config_path="hydra_configs", config_name="lightqa_scriptconfig")
def main(cfg: DictConfig) -> None:

runner = LightFastAcuteExecutor(cfg)
runner.run_acute_eval()
runner.analyze_results()


if __name__ == "__main__":
main()
25 changes: 25 additions & 0 deletions projects/lightqa/crowdsourcing/acute_eval/util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python3

# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import os
from typing import List, Optional
from parlai_internal.crowdsourcing.block_list import WORKER_BLOCK_LIST

TASK_DIRECTORY = os.path.dirname(os.path.abspath(__file__))


def download_parlai_worker_blocklist(file_name: Optional[str] = None) -> str:
"""
Download the standard ParlAI blocklist for MTurk.

Return the download path.
"""
if not file_name:
file_name = f"{TASK_DIRECTORY}/block_list.txt"
os.makedirs("/".join(file_name.split("/")[:-1]), exist_ok=True)
with open(file_name, "w") as f:
f.write("\n".join(WORKER_BLOCK_LIST))
return file_name
4 changes: 4 additions & 0 deletions projects/lightqa/crowdsourcing/acute_eval/webapp/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/env", "@babel/preset-react"],
"plugins": ["@babel/plugin-proposal-class-properties"],
}
33 changes: 33 additions & 0 deletions projects/lightqa/crowdsourcing/acute_eval/webapp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "parlai-mephisto-task-compiler",
"version": "1.0.0",
"description": "",
"main": "webpack.config.js",
"scripts": {
"dev": "webpack --mode development -q"
},
"keywords": [],
"author": "",
"dependencies": {
"bootstrap": "^4.3.1",
"jquery": "^3.0.0",
"mephisto-task": "^1.0.10",
"react": "16.13.1",
"react-bootstrap": "^0.32.4",
"react-dom": "16.13.1",
"react-table": "^6.8.6"
},
"devDependencies": {
"@babel/cli": "^7.1.0",
"@babel/core": "^7.1.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.2",
"css-loader": "^1.0.0",
"style-loader": "^0.23.0",
"url-loader": "^2.0.1",
"webpack": "^4.19.1",
"webpack-cli": "^3.1.1"
}
}
53 changes: 53 additions & 0 deletions projects/lightqa/crowdsourcing/acute_eval/webapp/src/app.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

import React from "react";
import ReactDOM from "react-dom";
import {
TaskDescription,
BaseFrontend,
} from "./components/core_components.jsx";
import { useMephistoTask, getBlockedExplanation } from "mephisto-task";

/* ================= Application Components ================= */

function MainApp() {
const {
blockedReason,
taskConfig,
isPreview,
isLoading,
initialTaskData,
handleSubmit,
} = useMephistoTask();

if (blockedReason !== null) {
return <h1>{getBlockedExplanation(blockedReason)}</h1>;
}
if (isPreview) {
return <TaskDescription task_config={taskConfig} is_cover_page={true} />;
}
if (isLoading) {
return <div>Initializing...</div>;
}
if (initialTaskData === null) {
return <h1>Gathering data...</h1>;
}

return (
<div>
<BaseFrontend
task_data={initialTaskData}
task_config={taskConfig}
onSubmit={handleSubmit}
/>
</div>
);
}

ReactDOM.render(<MainApp />, document.getElementById("app"));
Loading