RLHF के लिए डेटा तैयार करना

मानवीय फीडबैक से रिइनफोर्समेंट लर्निंग (RLHF)

Mina Parham

AI Engineer

Preference बनाम Prompt डेटासेट

पूरा RLHF प्रोसेस.

मानवीय फीडबैक से रिइनफोर्समेंट लर्निंग (RLHF)

Preference बनाम Prompt डेटासेट

प्रारंभिक prompt डेटासेट के साथ पूरा RLHF प्रोसेस.

मानवीय फीडबैक से रिइनफोर्समेंट लर्निंग (RLHF)

Preference बनाम Prompt डेटासेट

प्रारंभिक prompt डेटासेट और reward मॉडल में जाने वाला preference डेटासेट के साथ पूरा RLHF प्रोसेस.

मानवीय फीडबैक से रिइनफोर्समेंट लर्निंग (RLHF)

Prompt डेटासेट

  • मॉडल के लिए प्रश्न
  • Hugging Face datasets पर मिल सकते हैं
prompt_data = load_dataset("center-for-humans-and-machines/rlhf-hackathon-prompts", 
                           split="train")
prompt_data['prompt'][0]
'How important is climate change?'
  • कभी-कभी prompt निकालना पड़ सकता है
  • ऐसे मार्कर देखें: Input=, {{Text}}:, ###Human:
मानवीय फीडबैक से रिइनफोर्समेंट लर्निंग (RLHF)

Preference डेटासेट को एक्सप्लोर करना

from datasets import load_dataset
preference_data = load_dataset("qgallouedec/hh-rlhf-helpful-base-trl-style", 
                               split="train")
मानवीय फीडबैक से रिइनफोर्समेंट लर्निंग (RLHF)

Preference डेटासेट प्रोसेस करना

def extract_prompt(text):
    # Extract the prompt as the first element in the list
    prompt = text[0]["content"]
    return prompt
# Apply the extraction function to the dataset
preference_data_with_prompt = preference_data.map(
    lambda example: {**example, 'prompt': extract_prompt(example['chosen'])}
)
  • prompts निकालने का तरीका हर डेटासेट में अलग होता है
मानवीय फीडबैक से रिइनफोर्समेंट लर्निंग (RLHF)

अंतिम preference डेटासेट

sample = preference_data_with_prompt.select(range(1))
sample['prompt']
'What vitamins are essential for the body to function?'
sample['chosen']
[ { "content": "What vitamins are essential for the body to function?", "role": 
   "user" }, { "content": "There are some very important vitamins that ensure the 
   proper functioning of the body, including Vitamins A, C, D, E, and K along ...}]
मानवीय फीडबैक से रिइनफोर्समेंट लर्निंग (RLHF)

अभ्यास करते हैं!

मानवीय फीडबैक से रिइनफोर्समेंट लर्निंग (RLHF)

Preparing Video For Download...