Skip to content

Commit

Permalink
Merge pull request #1253 from facebookresearch/v1-5-release-patch
Browse files Browse the repository at this point in the history
v1.5.1
  • Loading branch information
meta-paul authored Oct 2, 2024
2 parents 641994a + a23b2db commit f6037c8
Show file tree
Hide file tree
Showing 49 changed files with 1,764 additions and 1,056 deletions.
14 changes: 14 additions & 0 deletions docs/web/docs/guides/how_to_contribute/known_issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

# Copyright (c) Meta Platforms 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.

sidebar_position: 6
---

# Known issues

While we strive to make Mephisto work its best, there are a few "perennial" issues to be aware of:

1. Sometimes Tasks consisting of only 1 Unit don't shut themselves down upon that Unit completion.
34 changes: 34 additions & 0 deletions docs/web/docs/guides/how_to_use/form_composer/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,37 @@ You can easily generate form-based Tasks using our FormComposer task generator f
You can find working demos of FormComposer in `examples/form_composer_demo` repo directory.

For details on how to run these examples, refer to the demo's [README.md](https://github.com/facebookresearch/Mephisto/blob/main/examples/form_composer_demo/README.md)

### FormComposer app UI

Here is how FormComposer app UI looks like.

### Just started task

![List of tasks](./screenshots/initial_view.png)
<br/>
<br/>

### Filled form

![List of tasks](./screenshots/in_progress_view.png)
<br/>
<br/>

### TaskReview app

![List of tasks](./screenshots/review.png)
<br/>
<br/>

### TaskReview app. List of Units

![TaskReview app. List of Units](./screenshots/units_list.png)
<br/>
<br/>

### TaskReview app. Unit page

![TaskReview app. Unit page](./screenshots/unit_page.png)
<br/>
<br/>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 31 additions & 2 deletions docs/web/docs/guides/how_to_use/video_annotator/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,42 @@ Here is how VideoAnnotator app UI looks like.

### Just started task

![List of tasks](./screenshots/initial_view.png)
![Just started task](./screenshots/initial_view.png)
<br/>
<br/>

### Annotated video

![List of tasks](./screenshots/in_progress_view.png)
![Annotated video](./screenshots/in_progress_view.png)
<br/>
<br/>

### TaskReview app. Collapsed

![TaskReview app. Collapsed](./screenshots/review_collapsed.png)
<br/>
<br/>

### TaskReview app. Open segment

![TaskReview app. Open segment](./screenshots/review_open_segment.png)
<br/>
<br/>

### TaskReview app. Open WebVTT

![TaskReview app. Open WebVTT](./screenshots/review_open_webvtt.png)
<br/>
<br/>

### TaskReview app. List of Units

![TaskReview app. List of Units](./screenshots/units_list.png)
<br/>
<br/>

### TaskReview app. Unit page

