NVIDIA Ingest 项目使用教程

NVIDIA Ingest 项目使用教程

nv-ingest NVIDIA Ingest is an early access set of microservices for parsing hundreds of thousands of complex, messy unstructured PDFs and other enterprise documents into metadata and text to embed into retrieval systems. nv-ingest 项目地址: https://gitcode.com/gh_mirrors/nv/nv-ingest

1. 项目目录结构及介绍

NVIDIA Ingest 是一个用于解析 PDF 和其他文档内容,提取元数据和文本的开源项目。以下是项目的目录结构及其简单介绍:

nv-ingest/
├── .devcontainer/
├── .github/
├── api/             # 包含API相关代码
├── ci/              # 包含持续集成相关脚本和配置
├── client/          # 客户端相关代码
├── conda/           # Conda环境配置和依赖
├── config/          # 配置文件和脚本
├── data/            # 示例数据和测试文件
├── deploy/          # 部署脚本和文档
├── docker/          # Docker配置文件和脚本
├── docs/            # 文档资料
├── evaluation/      # 评估和测试代码
├── examples/        # 使用示例
├── helm/            # Kubernetes的helm配置
├── skaffold/        # Skaffold配置
├── src/             # 源代码
├── tests/           # 测试代码
├── .gitignore       # Git忽略文件
├── .pre-commit-config.yaml # pre-commit钩子配置
├── CHANGELOG.md     # 更改日志
├── CITATION.md      # 引用指南
├── CODE_OF_CONDUCT.md # 行为准则
├── CONTRIBUTING.md  # 贡献指南
├── Dockerfile       # Docker构建文件
├── LICENSE          # 开源许可证
├── README.md        # 项目描述
├── SECURITY.md      # 安全协议
├── docker-compose.yaml # Docker Compose配置
├── print_env.sh     # 打印环境变量的脚本
├── pyproject.toml   # Python项目配置
└── pytest.ini       # Pytest配置

2. 项目的启动文件介绍

项目的启动主要通过 src 目录下的 Python 脚本进行。以下是一个简单的启动脚本示例:

# your_ingestion_script.py

import logging
import os
import time
import sys
from nv_ingest.util.pipeline.pipeline_runners import start_pipeline_subprocess
from nv_ingest_client.client import Ingestor, NvIngestClient
from nv_ingest_client.util.process_json_files import ingest_json_results_to_blob
# 其他必要的import

# 配置并启动 pipeline 子进程
config = PipelineCreationSchema()
pipeline_process = start_pipeline_subprocess(config)

# 设置客户端
client = NvIngestClient(message_client_allocator=SimpleClient, message_client_port=7671, message_client_hostname="localhost")

# 执行内容提取操作
ingestor = Ingestor(client=client).files("data/multimodal_test.pdf").extract(...).embed().vdb_upload(...)
results = ingestor.ingest(show_progress=True)

# 输出结果
print(ingest_json_results_to_blob(results[0]))

这个脚本会启动 NVIDIA Ingest 的处理流程,并提取指定 PDF 文件的内容。

3. 项目的配置文件介绍

配置文件通常位于 config 目录中。这些文件用于定义项目运行时需要的参数和设置。例如,可能存在一个配置文件 config.json,它可能包含以下内容:

{
    "api_endpoint": "http://localhost:5000",
    "database_connection": "mysql://user:password@localhost/dbname",
    "other_settings": {
        "key1": "value1",
        "key2": "value2"
    }
}

这个文件定义了 API 端点、数据库连接和其他必要的设置,项目在运行时会加载这些配置来初始化环境。

nv-ingest NVIDIA Ingest is an early access set of microservices for parsing hundreds of thousands of complex, messy unstructured PDFs and other enterprise documents into metadata and text to embed into retrieval systems. nv-ingest 项目地址: https://gitcode.com/gh_mirrors/nv/nv-ingest

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

霍美予Mabel

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值