Skip to content

Commit cc50221

Browse files
committed
Fix pretrained paths in wheel??
1 parent 9d57dff commit cc50221

9 files changed

+16
-10
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ jobs:
2020

2121
- name: Checkout
2222
uses: actions/checkout@v4
23+
with:
24+
path: dartsort
2325

2426
- name: Setup Mamba
2527
uses: mamba-org/setup-micromamba@v1
2628
with:
27-
environment-file: environment.yml
29+
environment-file: dartsort/environment.yml
2830
init-shell: bash
2931

3032
- name: Install Torch (CPU)
@@ -33,11 +35,11 @@ jobs:
3335
3436
- name: Install Pip Requirements
3537
run: |
36-
python -m pip install -r requirements.txt
38+
python -m pip install -r dartsort/requirements.txt
3739
3840
- name: Install DARTsort
3941
run: |
40-
python -m pip install .
42+
python -m pip install dartsort/
4143
4244
- name: Get DREDge
4345
uses: actions/checkout@v4
@@ -51,4 +53,4 @@ jobs:
5153
5254
- name: Pytest
5355
run: |
54-
python -m pytest tests/*
56+
python -m pytest dartsort/tests/*
File renamed without changes.
File renamed without changes.

src/dartsort/transform/single_channel_denoiser.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
from pathlib import Path
2-
31
import torch
42
from dartsort.util.waveform_util import (get_channels_in_probe,
53
set_channels_in_probe)
64
from torch import nn
75

86
from .transform_base import BaseWaveformDenoiser
97

10-
default_pretrained_path = (
11-
Path(__file__).parent.parent.parent.parent
12-
/ "pretrained/single_chan_denoiser.pt"
13-
)
8+
try:
9+
from importlib.resources import files
10+
except ImportError:
11+
try:
12+
from importlib_resources import files
13+
except ImportError:
14+
raise ValueError("Need python>=3.10 or pip install importlib_resources.")
15+
16+
default_pretrained_path = files("dartsort.pretrained")
17+
default_pretrained_path = default_pretrained_path.joinpath("single_chan_denoiser.pt")
1418

1519

1620
class SingleChannelWaveformDenoiser(BaseWaveformDenoiser):

0 commit comments

Comments
 (0)