Upload folder using huggingface_hub
Browse filesFiles changed (35)
- .gitattributes+4
- README.md+2-1
- VideoAgent/__pycache__/__init__.cpython-310.pyc
- VideoAgent/__pycache__/_utils.cpython-310.pyc
- VideoAgent/__pycache__/base.cpython-310.pyc
- VideoAgent/__pycache__/chunk.cpython-310.pyc
- VideoAgent/__pycache__/prompt.cpython-310.pyc
- VideoAgent/__pycache__/query.cpython-310.pyc
- VideoAgent/__pycache__/vidrag_pipeline.cpython-310.pyc
- VideoAgent/_llm/__pycache__/__init__.cpython-310.pyc
- VideoAgent/_llm/__pycache__/asr_model.cpython-310.pyc
- VideoAgent/_llm/__pycache__/embedding_model.cpython-310.pyc
- VideoAgent/_llm/__pycache__/llm_model.cpython-310.pyc
- VideoAgent/_llm/__pycache__/tokenizer_model.cpython-310.pyc
- VideoAgent/_llm/__pycache__/vlm_model.cpython-310.pyc
- VideoAgent/_server/sherpa_asr_server.py+1-1
- VideoAgent/_storage/__pycache__/__init__.cpython-310.pyc
- VideoAgent/_storage/__pycache__/kv_json.cpython-310.pyc
- VideoAgent/_storage/__pycache__/vdb_nanovectordb.cpython-310.pyc
- VideoAgent/_storage/vdb_nanovectordb.py+2-3
- VideoAgent/_videoutil/__pycache__/__init__.cpython-310.pyc
- VideoAgent/_videoutil/__pycache__/asr.cpython-310.pyc
- VideoAgent/_videoutil/__pycache__/caption.cpython-310.pyc
- VideoAgent/_videoutil/__pycache__/feature.cpython-310.pyc
- VideoAgent/_videoutil/__pycache__/split.cpython-310.pyc
- VideoAgent/_videoutil/split.py+16-3
- image-10.pngAdded
- image-17.pngAdded
- image-2.png
- image-7.pngAdded
- image-8.pngAdded
- image-9.pngAdded
- requirements.txt+1-3
- videorag_longervideos.py+2-2
- webui.py+10-3
39 unmodified lines40414239 unmodified linesVideoAgent/_llm/tokenizer_model/Qwen/Qwen3-4B-Instruct-2507/tokenizer.json filter=lfs diff=lfs merge=lfs -textvideos/origin/sanguo.mp4 filter=lfs diff=lfs merge=lfs -textvideos/processed/sanguo.mp4 filter=lfs diff=lfs merge=lfs -text39 unmodified lines4041424344454639 unmodified linesVideoAgent/_llm/tokenizer_model/Qwen/Qwen3-4B-Instruct-2507/tokenizer.json filter=lfs diff=lfs merge=lfs -textvideos/origin/sanguo.mp4 filter=lfs diff=lfs merge=lfs -textvideos/processed/sanguo.mp4 filter=lfs diff=lfs merge=lfs -textimage-10.png filter=lfs diff=lfs merge=lfs -textimage-7.png filter=lfs diff=lfs merge=lfs -textimage-8.png filter=lfs diff=lfs merge=lfs -textimage-9.png filter=lfs diff=lfs merge=lfs -text
127 unmodified lines12812913013113213313423 unmodified lines158159160127 unmodified lines### 视频索引流程### 查询流程23 unmodified lines## 参考项目- 香港大学数据科学实验室(HKUDS)— [VideoRAG](https://github.com/HKUDS/VideoRAG):超长视频跨模态检索增强生成框架127 unmodified lines12812913013113213313423 unmodified lines158159160161127 unmodified lines### 视频索引流程### 查询流程23 unmodified lines## 参考项目- 香港大学数据科学实验室(HKUDS)— [VideoRAG](https://github.com/HKUDS/VideoRAG):超长视频跨模态检索增强生成框架
43 unmodified lines4445464748495043 unmodified lines"sherpa-onnx-offline",)self.provider = provider or os.getenv("SHERPA_PROVIDER", "axera")self.vad = vad or os.getenv("vad-model", "/root/huangjie/AXERA-TECH/SenseVoice/silero_vad.onnx")if os.path.exists(self.sherpa_bin):os.chmod(self.sherpa_bin, 0o755)43 unmodified lines4445464748495043 unmodified lines"sherpa-onnx-offline",)self.provider = provider or os.getenv("SHERPA_PROVIDER", "axera")# self.vad = vad or os.getenv("vad-model", "/root/huangjie/AXERA-TECH/SenseVoice/silero_vad.onnx")if os.path.exists(self.sherpa_bin):os.chmod(self.sherpa_bin, 0o755)
102 unmodified lines10310410510610710810920 unmodified lines130131132133134135136137102 unmodified linesasync def upsert(self, video_name, segment_index2name, video_output_format):logger.info(f"Inserting {len(segment_index2name)} segments to {self.namespace}")if not len(segment_index2name):logger.warning("You insert an empty data to vector DB")return []20 unmodified linesembeddings.append(batch_embeddings)embeddings = torch.concat(embeddings, dim=0)embeddings = embeddings.cpu().numpy()print("e", embeddings.shape)print("d", len(list_data))for i, d in enumerate(list_data):d["__vector__"] = embeddings[i]102 unmodified lines10310410510610710810920 unmodified lines130131132133134135136102 unmodified linesasync def upsert(self, video_name, segment_index2name, video_output_format):if not len(segment_index2name):logger.warning("You insert an empty data to vector DB")return []20 unmodified linesembeddings.append(batch_embeddings)embeddings = torch.concat(embeddings, dim=0)embeddings = embeddings.cpu().numpy()for i, d in enumerate(list_data):d["__vector__"] = embeddings[i]
8 unmodified lines9101112131415 unmodified lines30313233343536373839404142434445468 unmodified linesimport loggingimport multiprocessinglogger = logging.getLogger(__name__)15 unmodified linesif os.path.exists(output_path):# logger.info(f"Preprocessed video already exists: {output_path}")return output_pathlogger.info(f"Preprocessing video {video_name}: {target_width}x{target_height} @ {target_fps}fps -> {output_path}")cmd = ["ffmpeg", "-y","-i", video_path,"-vf", f"scale={target_width}:{target_height}","-r", str(target_fps),"-c:v", "libx264","-c:a", "aac", # 确保音频被编码"-b:a", "128k","-loglevel", "error",output_path,8 unmodified lines910111213141516171819202122232425262715 unmodified lines43444546474849505152535455565758598 unmodified linesimport loggingimport multiprocessingdef _get_ffmpeg_bin():"""返回支持 libx264 的 ffmpeg 路径"""env_bin = os.getenv("FFMPEG_BIN")if env_bin:return env_bintry:import imageio_ffmpegreturn imageio_ffmpeg.get_ffmpeg_exe()except ImportError:return "ffmpeg"_FFMPEG_BIN = _get_ffmpeg_bin()logger = logging.getLogger(__name__)15 unmodified linesif os.path.exists(output_path):logger.info(f"Preprocessed video already exists: {output_path}")return output_pathlogger.info(f"Preprocessing video {video_name}: {target_width}x{target_height} @ {target_fps}fps -> {output_path}")cmd = [_FFMPEG_BIN, "-y","-i", video_path,"-vf", f"scale={target_width}:{target_height}","-r", str(target_fps),"-c:v", "libx264","-c:a", "aac","-b:a", "128k","-loglevel", "error",output_path,
1234567python-dotenv==1.2.1torchtorchvisiontransformersnumpy==2.2.6Pillow==12.0.0fastapi==0.135.112345python-dotenv==1.2.1numpy==2.2.6Pillow==12.0.0fastapi==0.135.1
20 unmodified lines21222324252627282930313220 unmodified linesmultiprocessing.set_start_method('spawn', force=True)# video文件地址:video_base_path = f'/root/xxx'video_files = sorted(os.listdir(video_base_path))video_paths = [os.path.join(video_base_path, f) for f in video_files]#工作目录videorag = VideoRAG( working_dir=f"/root/xxx")videorag.insert_video(video_path_list=video_paths)querys = "SP视频开头前10秒的内容"20 unmodified lines21222324252627282930313220 unmodified linesmultiprocessing.set_start_method('spawn', force=True)# video文件地址:video_base_path = f'/root/huangjie/VideoAgent_api513/videos/origin'video_files = sorted(os.listdir(video_base_path))video_paths = [os.path.join(video_base_path, f) for f in video_files]#工作目录videorag = VideoRAG( working_dir=f"/root/huangjie/VideoAgent_api513/working_dir")videorag.insert_video(video_path_list=video_paths)querys = "SP视频开头前10秒的内容"
849 unmodified lines850851852853854855856857650 unmodified lines15081509151015111512151315148 unmodified lines1523152415251526152715281529849 unmodified linesif os.path.exists(clip_path):return clip_pathcmd = ["ffmpeg","-y","-ss",f"{start:.3f}",650 unmodified linesprecision=0,)retrieval_topk_chunks_input = gr.Number(label="检索 Top-K 片段数",value=_rag_runtime_settings["retrieval_topk_chunks"],minimum=1,info="检索相关片段的数量",8 unmodified linesprecision=0,)segment_retrieval_top_k_input = gr.Number(label="视频段检索 Top-K 数",value=_rag_runtime_settings["segment_retrieval_top_k"],minimum=1,info="检索相关视频段的数量",849 unmodified lines850851852853854855856857858859860861862863864650 unmodified lines15151516151715181519152015218 unmodified lines1530153115321533153415351536849 unmodified linesif os.path.exists(clip_path):return clip_path# 使用与 split.py 相同的 ffmpeg 选择逻辑try:import imageio_ffmpeg_ffmpeg = imageio_ffmpeg.get_ffmpeg_exe()except ImportError:_ffmpeg = os.getenv("FFMPEG_BIN", "ffmpeg")cmd = [_ffmpeg,"-y","-ss",f"{start:.3f}",650 unmodified linesprecision=0,)retrieval_topk_chunks_input = gr.Number(label="文本段检索 Top-K",value=_rag_runtime_settings["retrieval_topk_chunks"],minimum=1,info="检索相关片段的数量",8 unmodified linesprecision=0,)segment_retrieval_top_k_input = gr.Number(label="视频段检索 Top-K",value=_rag_runtime_settings["segment_retrieval_top_k"],minimum=1,info="检索相关视频段的数量",
.gitattributes+4
README.md+2-1
VideoAgent/__pycache__/__init__.cpython-310.pyc
VideoAgent/__pycache__/_utils.cpython-310.pyc
VideoAgent/__pycache__/base.cpython-310.pyc
VideoAgent/__pycache__/chunk.cpython-310.pyc
VideoAgent/__pycache__/prompt.cpython-310.pyc
VideoAgent/__pycache__/query.cpython-310.pyc
VideoAgent/__pycache__/vidrag_pipeline.cpython-310.pyc
VideoAgent/_llm/__pycache__/__init__.cpython-310.pyc
VideoAgent/_llm/__pycache__/asr_model.cpython-310.pyc
VideoAgent/_llm/__pycache__/embedding_model.cpython-310.pyc
VideoAgent/_llm/__pycache__/llm_model.cpython-310.pyc
VideoAgent/_llm/__pycache__/tokenizer_model.cpython-310.pyc
VideoAgent/_llm/__pycache__/vlm_model.cpython-310.pyc
VideoAgent/_server/sherpa_asr_server.py+1-1
VideoAgent/_storage/__pycache__/__init__.cpython-310.pyc
VideoAgent/_storage/__pycache__/kv_json.cpython-310.pyc
VideoAgent/_storage/__pycache__/vdb_nanovectordb.cpython-310.pyc
VideoAgent/_storage/vdb_nanovectordb.py+2-3
VideoAgent/_videoutil/__pycache__/__init__.cpython-310.pyc
VideoAgent/_videoutil/__pycache__/asr.cpython-310.pyc
VideoAgent/_videoutil/__pycache__/caption.cpython-310.pyc
VideoAgent/_videoutil/__pycache__/feature.cpython-310.pyc
VideoAgent/_videoutil/__pycache__/split.cpython-310.pyc
VideoAgent/_videoutil/split.py+16-3
image-10.pngAdded

Large File Pointer Details
- SHA256: 0d1a52489cbfc32c4af39c37a3a87737119e1b278d7982ce127f0e4ae708d932
- Pointer size: 131 Bytes
- Size of remote file: 137 kB
image-17.pngAdded

image-2.png


image-7.pngAdded

Large File Pointer Details
- SHA256: 0a3a2f441cf87e2854e12c9aa51d0edeb6da7497737766046b07b27c5e75ea6a
- Pointer size: 131 Bytes
- Size of remote file: 256 kB
image-8.pngAdded

Large File Pointer Details
- SHA256: df062c8de9c9047e558adcfd9b0d670dcf6bdcff878ec37e7eccf240df1b93f0
- Pointer size: 131 Bytes
- Size of remote file: 412 kB
image-9.pngAdded

Large File Pointer Details
- SHA256: 342c4041f440420d215802a0555770ee0f6534c33a0268c9ac01282c8e400004
- Pointer size: 131 Bytes
- Size of remote file: 348 kB
requirements.txt+1-3
videorag_longervideos.py+2-2
webui.py+10-3