![TaskReview app. Unit page](./screenshots/unit_page.png)
<br/>
<br/>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions examples/video_annotator_demo/data/simple/task_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"annotator": {
"title": "Video Annotator Demo",
"instruction": "<div class=\"instruction\">\n Please annotate everything you think is necessary.\n</div>\n\n<style>\n .instruction {\n font-style: italic;\n }\n</style>\n",
"video": "https://d2zihajmogu5jn.cloudfront.net/elephantsdream/ed_hd.mp4",
"video": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
"segment_fields": [
{
"id": "id_title",
Expand Down Expand Up @@ -66,8 +66,8 @@
},
"annotator_metadata": {
"tokens_values": {
"video_path": "https://d2zihajmogu5jn.cloudfront.net/elephantsdream/",
"video_file": "ed_hd.mp4"
"video_path": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/",
"video_file": "BigBuckBunny.mp4"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion mephisto/abstractions/providers/inhouse/inhouse_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def launch(self, task_url: str) -> None:
ui_base_url = task_run.args.provider.ui_base_url
# This param `id` will only be used by `getAssignmentId` from `wrap_crowd_source.js`
# as any random pseudo id to pass server validation
unit_url = f"{ui_base_url}?worker_id=<WORKER_USERNAME>&id={self.assignment_id}"
unit_url = f"{ui_base_url}?worker_id=WORKER_USERNAME&id={self.assignment_id}"
logger.info(f'Unit "{self.db_id}" launched: {unit_url}')
return None

Expand Down
2 changes: 2 additions & 0 deletions mephisto/client/cli_form_composer_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def set_form_composer_env_vars(use_validation_mapping_cache: bool = True):

if use_validation_mapping_cache:
os.environ["VALIDATION_MAPPING_USE_CACHE"] = "true"
else:
os.environ["VALIDATION_MAPPING_USE_CACHE"] = "false"


def _get_form_composer_app_path() -> str:
Expand Down
2 changes: 2 additions & 0 deletions mephisto/client/cli_video_annotator_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def set_video_annotator_env_vars(use_validation_mapping_cache: bool = True):

if use_validation_mapping_cache:
os.environ["VALIDATION_MAPPING_USE_CACHE"] = "true"
else:
os.environ["VALIDATION_MAPPING_USE_CACHE"] = "false"


def _get_video_annotator_app_path() -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
from typing import Optional
from typing import Tuple

from rich import print

from mephisto.generators.generators_utils.constants import S3_URL_EXPIRATION_MINUTES_MAX
from mephisto.generators.generators_utils.constants import TOKEN_END_REGEX
from mephisto.generators.generators_utils.constants import TOKEN_START_REGEX
from mephisto.generators.generators_utils.remote_procedures import ProcedureName
from mephisto.utils.console_writer import ConsoleWriter
from .common_validation import replace_path_to_file_with_its_content
from .config_validation_constants import TOKENS_VALUES_KEY
from .separate_token_values_config import validate_separate_token_values_config
Expand All @@ -26,6 +25,8 @@
from .utils import read_config_file
from .utils import write_config_to_file

logger = ConsoleWriter()


def _extrapolate_tokens_values(
text: str,
Expand Down Expand Up @@ -305,7 +306,7 @@ def create_extrapolated_config(
)
write_config_to_file(extrapolated_unit_config_data, task_data_config_path)
except (ValueError, FileNotFoundError) as e:
print(f"\n[red]Could not extrapolate form configs:[/red] {e}\n")
logger.info(f"\n[red]Could not extrapolate form configs:[/red] {e}\n")
exit()


Expand Down Expand Up @@ -463,10 +464,10 @@ def verify_generator_configs(
if errors:
raise ValueError(make_error_message("", errors))
else:
print(f"[green]All configs are valid.[/green]")
logger.info(f"[green]All configs are valid.[/green]")

except ValueError as e:
print(error_message.format(exc=e))
logger.info(error_message.format(exc=e))

if force_exit:
exit()
Expand Down
5 changes: 3 additions & 2 deletions mephisto/review_app/client/src/consts/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ export const AUDIO_TYPES_BY_EXT = {
};

export const VIDEO_TYPES_BY_EXT = {
avi: "video/x-msvideo",
mkv: "video/x-matroska",
mov: "video/quicktime",
mp4: "video/mp4",
mpeg: "video/mpeg",
webm: "video/webm",
mov: "video/quicktime",
avi: "video/x-msvideo",
};
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ function ModalForm(props: ModalFormProps) {
const onChangeBanWorker = (value: boolean) => {
let prevFormData: FormType = Object(props.data.form);
prevFormData.checkboxBanWorker = value;

if (props.data.type === ReviewType.REJECT) {
if (value === true) {
// Open review note
prevFormData.checkboxReviewNote = true;
} else {
// Close review note only if there is no note typed already
if (!prevFormData.reviewNote) {
prevFormData.checkboxReviewNote = false;
}
}
}

props.setData({ ...props.data, form: prevFormData });
};

Expand Down
46 changes: 30 additions & 16 deletions mephisto/review_app/client/src/pages/TaskPage/TaskPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ function TaskPage(props: TaskPagePropsType) {
}

function onModalSubmit() {
setModalShow(false);
props.setErrors([]);

let hasErrors = false;

const unitIds = getUnitsIdsByApplyToNext(modalData.applyToNext);

Expand Down Expand Up @@ -388,23 +390,35 @@ function TaskPage(props: TaskPagePropsType) {
}
);
} else if (modalData.type === ReviewType.REJECT) {
postUnitsReject(
() => onReviewSuccess(modalData, unitIds),
setLoading,
onError,
{
review_note: modalData.form.checkboxReviewNote
? modalData.form.reviewNote
: null,
send_to_worker: modalData.form.checkboxReviewNoteSend,
unit_ids: unitIds,
}
);
if (modalData.form.checkboxBanWorker && !modalData.form.reviewNote) {
hasErrors = true;
props.setErrors(["'Write Note' is required if you ban Worker"]);
}

if (!hasErrors) {
postUnitsReject(
() => onReviewSuccess(modalData, unitIds),
setLoading,
onError,
{
review_note: modalData.form.checkboxReviewNote
? modalData.form.reviewNote
: null,
send_to_worker: modalData.form.checkboxReviewNoteSend,
unit_ids: unitIds,
}
);
}
}

// Save current state of the modal data
updateModalState(setModalState, modalData.type, modalData);
setIframeLoaded(false);
if (!hasErrors) {
// Close modal
setModalShow(false);

// Save current state of the modal data
updateModalState(setModalState, modalData.type, modalData);
setIframeLoaded(false);
}
}

function onError(errorResponse: ErrorResponseType | null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

import React from "react";

export function Errors({ messages }) {
export function Errors({ className, messages }) {
return (
// bootstrap classes:
// - invalid-feedback

<>
{messages && messages.length > 0 && (
<div className={`invalid-feedback`}>
<div className={`invalid-feedback ${className || ""}`}>
{messages.map((message, i) => {
return <div key={`message-${i}`}>{message}</div>;
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@
opacity: 0.2;
}

.annotation-track .overlapping-segments.is-invalid {
display: flex;
justify-content: center;
}

.annotation-track .segment-info {
position: relative;
display: flex;
Expand Down
Loading

0 comments on commit f6037c8

Please sign in to comment.