dataset-import.md
| source_path | references/dataset-quality/references/dataset-import.md |
|---|---|
| source_sha256 | f257e307c70c2d0a6b6c6312f124dbaa6bd3f4b7a2581bd222170e547746850c |
| source_url | https://github.com/aws/agent-toolkit-for-aws/blob/903433d67cc4eeab334355620373f33a0c162dd4/skills/core-skills/aws-ai-ml/references/dataset-quality/references/dataset-import.md |
| supporting_skill_id | 40202 |
| upstream_revision | 903433d67cc4eeab334355620373f33a0c162dd4 |
Dataset Import (BYOD)
The hub registration of a bring-your-own-data (BYOD) dataset: one data file, local or in S3, becomes
a Dataset entity whose HubContentArn is the DatasetArn a quality evaluation takes. Read this page
on the BYOD entry point only; an SDG result or a known Dataset ARN needs no import
(references/dataset-service-api.md, "Verify the import").
The import runs in the generated notebook, after the user confirms the plan
(references/quality-job-submit.md, "Confirm the plan"): Cell 6 uploads a local file and Cell 7
registers the dataset. references/quality-job.md Step 8 only collects the location and verifies
access; nothing is uploaded or registered before the confirmation, and the plan states that the run
registers a Dataset entity in the account's SageMaker AI Registry, creating that hub when the account has
none. Both can be removed afterwards (aws sagemaker delete-hub-content, then aws sagemaker delete-hub;
the commands are below).
The call
Cell 7 of code_templates/notebook_cells.py registers the dataset with the SDK: DataSet.create(name=HUB_CONTENT_NAME, source=DATASET_S3_URI, dataset_file_format=DATASET_FORMAT, role=REGISTRATION_ROLE_ARN, validation_role_arn=VALIDATION_ROLE_ARN, wait=False, sagemaker_session=session),
then dataset.wait(), and DATASET_ARN = dataset.arn. The code is the cell's; copy nothing from here.
nameis the Hub content name collected at Step 8.sourceis the full S3 URI of the one data
file.dataset_file_formatis the detector's result from Step 9.sagemaker_sessionis Cell 3's
session, so the import runs in the job's region. Nohub_name, no version and no document are
passed: the SDK writes the document and picks the version. A.parquetfile is registered as
Custom, the result the detector gives it.roleandvalidation_role_arnare both the plan's role, Cell 3'sROLE_ARN(Step 11 item 3).
For aCustomregistration the cell'sVALIDATION_ROLE_ARNis None, so no validation role is passed.- The SDK also validates
roleitself, so the cell passes the plan's role there too; a refused
role is a Common Errors row ofreferences/troubleshooting.md. WhenROLE_ARNis None (the session
identity is itself a SageMaker execution role) the SDK's resolver,TrainDefaults.get_role, names
that role. wait=Falsereturns the entity as soon as the import call succeeds; the cell'sdataset.wait()
polls until the entry is Available.- The returned object carries
name,versionandarn;arnis theDatasetArnCell 8 sends. - Before the import the SDK downloads the file to check it (
s3:HeadObjectands3:GetObjecton
the key) and resolves an execution role (iam:GetRole). The notebook's credentials need those
calls.
What the SDK writes
-
DocumentSchemaVersion5.0.0, and aHubContentDocumentof four fields:DatasetTypeBYOD,
DatasetFileFormat(the format passed),DatasetS3Bucket(the bucket of the source URI) and
DatasetS3Prefix(the full object key, filename included). The service adds a
ValidationManifestand its own search keywords. -
A search keyword and a tag
method:generatedon the entry. -
The version. The SDK looks the name up in the account's SageMaker AI Registry. A name not found there
gets version 1.0.0. A name already registered gets the next major version (1.0.0 is followed by
2.0.0). A re-import under the same name is therefore a new version; nothing is overwritten, and
the old version keeps its ARN. -
The format is recorded as passed; the SDK does not check it against the file. Step 9 runs the detector.
Where it registers
The entry goes into the account's SageMaker AI Registry for the session's region, the hub the SDK and the
fine-tuning template use. Its name is a hash the SDK derives from the region and the account; its
display name is AiRegistry-<region>-<account>. The SDK creates the hub when the account has none.
There is no hub choice: the cell passes no hub_name (what passing one does is a Common Errors row of
references/troubleshooting.md).
What the source must be
- One data file whose key ends in
.jsonl,.csv,.parquetor.json. The SDK refuses any other
source before it makes a call (Unsupported file extension); a folder has no extension and is
refused the same way. - The service evaluates one data file per dataset entry. A location holding several
.jsonlor
.csvfiles is rejected before compute withcontains N dataset files, so a folder of several
files is not a dataset the job can take. A.jsonfile registers, but the job does not read that
format; the formats the job reads are.jsonl,.csvand.parquet. - A user's S3 folder: list it with
aws s3 ls s3://<bucket>/<folder>/. One data file inside
means its key is the source. Several means you say, in one sentence, that the service evaluates
one data file per dataset and ask which file. - A local file: Cell 6 uploads it to
s3://<input bucket>/byod/<hub content name>/<filename>, and
that URI is the source.
Removing a registration
A registration the user does not want is removed with the hub name from the returned ARN
(arn:aws:sagemaker:<region>:<account>:hub-content/<hub>/DataSet/<name>/<version>):
aws sagemaker delete-hub-content --hub-name <hub> --hub-content-type DataSet --hub-content-name <name> --hub-content-version <version>
One command per version. A hub the run created (the account had none before) can be removed after
its contents with aws sagemaker delete-hub --hub-name <hub>; the SDK creates it again on the next
import.
Children
No children yet.
Like how this is organised?
Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.