Person Sampler Tutorial
π§βπ€βπ§ NeMo Data Designer: Person Sampler Tutorial
π What you'll learn
In this notebook, we'll explore how you can generate realistic personal information for your synthetic datasets.
π IMPORTANT βΒ Environment Setup
If you haven't already, follow the instructions in the README to install the necessary dependencies.
You may need to restart your notebook's kernel after setting up the environment.
In this notebook, we assume you have a self-hosted instance of Data Designer up and running.
For deployment instructions, see the Installation Options section of the NeMo Data Designer documentation.
What is the Person Sampler?
The Person Sampler is a powerful feature in NeMo Data Designer that generates consistent, realistic person records with attributes like:
- Names (first, middle, last)
- Contact information (email, phone)
- Addresses (street, city, state, zip)
- Demographics (age, gender, ethnicity)
- IDs (SSN, UUID)
- And more!
These records are fully synthetic but maintain the statistical properties and formatting patterns of real personal data.
π¦ Import the essentials
-
The
data_designermodule ofnemo_microservicesexposes Data Designer's high-level SDK. -
The
essentialsmodule provides quick access to the most commonly used objects.
βοΈ Initialize the NeMo Data Designer Client
NeMoDataDesignerClientis responsible for submitting generation requests to the microservice.
ποΈ Define model configurations
-
Each
ModelConfigdefines a model that can be used during the generation process. -
The "model alias" is used to reference the model in the Data Designer config (as we will see below).
-
The "model provider" is the external service that hosts the model (see the model config docs for more details).
-
By default, the microservice uses build.nvidia.com as the model provider.
ποΈ Initialize the Data Designer Config Builder
-
The Data Designer config defines the dataset schema and generation process.
-
The config builder provides an intuitive interface for building this configuration.
-
The list of model configs is provided to the builder at initialization.
1. Basic Person Sampling
Let's start with a simple example of generating person data using the default settings.
2. Accessing Individual Person Attributes
The person column we created above is a nested object with many attributes. Let's create some columns to access specific attributes from this person object.
3. Customizing Person Generators
-
Now let's explore customizing the Person Sampler to generate specific types of profiles.
-
The persona samplers allow you to sample realistic details of individuals using a model trained on the US Census.
If the locale of the persona you are generating is anything other thanen_US, then the personas will be generated using Faker
4. Available Person Attributes
The Person Sampler generates a rich set of attributes that you can use. Here's a reference list of some of the key attributes available:
| Attribute | Description | Example |
|---|---|---|
first_name | Person's first name | "John" |
middle_name | Person's middle name (may be None) | "Robert" |
last_name | Person's last name | "Smith" |
sex | Person's sex | "Male" |
age | Person's age in years | 42 |
birth_date | Date of birth | "1980-05-15" |
email_address | Email address | "john.smith@example.com" |
phone_number | Phone number | "+1 (555) 123-4567" |
street_number | Street number | "123" |
street_name | Street name | "Main Street" |
unit | Apartment/unit number | "Apt 4B" |
city | City name | "Chicago" |
state | State/province (locale dependent) | "IL" |
county | County (locale dependent) | "Cook" |
zipcode | Postal/ZIP code | "60601" |
country | Country name | "United States" |
ssn | Social Security Number (US locale) | "123-45-6789" |
occupation | Occupation | "Software Engineer" |
marital_status | Marital status | "Married" |
education_level | Education level | "Bachelor's Degree" |
ethnic_background | Ethnic background | "Caucasian" |
uuid | Unique identifier | "550e8400-e29b-41d4-a716-446655440000" |
5. Creating Multiple Person Samplers with One Method
For convenience, Data Designer provides a with_person_samplers method to create multiple person samplers at once.
6. Using Person Data with LLM Generation
One of the most powerful features of Data Designer is combining structured person data with LLM generation to create realistic, contextual content.
π Scale up!
-
Happy with your preview data?
-
Use the
createmethod to submit larger Data Designer generation jobs.