Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add option to change LIBEM_SAMPLE_DATA_PATH in config.yaml #96

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ The `classic` directory includes the following available benchmarks, each using

The `suite` directory contains benchmark suites that deep-dive into aspects of Libem performance.

Note: if `libem` is installed via pip, specify the location of `libem-sample-data` via cli:
```
libem configure
```

## Blocking

To run a single blocking benchmark in `/classic`:
Expand Down
10 changes: 10 additions & 0 deletions cli/libem
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import argparse
import pprint

import libem
import libem.prepare.datasets as datasets
from libem.match.parameter import tools
from libem.core.struct import Index

Expand Down Expand Up @@ -97,6 +98,15 @@ def configure(args):
# If no input, keep the existing key; otherwise, update
if new_claude_key:
config['CLAUDE_API_KEY'] = new_claude_key

# Prompt for LIBEM_SAMPLE_DATA_PATH
existing_sample_data_path = datasets.LIBEM_SAMPLE_DATA_PATH
sample_data_path = input(f"Enter the path to libem-sample-data (press Enter to "
f"keep existing location: {existing_sample_data_path}): ").strip()

# If no input, keep existing path; otherwise, update
if sample_data_path:
config['LIBEM_SAMPLE_DATA_PATH'] = sample_data_path

...

Expand Down
14 changes: 10 additions & 4 deletions libem/prepare/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
import random
from typing import Iterable

LIBEM_SAMPLE_DATA_PATH = os.path.join(
os.path.dirname(__file__),
'..', '..', '..', '..',
'libem-sample-data')
import libem

LIBEM_SAMPLE_DATA_PATH = libem.LIBEM_CONFIG.get(
"LIBEM_SAMPLE_DATA_PATH",
os.path.join(
os.path.dirname(__file__),
'..', '..', '..', '..',
'libem-sample-data'
)
)


def load(dataset: Iterable[dict], num_samples=-1, stringify=True) \
Expand Down