def remove_existing_dataset()

in cookbook-efforts/dpo-orpo-preference/aya_dpo_gen.py [0:0]


def remove_existing_dataset(argilla_dataset_name: str):
    """Remove an existing dataset from Argilla. This is useful when re-running the pipeline multiple times."""
    try:
        rg.init(
            api_url=ARGILLA_SPACE_URL,
            api_key=ARGILLA_API_KEY,
            workspace=ARGILLA_WORKSPACE_NAME,
        )
        argilla_ds = rg.FeedbackDataset.from_argilla(argilla_dataset_name)
        argilla_ds.delete()
    except ValueError as e:
        print(e)