Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wikilingua Cross Lingual #809

Open
wants to merge 4 commits into
base: eval-hackathon
Choose a base branch
from

Conversation

Muennighoff
Copy link

This is a bit hacky, maybe you don't want it

from promptsource.templates import DatasetTemplates
from functools import partial
import multiprocessing
import os
import datasets
from datasets import load_dataset
from functools import partial

ds_name, subset_name = "GEM/wiki_lingua", "fr_zh"


def add_code(example):
    example["source_language_name"] = "French"
    example["target_language_name"] = "Chinese"
    return example

def filter_a_b(example, lang_a, lang_b):
    return example["source_language"] == lang_a and example["target_language"] == lang_b

ds = load_dataset(ds_name, subset_name, split="train")
ds = ds.map(add_code)
ds = ds.filter(partial(filter_a_b, lang_a=subset_name.split("_")[0], lang_b=subset_name.split("_")[1]))

prompts = DatasetTemplates(f"{ds_name}/en_en")
for t_name in prompts.all_template_names:
    print(prompts[t_name].apply(ds[1]))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant