generated from entelecheia/hyperfast-python-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tests): add HyFI pipeline datasets tests
- Loading branch information
1 parent
0f90410
commit b2c17b5
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from hyfi.main import HyFI | ||
|
||
|
||
def test_pipe_datasets(): | ||
data = HyFI.load_dataset("lhoestq/demo1")["train"] | ||
print(data) | ||
assert data is not None | ||
config = HyFI.compose("pipe=dataset_save_to_disk") | ||
config.run_with = {"dataset_path": "workspace/test_dataset"} | ||
print(config) | ||
HyFI.run_pipe(data, HyFI.to_dict(config)) | ||
config = HyFI.compose("pipe=dataset_load_from_disk") | ||
config.run_with = {"dataset_path": "workspace/test_dataset"} | ||
print(config) | ||
data2 = HyFI.run_pipe(data, HyFI.to_dict(config)) | ||
print(data2) | ||
config = HyFI.compose("pipe=dataset_sample") | ||
config.run_with = {"num_samples": 1} | ||
print(config) | ||
data3 = HyFI.run_pipe(data, HyFI.to_dict(config)) | ||
print(data3) | ||
assert len(data3) == 1 | ||
|
||
|
||
if __name__ == "__main__": | ||
test_pipe_datasets() |