{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "fe960667",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "from datasets import load_from_disk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "514aa738",
   "metadata": {},
   "outputs": [],
   "source": [
    "task = \"sst2_aug\"\n",
    "data_dir = f\"/home/ubuntu/space3/data/created/heuristic/keywords-v2/prompt_dataset/dis/{task}\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "61365bb2",
   "metadata": {},
   "outputs": [],
   "source": [
    "train_file = os.path.join(data_dir, \"train.pt\")\n",
    "train_data = load_from_disk(train_file)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "5f211286",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Loading cached processed dataset at /home/ubuntu/space3/data/created/heuristic/keywords-v2/prompt_dataset/dis/sst2_aug/train.pt/cache-6aa0d6324d83e3b6.arrow\n"
     ]
    }
   ],
   "source": [
    "filtered_train = train_data.filter(lambda x: \"It was great\" in x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "b2749389",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Dataset({\n",
       "    features: ['char_end', 'char_start', 'keyword', 'label', 'prompt'],\n",
       "    num_rows: 0\n",
       "})"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filtered_train"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fe251471",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.8.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
