-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from thiippal/dev
Add support for golden tasks
- Loading branch information
Showing
6 changed files
with
145 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: classify_text | ||
data: | ||
file: data/classify_text_data_gold.tsv | ||
input: | ||
text: str | ||
output: | ||
result: str | ||
gold: | ||
result: known_answer | ||
options: | ||
positive: Positive | ||
negative: Negative | ||
neutral: Neutral | ||
interface: | ||
prompt: Read the text and assign it to the most appropriate category. | ||
project: | ||
# id: 129368 | ||
setup: | ||
public_name: Classify text into categories | ||
public_description: Read the text and assign it to the most appropriate category. | ||
instructions: instructions/classify_text_instructions.html | ||
pool: | ||
# id: 1387049 | ||
estimated_time_per_suite: 60 | ||
setup: | ||
private_name: Classify text | ||
reward_per_assignment: 0.2 | ||
assignment_max_duration_seconds: 600 | ||
auto_accept_solutions: true | ||
defaults: | ||
default_overlap_for_new_tasks: 1 | ||
default_overlap_for_new_task_suites: 1 | ||
mixer: | ||
real_tasks_count: 1 | ||
golden_tasks_count: 1 | ||
training_tasks_count: 0 | ||
filter: | ||
languages: | ||
- EN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
text known_answer | ||
This product is really bad. I returned it immediately and don't recommend it to anyone. negative | ||
I love my new PlayStation 2! It has the best games ever! positive | ||
The customer service in this shop is not the best, but the products are good. | ||
I will never visit this restaurant again! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from abulafia.task_specs import TaskSequence, TextClassification | ||
import argparse | ||
import json | ||
import toloka.client as toloka | ||
|
||
# Set up the argument parser | ||
ap = argparse.ArgumentParser() | ||
|
||
# Add argument for input | ||
ap.add_argument("-c", "--creds", required=True, | ||
help="Path to a JSON file that contains Toloka credentials. " | ||
"The file should have two keys: 'token' and 'mode'. " | ||
"The key 'token' should contain the Toloka API key, whereas " | ||
"the key 'mode' should have the value 'PRODUCTION' or 'SANDBOX' " | ||
"that defines the environment in which the pipeline should be run.") | ||
|
||
# Parse the arguments | ||
args = vars(ap.parse_args()) | ||
|
||
# Assign arguments to variables | ||
cred_file = args['creds'] | ||
|
||
# Read the credentials from the JSON file | ||
with open(cred_file) as cred_f: | ||
|
||
creds = json.loads(cred_f.read()) | ||
tclient = toloka.TolokaClient(creds['token'], creds['mode']) | ||
|
||
# Create a TextClassification task using the configuration file | ||
classify_text = TextClassification(configuration='config/classify_text_gold.yaml', client=tclient) | ||
|
||
# Add the tasks into a TaskSequence | ||
pipe = TaskSequence(sequence=[classify_text], client=tclient) | ||
|
||
# Start the task sequence; create tasks on Toloka | ||
pipe.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters