tlc.integration.hugging_face.table_from_hugging_face#

A Table object for representing a Hugging Face dataset.

Module Contents#

Classes#

Class

Description

TableFromHuggingFace

A Table object for representing a Hugging Face dataset.

API#

class tlc.integration.hugging_face.table_from_hugging_face.TableFromHuggingFace(hugging_face_path: str | None = None, hugging_face_name: str | None = None, hugging_face_split: str | None = None, url: tlc.core.url.Url | None = None, created: str | None = None, row_cache_url: tlc.core.url.Url | None = None, row_cache_populated: bool | None = None, override_table_rows_schema: Any = None, init_parameters: Any = None)#

Bases: tlc.core.objects.Table

A Table object for representing a Hugging Face dataset.

The TableFromHuggingFace class is an interface between 3LC and the Hugging Face datasets library. For datasets with multiple subsets, use hugging_face_name to specify the subset. Use hugging_face_split to specify the desired split.

Example:

table = TableFromHuggingFace(
    hugging_face_path="glue",
    hugging_face_name="mrpc",
    hugging_face_split="train",
)
print(table.table_rows[0])
Parameters:
  • hugging_face_path – The path to the Hugging Face dataset.

  • hugging_face_name – Name or configuration of the subset. Optional.

  • hugging_face_split – The split to use. Optional, defaults to train.

Returns:

An instance of the TableFromHuggingFace class.

Raises:

ValueError if the Hugging Face dataset is not provided.

property hf_dataset: datasets.Dataset#
property sample_type: tlc.client.sample_type.SampleType#