Datasets:
|
Download docs/USAGE.md from Moritze-Chenyu/BeyondRecall: direct link, hf CLI and curl.
- Browser
- Download file 6.46 kB
-
https://huggingface.co/datasets/Moritze-Chenyu/BeyondRecall/resolve/main/docs/USAGE.md
- Command line
-
hf download hf://datasets/Moritze-Chenyu/BeyondRecall/docs/USAGE.md
-
curl -L -o USAGE.md https://huggingface.co/datasets/Moritze-Chenyu/BeyondRecall/resolve/main/docs/USAGE.md
6.46 kB
| # Download and Evaluate | |
| ## Download a fixed version | |
| Install the record-loading and download libraries: | |
| ```bash | |
| python -m pip install --upgrade huggingface_hub datasets | |
| export HF_DATASET_ID="YOUR_HF_USERNAME/BeyondRecall" | |
| export HF_REVISION="FULL_COMMIT_SHA_OR_RELEASE_TAG" | |
| ``` | |
| After publication, replace both placeholders with the actual dataset ID and a | |
| published release tag or full commit SHA. A full commit SHA is preferred for exact | |
| reproducibility. No release tag is assumed to exist before publication. Use the | |
| same `HF_REVISION` for `snapshot_download` and `load_dataset`; do not mix latest | |
| records with media from another revision. Both libraries support revision pinning: | |
| [download documentation](https://huggingface.co/docs/huggingface_hub/guides/download) | |
| and [dataset loading documentation](https://huggingface.co/docs/datasets/loading). | |
| ```python | |
| import os | |
| from pathlib import Path | |
| from huggingface_hub import snapshot_download | |
| from datasets import load_dataset | |
| repo_id = os.environ["HF_DATASET_ID"] | |
| revision = os.environ["HF_REVISION"] | |
| config = "retrieval_property_state_retrieval" | |
| snapshot = Path(snapshot_download( | |
| repo_id=repo_id, repo_type="dataset", revision=revision, | |
| local_dir="downloads/BeyondRecall", | |
| )).resolve() | |
| records = load_dataset(repo_id, config, split="test", revision=revision) | |
| print("Trajectories:", len(records)) | |
| print("Native media root:", snapshot / "benchmark") | |
| ``` | |
| Verify the downloaded snapshot from its root: | |
| ```bash | |
| cd downloads/BeyondRecall | |
| sha256sum -c checksums/SHA256SUMS | |
| (cd benchmark && sha256sum -c SHA256SUMS) | |
| ``` | |
| `load_dataset` returns nested conversation records and **media path strings**. | |
| It does not automatically load images, PDFs or videos for this JSON schema. | |
| `snapshot_download` supplies the actual media files, preserving their paths. | |
| Each row is a trajectory; resolve all media paths against `snapshot / "benchmark"`. | |
| ## Read a trajectory, question and native media | |
| The following standalone example runs after downloading the dataset. It also | |
| works offline against a complete local snapshot. Run it from the directory | |
| containing `downloads/`, or set `BEYOND_RECALL_SNAPSHOT` to the snapshot directory. | |
| It reads the same JSON records used by the Hub configurations. | |
| ```python | |
| import json | |
| import os | |
| from pathlib import Path | |
| snapshot = Path(os.environ.get("BEYOND_RECALL_SNAPSHOT", "downloads/BeyondRecall")).resolve() | |
| media_root = snapshot / "benchmark" | |
| dimension = "retrieval" | |
| task = "property_state_retrieval" | |
| records = json.loads((media_root / dimension / (task + ".json")).read_text(encoding="utf-8")) | |
| trajectory = records[0] | |
| question_index = 0 | |
| question = trajectory["questions"][question_index] | |
| question_key = f"{dimension}/{task}/{trajectory['id']}/q{question_index}" | |
| print("Question key:", question_key) | |
| print("Question:", question["question"]) | |
| print("Cutoff:", question.get("timestamp") or None) | |
| # For Hub-loaded records, replace the JSON-reading lines above with the pinned | |
| # load_dataset call and keep the same nested access and optional-field handling. | |
| def media_paths(item): | |
| for relative_path in item.get("media") or []: | |
| path = (media_root / relative_path).resolve() | |
| if not path.is_relative_to(media_root.resolve()): | |
| raise ValueError(f"Media path escapes the benchmark directory: {relative_path}") | |
| if not path.is_file(): | |
| raise FileNotFoundError(path) | |
| yield path | |
| # Inspect stored history. This loop is browsing, not cutoff-filtered evaluation. | |
| for session_index, session in enumerate(trajectory["conversation"]): | |
| print("Session:", session_index, session["date"]) | |
| for turn_index, turn in enumerate(session["turns"]): | |
| print("Turn:", turn_index, turn["person"], turn["content"]) | |
| for path in media_paths(turn): | |
| # Open real file bytes; use an image, PDF or video decoder as needed. | |
| with path.open("rb") as stream: | |
| header = stream.read(16) | |
| print("History media:", path, "bytes:", path.stat().st_size, | |
| "header:", header.hex()) | |
| for path in media_paths(question): | |
| print("Query media:", path, "bytes:", path.stat().st_size) | |
| # Reference answers are available at question["answer"] for scoring only. | |
| # Never include them in model inputs. Apply the data card's visibility rules | |
| # before preparing history media or writing anything to an evaluation memory. | |
| ``` | |
| The example uses Python 3.9 or newer. Missing `media`, `null` and empty lists all | |
| produce no attached files. Missing or `null` optional `timestamp` means unspecified; | |
| an invalid non-null timestamp must still fail temporal parsing. Hub feature | |
| inference can introduce `null` values for optional fields omitted in raw JSON; | |
| normalize them before passing records to code expecting lists. See the | |
| [identifier and time rules](../README.md#identifiers-and-optional-fields). | |
| ## Use the GitHub evaluator | |
| Clone [the evaluation repository](https://github.com/Moritze-Chenyu/BeyondRecall) | |
| and follow its `docs/START_HERE.md` to install the chosen framework and configure | |
| provider settings. Run the following from that GitHub repository root, replacing | |
| `/path/to/downloaded` with your pinned snapshot directory. For caption-based | |
| methods, first prepare a complete caption cache and replace its path below: | |
| ```bash | |
| python scripts/run_framework.py \ | |
| --dataset /path/to/downloaded/benchmark \ | |
| --profile mem0_agentic \ | |
| --caption-store /path/to/generated/captions.json \ | |
| --output-dir results/mem0_agentic --workers 2 | |
| ``` | |
| The downloaded benchmark is complete and does not require reassembly. To combine | |
| GitHub text with the downloaded media instead, `assemble_dataset.py` accepts | |
| `--media-root /path/to/downloaded/benchmark` and a fresh output directory. | |
| Generate captions, video segments and aligned audio transcriptions separately | |
| using the evaluation repository when required by the selected framework. | |
| Caption-based methods require a complete, source-hash-bound cache. The | |
| legacy-caption supplementation script handles missing images and PDFs; video | |
| captions require a separate producer. | |
| For MIRIX, follow the GitHub guide to start a dedicated service and prepare video | |
| segments with aligned ASR. Pass the resulting manifest using | |
| `--video-segment-manifest /path/to/generated/video_segments/manifest.json`. | |
| All evaluated inputs must remain timestamp-visible and complete. These commands | |
| invoke the model providers configured in your evaluation environment. | |