{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "a78759c8", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/firouzi/embedding_model/.venv/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n", "/home/firouzi/embedding_model/.venv/lib/python3.10/site-packages/datasets/load.py:1461: FutureWarning: The repository for persiannlp/parsinlu_reading_comprehension contains custom code which must be executed to correctly load the dataset. You can inspect the repository content at https://hf.co/datasets/persiannlp/parsinlu_reading_comprehension\n", "You can avoid this message in future by passing the argument `trust_remote_code=True`.\n", "Passing `trust_remote_code=True` will be mandatory to load this dataset from the next major release of `datasets`.\n", " warnings.warn(\n" ] } ], "source": [ "from datasets import load_dataset, VerificationMode\n", "\n", "dataset = load_dataset(\"persiannlp/parsinlu_reading_comprehension\", verification_mode=VerificationMode.NO_CHECKS)" ] }, { "cell_type": "code", "execution_count": 10, "id": "c91f659a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "600\n" ] } ], "source": [ "all_dataset = []\n", "for data in dataset[\"train\"]:\n", " all_dataset.append({'question': data['question'], 'passgae_positive': [data['context']], 'passgae_negative': []})\n", "\n", "print(len(all_dataset))" ] }, { "cell_type": "code", "execution_count": 11, "id": "d66809ce", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'question': 'چرا جوجه ها عطسه میکنند؟', 'passgae_positive': ['همه ما عطسه می کنیم ، عطسه واکنشی است نسبت به احساس خارش و سوزش در سوراخ بینی که معمولا با آبریزش بینی همراه است . بیشتر پرندگان به طور نرمال در تلاش برای بیرون راندن گردها از بینی خود گاهی اوقات عطسه می کنند . اما آیا همیشه باید به عطسه پرنده یا طوطی خود توجه کنیم ؟ اگر طوطی گاهی اوقات عطسه کند و در این حین مایع شفافی از بینی او خارج شود ( کمتر از یک یا دوبار در روز)، بدون اینکه علایم دیگری از خود نشان دهد ، شاید او در حال اعمال مکانیسمی نرمال برای پاک کردن سوراخ بینی خود است . دلایل زیادی برای عطسه کردن و ترشح بینی طوطی وجود دارد.'], 'passgae_negative': []}\n" ] } ], "source": [ "print(all_dataset[10])" ] }, { "cell_type": "code", "execution_count": null, "id": "e2f94154", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": ".venv", "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.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }