{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Explore Dataset: docugami/dfm-csl-large-benchmark\n", "\n", "See [README](./README.md) for more information" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "DATASET_NAME=\"Docugami/dfm-csl-large-benchmark\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# install dependencies and get a token\n", "!pip install datasets huggingface_hub ipywidgets\n", "\n", "from huggingface_hub import notebook_login\n", "notebook_login()\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Explore Dataset" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Found cached dataset parquet (/root/.cache/huggingface/datasets/docugami___parquet/docugami--dfm-csl-large-benchmark-1b323996e223b130/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec)\n" ] }, { "data": { "text/plain": [ "Dataset({\n", " features: ['Text', 'Ground Truth', 'docugami/dfm-csl-large'],\n", " num_rows: 1088\n", "})" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from datasets import load_dataset\n", "\n", "# Download and check out metadata for dataset\n", "dataset = load_dataset(\"docugami/dfm-csl-large-benchmark\", split=\"eval\")\n", "dataset" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'Text': \"Tenant, at all times during the term of this Lease and at Tenant's expense, shall provide and keep in force with insurers reasonably approved by Landlord Commercial General Liability insurance against all claims for personal injury, bodily injury, death or property damage occurring upon, in or about the Premises, such insurance (a) to be on an occurrence basis with a general aggregate of not less than\",\n", " 'Ground Truth': 'Commercial General Liability Insurance',\n", " 'docugami/dfm-csl-large': 'Commercial General Liability Insurance'}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# let's look at one of the rows\n", "dataset[-1]" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Update Dataset from Github\n", "Note: this requires write access to the dataset." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# download latest CSV from github\n", "!wget -P ./temp https://raw.githubusercontent.com/docugami/DFM-benchmarks/main/data/annotations/CSL-Large.csv" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from datasets import Dataset\n", "\n", "# Load the data from the csv\n", "dataset = Dataset.from_csv('./temp/CSL-Large.csv')\n", "\n", "# Push the dataset to the Hugging Face Hub\n", "dataset.push_to_hub(DATASET_NAME, split=\"eval\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.16" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }