Module neuralops.data.task_mapper
Task metadata: metrics, number of labels, text columns.
Functions
def get_metric_name(task: str) ‑> str-
Expand source code
def get_metric_name(task: str) -> str: """Return the metric name.""" return TASK_METRICS.get(task, "accuracy")Return the metric name.
def get_num_labels(task: str, dataset=None) ‑> int-
Expand source code
def get_num_labels(task: str, dataset=None) -> int: """Return the num labels.""" if task == "stsb": return 1 if task in TASK_NUM_LABELS: return TASK_NUM_LABELS[task] if dataset and "label" in dataset["train"].column_names: return len(dataset["train"].unique("label")) return 2Return the num labels.
def get_text_columns(task: str) ‑> list-
Expand source code
def get_text_columns(task: str) -> list: """Return the text columns.""" return TASK_COLUMNS.get(task, ["sentence"])Return the text columns.