Skip to content

Commit 0b39279

Browse files
committed
Fx
1 parent c6feea5 commit 0b39279

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
os: [ubuntu-latest, windows-latest, macos-latest]
13-
python-version: ["3.7", "3.8","3.9","3.10","3.11","3.12","3.13"]
13+
python-version: ["3.8","3.9","3.10","3.11","3.12","3.13"]
1414

1515
steps:
1616
- uses: actions/checkout@v4

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ authors = [
99
]
1010
description = "Russian Word Stress by Silero"
1111
readme = "README.md"
12-
requires-python = ">=3.7"
12+
requires-python = ">=3.8"
1313
classifiers = [
1414
"Development Status :: 5 - Production/Stable",
1515
"License :: OSI Approved :: MIT License",
1616
"Operating System :: OS Independent",
1717
"Intended Audience :: Science/Research",
1818
"Intended Audience :: Developers",
19-
"Programming Language :: Python :: 3.7",
2019
"Programming Language :: Python :: 3.8",
2120
"Programming Language :: Python :: 3.9",
2221
"Programming Language :: Python :: 3.10",

src/silero_stress/accentor.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ def load_accentor():
88

99
try:
1010
import importlib_resources as impresources
11-
model_file_path = str(impresources.files(package_path).joinpath(model_name))
12-
except:
11+
except ImportError:
1312
from importlib import resources as impresources
14-
try:
15-
with impresources.path(package_path, model_name) as f:
16-
model_file_path = f
17-
except:
18-
model_file_path = str(impresources.files(package_path).joinpath(model_name))
13+
14+
if hasattr(impresources, 'files'):
15+
# Python 3.9+
16+
model_file_path = str(impresources.files(package_path).joinpath(model_name))
17+
else:
18+
# Python 3.7-3.8
19+
with impresources.path(package_path, model_name) as f:
20+
model_file_path = str(f)
1921

2022
accentor = torch.package.PackageImporter(model_file_path).load_pickle("accentor_models", "accentor")
2123
quantized_weight = accentor.homosolver.model.bert.embeddings.word_embeddings.weight.data.clone()

0 commit comments

Comments
 (0)