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

[Bug Fix] update load_dataset to support long data #878

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lmflow/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pathlib import Path
from typing import Optional

from datasets import load_dataset
from datasets import load_dataset, Features, Value
from datasets import Dataset as HFDataset

from lmflow.args import DatasetArguments
Expand Down Expand Up @@ -113,12 +113,14 @@ def __init__(self, data_args: DatasetArguments=None, backend: str="huggingface",

# Load the dataset using the HuggingFace dataset library
extensions = "json"
data_types = Features({'conversation_id': Value(dtype='int64', id=None), 'system': Value(dtype='string', id=None), 'messages': [{'content': Value(dtype='large_string', id=None), 'role': Value(dtype='string', id=None)}]})
raw_dataset = load_dataset(
extensions,
data_files=data_files,
field=KEY_INSTANCES,
split="train",
use_auth_token=None,
features=data_types
)
self.backend_dataset = raw_dataset
self._check_data_format()
Expand Down Expand Up @@ -442,4 +444,4 @@ def save(
json.dump(self.to_dict(), fout, indent=4, ensure_ascii=False)

else:
logger.error(f"Unsupported format when saving the dataset: {format}.")
logger.error(f"Unsupported format when saving the dataset: {format}.")
Loading