ImmunoGraph / README.md
1ricky1's picture
Document validation resources and include original Parquet conversion notes
97f791c verified
|
Raw History Blame Contribute Delete
7.61 kB
metadata
pretty_name: ImmunoGraph
tags:
  - biology
  - knowledge-graph
  - question-answering
configs:
  - config_name: qa_easy
    default: true
    data_files:
      - split: data
        path: 1-QA_DATASETS/Easy/easy_final_50000.parquet
  - config_name: qa_medium
    data_files:
      - split: data
        path: 1-QA_DATASETS/Medium/medium_final20k_corrected.parquet
  - config_name: qa_hard_context_swap
    data_files:
      - split: data
        path: 1-QA_DATASETS/Hard/hard_context_swap_19985.parquet
  - config_name: qa_hard_gold_context_no_advantage
    data_files:
      - split: data
        path: 1-QA_DATASETS/Hard/hard_gold_context_no_advantage_3000.parquet
  - config_name: qa_hard_structural_loss
    data_files:
      - split: data
        path: 1-QA_DATASETS/Hard/hard_structural_loss_10000.parquet
  - config_name: immunokg
    data_files:
      - split: data
        path: ImmunoKG/*.parquet

ImmunoGraph

This repository contains the ImmunoGraph QA datasets, ImmunoKG knowledge graph, answer-validation resources, and evaluation dictionaries. The original directory structure is preserved. Data files use the Parquet format with ZSTD compression.

Collection Parquet files Records
QA: Easy 1 50,000
QA: Medium 1 20,000
QA: Hard, context swap 1 19,985
QA: Hard, gold context no advantage 1 3,000
QA: Hard, structural loss 1 10,000
All QA datasets 5 102,985
ImmunoKG 48 100,294,641
Evaluation dictionaries 10 554,100

The four directories contain 79 files, including five provenance/audit reports in ImmunoKG/_reports/, totaling 1,780,151,970 bytes (approximately 1.78 GB). Together with the three root-level conversion documents, the uploaded inventory contains 82 files and 1,780,223,937 bytes; the dataset card is additional.

Download / 下载

Install huggingface_hub to use the hf command. For a private repository, authenticate with a token that has read access:

HF_ENDPOINT=https://huggingface.co hf auth login

Download the four complete directories and conversion documents while preserving their paths:

HF_ENDPOINT=https://huggingface.co hf download 1ricky1/ImmunoGraph \
  --repo-type dataset \
  --local-dir ./ImmunoGraph \
  --include "1-QA_DATASETS/**" "ImmunoKG/**" \
    "3-ANSWER_VALIDATION/**" "3-EVALUATION_DICTIONARIES/**" \
    "README-PARQUET.md" "PARQUET-CONVERSION-MANIFEST.json" "CONVERSION-SUMMARY.json"

Alternatively, use Python:

from huggingface_hub import snapshot_download

snapshot_download(
    repo_id="1ricky1/ImmunoGraph",
    repo_type="dataset",
    endpoint="https://huggingface.co",
    local_dir="./ImmunoGraph",
    allow_patterns=[
        "1-QA_DATASETS/**", "ImmunoKG/**",
        "3-ANSWER_VALIDATION/**", "3-EVALUATION_DICTIONARIES/**",
        "README-PARQUET.md", "PARQUET-CONVERSION-MANIFEST.json", "CONVERSION-SUMMARY.json",
    ],
    token=True,
)

Read the data / 读取数据

QA fields contain JSON-encoded text, including string, numeric, list and object values. Decode them with json.loads. For ImmunoKG, entity IDs, names, types and relations are plain text; context contains JSON text. The auxiliary _source_keys column records which fields were present in the source record, preserving the distinction between a missing field and a null value.

import json
import pyarrow.parquet as pq

qa = pq.read_table(
    "ImmunoGraph/1-QA_DATASETS/Easy/easy_final_50000.parquet",
    columns=["question", "answer"],
)
question = json.loads(qa["question"][0].as_py())
answer = json.loads(qa["answer"][0].as_py())

The six Hub configurations keep the five QA schemas and the ImmunoKG schema separate. Each configuration exposes its complete collection as a single data split. If HF_ENDPOINT points to a mirror, set it to https://huggingface.co before starting Python:

from datasets import load_dataset

kg = load_dataset(
    "1ricky1/ImmunoGraph",
    "immunokg",
    split="data",
    streaming=True,
    token=True,
)
first_record = next(iter(kg))

The preserved reports in ImmunoKG/_reports/ describe provenance and earlier processing. Some refer to source .json filenames from before the Parquet conversion.

Validation resources / 验证资源

  • 3-ANSWER_VALIDATION/ contains the preserved answer-validation scripts, documentation, tests, and smoke-test report.
  • 3-EVALUATION_DICTIONARIES/ contains ten Parquet dictionaries and the preserved source manifests. Dictionary rows use JSON-encoded key and value columns, with _source_keys recording source fields.

The preserved validation scripts and their manifests describe the original JSON-based workflow. Their readers and paths need to be adapted for the numbered directories and Parquet files. The dictionary manifests record original JSON filenames and hashes; PARQUET-CONVERSION-MANIFEST.json maps them to the converted files, and CONVERSION-SUMMARY.json records conversion checks.

Parquet conversion notes / Parquet 转换说明

以下完整保留 README-PARQUET.md 的内容。这里的 122 个 Parquet 文件指完整的本地转换产物,包含模型回答等内容;当前 Hugging Face 仓库包含 63 个 Parquet 文件(5 个问答、48 个知识图谱、10 个字典),以及验证代码、报告和说明文档。转换清单也覆盖完整的本地转换产物。

ImmonoGraph

本目录由 /data/KG/FFFFINAL 转换生成,保留原来的题目、模型回答、字典、代码与验证目录结构。

  • 共 122 个 Parquet 文件,使用 ZSTD 压缩。
  • ImmunoKG 为 48 个 Parquet 文件,共 100,294,641 条记录。
  • 问答、模型回答和实体字典均已转换。代码、配置、来源记录和说明保持原格式。
  • gene_dictionary.json 中 10 处非法 NaN 已按要求修正为 null,对应字典已转换。
  • 原 FFFFINAL 除上述授权的字典修正外,没有改动。

读取格式

KG 的头尾 ID、名称、类型、关系等为文本列,context 以完整 JSON 文本保存。问答/模型回答各字段采用 JSON 文本编码,可用 Python json.loads 或 DuckDB JSON 函数解码;这包含字符串、数值、列表和对象。字典对象采用 key / value 两列。

_source_keys 是辅助列,记录原始记录中存在的字段,区分“字段缺失”和“字段值为 null”,便于完整还原原 JSON。

例如,在 Python 中读取 KG 上下文:

import duckdb, json
row = duckdb.sql("SELECT head_id, context FROM read_parquet('ImmunoKG/48-gene_clinicalconcept.parquet') LIMIT 1").fetchone()
head_id, context = row[0], json.loads(row[1])

原有测试代码和来源清单按原格式复制,其中指向 JSON 的读取路径需要调整后才能直接读取本目录的 Parquet;转换文件对应关系以根目录的 PARQUET-CONVERSION-MANIFEST.json 为准。

校验

每个转换分块都从 Parquet 读回,并逐条计算规范化内容 SHA256,与原记录比较;最终合并文件再次核对记录数和所有字段的行校验值。原格式文件与源文件 SHA256 一致。详见 CONVERSION-SUMMARY.json 和转换清单。