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 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
- package_dir = pkg_resources.resource_filename(module_name, "")
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 = checkpoint_utils.load_checkpoint_to_cpu(self._model_path)
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(self._model_path, map_location="cpu")
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