snorkelai.sdk.client.synthetic.augment_data
- snorkelai.sdk.client.synthetic.augment_data(data, model_name, runs_per_prompt=1, prompt='Rewrite the following text whilst retaining the core meaning.', sync=True, **fm_hyperparameters)
Augment each row of the data by the number of times specified and return a dataframe with the synthetic data as an additional column.
Parameters
Parameters
Return type
Return type
Union
[DataFrame
,str
]Returns
Returns
df – Dataframe containing the augmentations for the data points.
job_id – The job id of the augment data job which can be used to monitor progress with sai.poll_job_status(job_id).
Name Type Default Info data Union[List[str], str]
The data to augment. model_name str
The name of the foundation model to use. runs_per_prompt int
1
The number of times to augment each row. prompt str
'Rewrite the following text whilst retaining the core meaning.'
The prompt prefix to send to the foundation model together with each row. sync bool
True
Whether to wait for the job to complete before returning the result. fm_hyperparameters Any
Additional keyword arguments to pass to the foundation model such as temperature, max_tokens, etc. Examples
>>> sai.augment_data(["hello, how can I help you?", "sorry that is not possible"], "openai/gpt-4")
| text | generated_text | perplexity
--------------------------------------------------------------------------------------------------------------
0 | hello, how can I help you? | welcome, ask me a question to get started | 0.0113636364
1 | sorry that is not possible | unfortunately you cannot do that | 0.8901232123>>> sai.augment_data(["hello, how can I help you?", "sorry that is not possible"], "openai/gpt-4", runs_per_prompt=2)
| text | generated_text | perplexity
--------------------------------------------------------------------------------------------------------------
0 | hello, how can I help you? | welcome, ask me a question to get started | 0.0113636364
1 | sorry that is not possible | unfortunately you cannot do that | 0.8901232123
0 | hello, how can I help you? | Let me know how to get started. | 0.2313232442
1 | sorry that is not possible | bad luck, you cannot do that. | 0.8313232442