ctranslate2 4.6.1__cp314-cp314-win_amd64.whl → 4.6.3__cp314-cp314-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ctranslate2/__init__.py +11 -3
- ctranslate2/_ext.cp314-win_amd64.pyd +0 -0
- ctranslate2/converters/fairseq.py +3 -1
- ctranslate2/converters/opennmt_py.py +3 -1
- ctranslate2/converters/transformers.py +769 -60
- ctranslate2/ctranslate2.dll +0 -0
- ctranslate2/cudnn64_9.dll +0 -0
- ctranslate2/extensions.py +17 -13
- ctranslate2/specs/attention_spec.py +9 -1
- ctranslate2/specs/transformer_spec.py +98 -8
- ctranslate2/version.py +1 -1
- {ctranslate2-4.6.1.dist-info → ctranslate2-4.6.3.dist-info}/METADATA +14 -3
- {ctranslate2-4.6.1.dist-info → ctranslate2-4.6.3.dist-info}/RECORD +16 -16
- {ctranslate2-4.6.1.dist-info → ctranslate2-4.6.3.dist-info}/WHEEL +0 -0
- {ctranslate2-4.6.1.dist-info → ctranslate2-4.6.3.dist-info}/entry_points.txt +0 -0
- {ctranslate2-4.6.1.dist-info → ctranslate2-4.6.3.dist-info}/top_level.txt +0 -0
ctranslate2/__init__.py
CHANGED
|
@@ -5,10 +5,18 @@ if sys.platform == "win32":
|
|
|
5
5
|
import glob
|
|
6
6
|
import os
|
|
7
7
|
|
|
8
|
-
import pkg_resources
|
|
9
|
-
|
|
10
8
|
module_name = sys.modules[__name__].__name__
|
|
11
|
-
|
|
9
|
+
|
|
10
|
+
# Adressing python 3.9 < version
|
|
11
|
+
try:
|
|
12
|
+
from importlib.resources import files
|
|
13
|
+
|
|
14
|
+
# Fixed the pkg_resources depreciation
|
|
15
|
+
package_dir = str(files(module_name))
|
|
16
|
+
except ImportError:
|
|
17
|
+
import pkg_resources
|
|
18
|
+
|
|
19
|
+
package_dir = pkg_resources.resource_filename(module_name, "")
|
|
12
20
|
|
|
13
21
|
add_dll_directory = getattr(os, "add_dll_directory", None)
|
|
14
22
|
if add_dll_directory is not None:
|
|
Binary file
|
|
@@ -146,7 +146,9 @@ class FairseqConverter(Converter):
|
|
|
146
146
|
import_user_module(argparse.Namespace(user_dir=self._user_dir))
|
|
147
147
|
|
|
148
148
|
with torch.no_grad():
|
|
149
|
-
checkpoint =
|
|
149
|
+
checkpoint = torch.load(
|
|
150
|
+
self._model_path, map_location=torch.device("cpu"), weights_only=False
|
|
151
|
+
)
|
|
150
152
|
args = checkpoint["args"] or checkpoint["cfg"]["model"]
|
|
151
153
|
|
|
152
154
|
args.data = self._data_dir
|
|
@@ -174,7 +174,9 @@ class OpenNMTPyConverter(Converter):
|
|
|
174
174
|
def _load(self):
|
|
175
175
|
import torch
|
|
176
176
|
|
|
177
|
-
checkpoint = torch.load(
|
|
177
|
+
checkpoint = torch.load(
|
|
178
|
+
self._model_path, map_location="cpu", weights_only=False
|
|
179
|
+
)
|
|
178
180
|
|
|
179
181
|
src_vocabs, tgt_vocabs = get_vocabs(checkpoint["vocab"])
|
|
180
182
|
|