From 4cca96c18a75b1a7e082ef9146cb89324cba70e0 Mon Sep 17 00:00:00 2001 From: frostedoyster Date: Thu, 30 Nov 2023 17:21:26 +0100 Subject: [PATCH] Fix data directory in test --- tests/data.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/data.py b/tests/data.py index a49a53a4a..63aacc9e9 100644 --- a/tests/data.py +++ b/tests/data.py @@ -1,3 +1,4 @@ +import os import torch from metatensor_models.utils.data import Dataset, collate_fn, read_structures, read_targets @@ -6,8 +7,10 @@ def test_dataset(): """Tests the readers and the dataset class.""" - structures = read_structures("data/qm9_reduced_100.xyz") - targets = read_targets("data/qm9_reduced_100.xyz", "U0") + dataset_path = os.path.join(os.path.dirname(__file__), "data/qm9_reduced_100.xyz") + + structures = read_structures(dataset_path) + targets = read_targets(dataset_path, "U0") dataset = Dataset(structures, targets) dataloader = torch.utils.data.DataLoader(dataset, batch_size=10, collate_fn=collate_fn)