File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed
torch_uncertainty/datasets/classification Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 69
69
- name : Check that torch-uncertainty can be imported
70
70
if : steps.changed-files-specific.outputs.only_changed != 'true'
71
71
run : |
72
- python3 -c "import torch_uncertainty as tu "
72
+ python3 -c "import torch_uncertainty; from torch_uncertainty.datamodules import MNISTDataModule "
73
73
74
74
- name : Install the optional dependencies
75
75
if : steps.changed-files-specific.outputs.only_changed != 'true'
Original file line number Diff line number Diff line change 20
20
f"{ datetime .now ().year !s} , Adrien Lafage and Olivier Laurent"
21
21
)
22
22
author = "Adrien Lafage and Olivier Laurent"
23
- release = "0.7.0"
23
+ release = "0.7.0.post1 "
24
24
25
25
# -- General configuration ---------------------------------------------------
26
26
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
4
4
5
5
[project ]
6
6
name = " torch_uncertainty"
7
- version = " 0.7.0"
7
+ version = " 0.7.0.post1 "
8
8
authors = [
9
9
{
name =
" ENSTA U2IS AI" ,
email =
" [email protected] " },
10
10
{
name =
" Adrien Lafage" ,
email =
" [email protected] " },
Original file line number Diff line number Diff line change 1
1
import warnings
2
2
from collections .abc import Callable
3
+ from importlib import util
3
4
4
5
import numpy as np
5
6
import torch
6
7
from einops import rearrange
7
8
from torch .utils .data import Dataset
8
- from tslearn .datasets import UCR_UEA_datasets
9
+
10
+ if util .find_spec ("tslearn" ):
11
+ from tslearn .datasets import UCR_UEA_datasets
12
+
13
+ tslearn_installed = True
14
+ else : # coverage: ignore
15
+ tslearn_installed = False
9
16
10
17
11
18
class UCRUEADataset (Dataset ):
@@ -32,6 +39,13 @@ def __init__(
32
39
Raises:
33
40
ValueError: If `split` is set to "ood" but `create_ood` is not set to True.
34
41
"""
42
+ if not tslearn_installed : # coverage: ignore
43
+ raise ImportError (
44
+ "The tslearn library is not installed. Please install "
45
+ "torch_uncertainty with the timeseries option: "
46
+ """pip install -U "torch_uncertainty[timeseries]"."""
47
+ )
48
+
35
49
if split == "ood" and not create_ood :
36
50
raise ValueError (
37
51
"Cannot use split 'ood' without setting create_ood to True. "
You can’t perform that action at this time.
0 commit comments