heal 0 0 0

PRLM/distilabel-intel-orca-dpo-pairs-balanced-subsets-translated

published by @PRLM

Alignment dataset tracked in the /datasets sub-catalog.

Lifetime downloads
692
Last 30 days
19
Likes
-
Size
7.6 MB
Created on HF
2025-04-15
Age
1 years ago

Description

from concurrent.futures import ThreadPoolExecutor, as_completed

from datasets import load_dataset, Dataset

from typing import Optional

from threading import Lock

from tqdm import tqdm

import cohere

import time

import os

PROMPT_TEMPLATE = """Translate the following text from English to {target_language}.

Provide only the translated text without any additional explanation or formatting:

'{prompt}'"""

request_counter = 0

counter_lock = Lock()

def generate_w_cohere(prompt: str, model: str =… See the full description on the dataset page: https://huggingface.co/datasets/PRLM/distilabel-intel-orca-dpo-pairs-balanced-subsets-translated.

Tags

size_categories:1K<n<10Kformat:parquetmodality:textlibrary:datasetslibrary:pandaslibrary:mlcroissantlibrary:polarsregion:us

README current version from Hugging Face


dataset_info:

  • config_name: 1k-English
    features:
    • name: prompt
      dtype: string
    • name: completion
      dtype: string
    • name: score
      dtype: int64
      splits:
    • name: train
      num_bytes: 1649336
      num_examples: 1000
      download_size: 988517
      dataset_size: 1649336
  • config_name: 1k-French
    features:
    • name: prompt
      dtype: string
    • name: completion
      dtype: string
    • name: score
      dtype: int64
      splits:
    • name: train
      num_bytes: 1622654
      num_examples: 1000
      download_size: 937396
      dataset_size: 1622654
  • config_name: 1k-German
    features:
    • name: prompt
      dtype: string
    • name: completion
      dtype: string
    • name: score
      dtype: int64
      splits:
    • name: train
      num_bytes: 1540572
      num_examples: 1000
      download_size: 905410
      dataset_size: 1540572
  • config_name: 1k-Hindi
    features:
    • name: prompt
      dtype: string
    • name: completion
      dtype: string
    • name: score
      dtype: int64
      splits:
    • name: train
      num_bytes: 3592006
      num_examples: 1000
      download_size: 1326017
      dataset_size: 3592006
  • config_name: 1k-Italian
    features:
    • name: prompt
      dtype: string
    • name: completion
      dtype: string
    • name: score
      dtype: int64
      splits:
    • name: train
      num_bytes: 1521293
      num_examples: 1000
      download_size: 891313
      dataset_size: 1521293
  • config_name: 1k-Portuguese
    features:
    • name: prompt
      dtype: string
    • name: completion
      dtype: string
    • name: score
      dtype: int64
      splits:
    • name: train
      num_bytes: 1504355
      num_examples: 1000
      download_size: 897872
      dataset_size: 1504355
  • config_name: 1k-Spanish
    features:
    • name: prompt
      dtype: string
    • name: completion
      dtype: string
    • name: score
      dtype: int64
      splits:
    • name: train
      num_bytes: 1518093
      num_examples: 1000
      download_size: 881741
      dataset_size: 1518093
  • config_name: 1k-Thai
    features:
    • name: prompt
      dtype: string
    • name: completion
      dtype: string
    • name: score
      dtype: int64
      splits:
    • name: train
      num_bytes: 3432191
      num_examples: 1000
      download_size: 1125403
      dataset_size: 3432191
      configs:
  • config_name: 1k-English
    data_files:
    • split: train
      path: 1k-English/train-*
  • config_name: 1k-French
    data_files:
    • split: train
      path: 1k-French/train-*
  • config_name: 1k-German
    data_files:
    • split: train
      path: 1k-German/train-*
  • config_name: 1k-Hindi
    data_files:
    • split: train
      path: 1k-Hindi/train-*
  • config_name: 1k-Italian
    data_files:
    • split: train
      path: 1k-Italian/train-*
  • config_name: 1k-Portuguese
    data_files:
    • split: train
      path: 1k-Portuguese/train-*
  • config_name: 1k-Spanish
    data_files:
    • split: train
      path: 1k-Spanish/train-*
  • config_name: 1k-Thai
    data_files:
    • split: train
      path: 1k-Thai/train-*

from concurrent.futures import ThreadPoolExecutor, as_completed
from datasets import load_dataset, Dataset
from typing import Optional
from threading import Lock
from tqdm import tqdm
import cohere
import time
import os


PROMPT_TEMPLATE = """Translate the following text from English to {target_language}.
Provide only the translated text without any additional explanation or formatting:
'{prompt}'"""

request_counter = 0
counter_lock = Lock()


def generate_w_cohere(prompt: str, model: str = "c4ai-aya-expanse-8b"):
    global request_counter
    with counter_lock:
        if request_counter >= 475:  # Rate limit for Cohere API is 500 requests per minute
            time.sleep(60)
            request_counter = 0
        request_counter += 1

    co = cohere.ClientV2(os.environ["COHERE_API_KEY"])
    response = co.chat(
        model=model,
        messages=[{"role": "user", "content": prompt}],
    )
    return response.message.content[0].text


def translate_w_cohere(
    dataset_path: str="PRLM/distilabel-intel-orca-dpo-pairs-balanced-subsets",
    subset: str="1k",
    split: str="train", 
    prompt_column: str="prompt", 
    response_column: str="completion",
    score_column: str="score",
):
    ds = load_dataset(dataset_path, subset, split=split).select_columns([prompt_column, response_column, score_column])

    for language in ["German", "Italian", "Portuguese", "Hindi", "Spanish", "Thai"]:  # "English", "French", 
        if language != "English":
            prompts = [PROMPT_TEMPLATE.format(target_language=language, prompt=prompt) for prompt in ds[prompt_column]]
            responses = [PROMPT_TEMPLATE.format(target_language=language, prompt=response) for response in ds[response_column]]
            
            prompt_translations = [None] * len(prompts)
            response_translations = [None] * len(responses)

            with ThreadPoolExecutor() as executor:
                prompt_futures = {executor.submit(generate_w_cohere, prompt): prompt for prompt in prompts}
                response_futures = {executor.submit(generate_w_cohere, response): response for response in responses}

                for future in tqdm(as_completed(prompt_futures), total=len(prompts), desc=f"Translating prompts to {language}", unit="prompt"):
                    index = prompts.index(prompt_futures[future])
                    prompt_translations[index] = future.result()

                for future in tqdm(as_completed(response_futures), total=len(responses), desc=f"Translating responses to {language}", unit="response"):
                    index = responses.index(response_futures[future])
                    response_translations[index] = future.result()
        else:
            prompt_translations = ds[prompt_column]
            response_translations = ds[response_column]

        translated_dataset = Dataset.from_dict({
            prompt_column: prompt_translations,
            response_column: response_translations,
            score_column: ds[score_column],
        })
        translated_dataset.push_to_hub(
            dataset_path+"-translated",
            subset+"-"+language,
            split="train", 
            private=True,
            token=os.environ["HF_TOKEN"],
        )


if __name__ == "__main__":
    import fire
    fire.Fire(translate_w_cohere)

README history 19 revisions

Every night we snapshot the README of every dataset in the catalog. When the SHA changes we archive the new version and diff it against the last. This is the evolving thought record of the alignment-data field: what the author decided to say about the corpus, and how that framing shifted over time.

  1. 2025-05-06Update README.md152d12b6 KB
    Loading...
  2. 2025-05-06Upload dataset7e660806 KB
    Loading...
  3. 2025-05-06Upload dataseta27678b6 KB
    Loading...
  4. 2025-05-06Upload datasetb2b11ae6 KB
    Loading...
  5. 2025-05-06Upload datasetf3d9c2a6 KB
    Loading...
  6. 2025-05-06Upload dataset43f2d096 KB
    Loading...
  7. 2025-05-06Upload datasete0fb1746 KB
    Loading...
  8. 2025-05-06Upload dataset54c98e96 KB
    Loading...
  9. 2025-05-06Upload dataset2dc7c036 KB
    Loading...
  10. 2025-04-16Update README.mdff42d696 KB
    Loading...
  11. 2025-04-15Upload datasetfb0eaad2.7 KB
    Loading...
  12. 2025-04-15Upload dataset3c168b22.4 KB
    Loading...
  13. 2025-04-15Upload datasetacc0c962.1 KB
    Loading...
  14. 2025-04-15Upload datasetf177e1e1.7 KB
    Loading...
  15. 2025-04-15Upload dataset5fe63441.4 KB
    Loading...
  16. 2025-04-15Upload dataset9f1cdd51 KB
    Loading...
  17. 2025-04-15Upload datasetc6b7039726 B
    Loading...
  18. 2025-04-15Upload dataset731839e380 B
    Loading...
  19. 2025-04-15initial commit8388f3e0 B
    Loading...

Used by abliterated models none yet

No abliterated models in our catalog have declared this dataset in their YAML metadata yet. This can mean the dataset is used but not declared, is used outside abliteration workflows, or is new. The link will populate automatically as models are indexed.

Community discussions 1 thread · 1 open · 1 comments

Threads posted by the community on Hugging Face: bug reports, questions about usage, pull requests on the README, license clarifications. Click any thread to expand and read the full conversation inline. Newest first.

  1. 2025-04-17[bot] Conversion to Parquetopen1 💬#1
    Loading...

Related datasets same stage · heal

Read further

Repository

Download the dataset

0

Copy any of these snippets into your notebook or terminal. All three fetch directly from Hugging Face using your own credentials.

Recommended: datasets library (Python)
from datasets import load_dataset
ds = load_dataset("PRLM/distilabel-intel-orca-dpo-pairs-balanced-subsets-translated")
Raw snapshot (Python)
from huggingface_hub import snapshot_download
snapshot_download(repo_id="PRLM/distilabel-intel-orca-dpo-pairs-balanced-subsets-translated", repo_type="dataset")
git clone (requires git-lfs)
git clone https://huggingface.co/datasets/PRLM/distilabel-intel-orca-dpo-pairs-balanced-subsets-translated
Catalog is the map. Apps are the tools.

Run models on your own machine, not in the cloud.

Every model page has an "Open in Abliteration" button that hands the model directly to the first-party desktop client, at the quantization your rig can actually run. No API keys, no subscription, no prompt leakage.

Open in Abliteration