Updated on 2024-06-12 GMT+08:00

Querying a Sample List

Obtain the sample list of a dataset. Table datasets are not supported.

dataset.list_samples(version_id=None, offset=None, limit=None)

Sample Code

  • Example 1: Obtain a dataset sample list.
    from modelarts.session import Session
    from modelarts.dataset import Dataset
    session = Session()
    
    dataset = Dataset(session, dataset_id)
    list_samples_resp = dataset.list_samples()
    print(list_samples_resp) # Print the sample list.
  • Example 2: Obtain the sample list of a specified dataset version.
    list_samples_resp = dataset.list_samples(version_id = "cSPuXPgnYp7ObRs6LaR")
    print(list_samples_resp)

Parameters

Table 1 Request parameters

Parameter

Mandatory

Type

Description

version_id

No

String

Dataset version ID, which can be used for obtaining the sample list of this dataset version.

offset

No

Integer

Start page for pagination display. The default value is 0.

limit

No

Integer

Maximum number of records returned on each page. The value ranges from 1 to 100. The default value is 10.