Skip to content

cookbook data loading doesn't match with the HF dataset data type #91

@Wendong-Fan

Description

@Wendong-Fan

in the https://github.com/camel-ai/loong/blob/main/cookbooks/env_with_generator.ipynb we added process_sample to convert string into dict, better approach would be update the HF dataset data type into dict natively

from camel.datasets import StaticDataset
from datasets import load_dataset
import json

# Load the dataset and select a specific split
dataset = load_dataset("camel-ai/loong", "graph_discrete_math", split="train")

# # Convert metadata from string to dict
# def process_sample(sample):
#     if isinstance(sample['metadata'], str):
#         sample['metadata'] = json.loads(sample['metadata'])
#     return sample

# # Apply the processing to all samples
# dataset = dataset.map(process_sample)

seed_dataset = StaticDataset(dataset)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions