extract 0 0 0

kh4dien/hh-rlhf-helpful-only

published by @kh4dien

Alignment dataset tracked in the /datasets sub-catalog.

Lifetime downloads
329
Last 30 days
17
Likes
-
Size
131.4 MB
Created on HF
2025-01-16
Age
1 years ago

Description

from datasets import Dataset, DatasetDict

from collections import defaultdict

import re

import random

import json

data = defaultdict(list)

paths = {

"test_online": "./test_online.jsonl",

"train_online": "./train_online.jsonl",

"test_rejection": "./test_rejection.jsonl",

"train_rejection": "./train_rejection.jsonl",

}

for name, path in paths.items():

with open(path, "r") as f:

for line in f:

data[name].append(json.loads(line))

def split_data(text):… See the full description on the dataset page: https://huggingface.co/datasets/kh4dien/hh-rlhf-helpful-only.

Tags

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

README current version from Hugging Face


dataset_info:
features:

  • name: chosen
    list:
    • name: content
      dtype: string
    • name: role
      dtype: string
  • name: rejected
    list:
    • name: content
      dtype: string
    • name: role
      dtype: string
  • name: source
    dtype: string
    splits:
  • name: train
    num_bytes: 188419627
    num_examples: 74428
  • name: sft
    num_bytes: 50539545
    num_examples: 20000
  • name: test
    num_bytes: 9934147
    num_examples: 3886
    download_size: 137739490
    dataset_size: 248893319
    configs:
  • config_name: default
    data_files:
    • split: train
      path: data/train-*
    • split: sft
      path: data/sft-*
    • split: test
      path: data/test-*

from datasets import Dataset, DatasetDict
from collections import defaultdict
import re
import random
import json

data = defaultdict(list)

paths = {
    "test_online": "./test_online.jsonl",
    "train_online": "./train_online.jsonl",
    "test_rejection": "./test_rejection.jsonl",
    "train_rejection": "./train_rejection.jsonl",
}

for name, path in paths.items():
    with open(path, "r") as f:
        for line in f:
            data[name].append(json.loads(line))

def split_data(text):
    delimiter = r"\n\nHuman: |\n\nAssistant: "
    messages = re.split(delimiter, text)[1:]

    conversation = []
    for i, message in enumerate(messages):
        if i % 2 == 0:
            conversation.append({"role": "user", "content": message})
        else:
            conversation.append({"role": "assistant", "content": message})

    return conversation

def fix(row, source):
    return {
        "chosen": split_data(row["chosen"]),
        "rejected": split_data(row["rejected"]),
        "source": source,
    }

train_rejection = [fix(d, "rejection") for d in data["train_rejection"]]
train_online = [fix(d, "online") for d in data["train_online"]]
test_rejection = [fix(d, "rejection") for d in data["test_rejection"]]
test_online = [fix(d, "online") for d in data["test_online"]]

train = train_rejection + train_online
test = test_rejection + test_online

sft_mix = random.sample(train, 20_000)

dataset = DatasetDict({
    "train": Dataset.from_list(train),
    "sft" : Dataset.from_list(sft_mix),
    "test": Dataset.from_list(test)
})

dataset.push_to_hub(<repo-id>)

README history 4 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-01-16Update README.md4f27ea92.2 KB
    Loading...
  2. 2025-01-16Upload dataset4c3fe97690 B
    Loading...
  3. 2025-01-16Upload dataset7725b81592 B
    Loading...
  4. 2025-01-16initial commit64b64ff0 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-01-17[bot] Conversion to Parquetopen1 💬#1
    Loading...

Related datasets same stage · extract

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("kh4dien/hh-rlhf-helpful-only")
Raw snapshot (Python)
from huggingface_hub import snapshot_download
snapshot_download(repo_id="kh4dien/hh-rlhf-helpful-only", repo_type="dataset")
git clone (requires git-lfs)
git clone https://huggingface.co/datasets/kh4dien/hh-rlhf-helpful-only
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