[KDD'2026] "VideoRAG: Chat with Your Videos"
Python large-language-modelsllmslong-video-understandingmulti-modal-llmsragretrieval-augmented-generation
Added a Jupyter notebook to test own videos
Gerald Hewesaa20c76a8e89
diff --git a/notesbooks/videorag.ipynb b/notesbooks/videorag.ipynbnew file mode 100644index 0000000..582e9b1--- /dev/null+++ b/notesbooks/videorag.ipynb@@ -0,0 +1,115 @@+{+ "cells": [+ {+ "cell_type": "code",+ "execution_count": null,+ "id": "c1e12bf6-a8ae-4fec-9fbd-99ea74bcc563",+ "metadata": {},+ "outputs": [],+ "source": [+ "import os\n",+ "import logging\n",+ "import warnings\n",+ "import multiprocessing\n",+ "import nest_asyncio\n",+ " \n",+ "nest_asyncio.apply()\n",+ "\n",+ "warnings.filterwarnings(\"ignore\")\n",+ "logging.getLogger(\"httpx\").setLevel(logging.WARNING)\n",+ "os.environ[\"CUDA_VISIBLE_DEVICES\"] = '0'\n",+ "\n",+ "from videorag._llm import *\n",+ "from videorag import VideoRAG, QueryParam\n",+ "\n",+ "\n"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "id": "f04cee24-fd8e-41dc-93ea-888229d2a9af",+ "metadata": {},+ "outputs": [],+ "source": [+ "video_paths = [\n",+ " '/mnt/data3/AI/software/VideoRAG/Lexington/GMT20241112-164602_Recording_gallery_1280x720.mp4',\n",+ "]"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "id": "1a8b5f05-12e8-4b53-b84c-e4555fc99022",+ "metadata": {},+ "outputs": [],+ "source": [+ "multiprocessing.set_start_method('spawn')"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "id": "7539e57b-11c2-42a9-b8f1-2363e0f561df",+ "metadata": {},+ "outputs": [],+ "source": [+ "videorag = VideoRAG(cheap_model_func=ollama_mini_complete, best_model_func=ollama_complete, working_dir=f\"./videorag-workdir/lexington\")\n",+ "videorag.insert_video(video_path_list=video_paths)"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "id": "6a938da7-5c33-44a3-a66e-a2e07636ce70",+ "metadata": {},+ "outputs": [],+ "source": [+ "videorag.load_caption_model(debug=False)\n",+ "param = QueryParam(mode=\"videorag\")"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "id": "15d51fb9-06e9-44e0-83ef-f3269c50480f",+ "metadata": {},+ "outputs": [],+ "source": [+ "query = \"Can you summarize this video?\"\n",+ "param.wo_reference = False\n",+ "response = videorag.query(query=query, param=param)\n",+ "print(response)"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "id": "4d517d22-a482-47a1-a4ac-89d0042b016f",+ "metadata": {},+ "outputs": [],+ "source": []+ }+ ],+ "metadata": {+ "kernelspec": {+ "display_name": "Python [conda env:videorag]",+ "language": "python",+ "name": "conda-env-videorag-py"+ },+ "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.11.11"+ }+ },+ "nbformat": 4,+ "nbformat_minor": 5+}