deeplotx 0.9.7__py3-none-any.whl → 0.9.8__py3-none-any.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.
@@ -1,10 +1,10 @@
1
1
  import logging
2
2
  import os
3
3
  import math
4
- from requests.exceptions import ConnectTimeout, SSLError
5
4
 
6
5
  import torch
7
6
  from torch import nn
7
+ from requests.exceptions import RequestException
8
8
  from transformers import AutoTokenizer, AutoModel
9
9
 
10
10
  from deeplotx import __ROOT__
@@ -26,14 +26,7 @@ class Encoder(nn.Module):
26
26
  self.encoder = AutoModel.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
27
27
  cache_dir=CACHE_PATH, _from_auto=True,
28
28
  trust_remote_code=True).to(self.device)
29
- except ConnectTimeout:
30
- self.tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
31
- cache_dir=CACHE_PATH, _from_auto=True,
32
- trust_remote_code=True, local_files_only=True)
33
- self.encoder = AutoModel.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
34
- cache_dir=CACHE_PATH, _from_auto=True,
35
- trust_remote_code=True, local_files_only=True).to(self.device)
36
- except SSLError:
29
+ except RequestException:
37
30
  self.tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
38
31
  cache_dir=CACHE_PATH, _from_auto=True,
39
32
  trust_remote_code=True, local_files_only=True)
@@ -3,8 +3,8 @@ import os
3
3
 
4
4
  import torch
5
5
  from torch import nn
6
+ from requests.exceptions import RequestException
6
7
  from transformers import AutoModel, AutoTokenizer
7
- from requests.exceptions import ConnectTimeout, SSLError
8
8
 
9
9
  from deeplotx import __ROOT__
10
10
 
@@ -25,14 +25,7 @@ class LongformerEncoder(nn.Module):
25
25
  self.encoder = AutoModel.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
26
26
  cache_dir=CACHE_PATH, _from_auto=True,
27
27
  trust_remote_code=True).to(self.device)
28
- except ConnectTimeout:
29
- self.tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
30
- cache_dir=CACHE_PATH, _from_auto=True,
31
- trust_remote_code=True, local_files_only=True)
32
- self.encoder = AutoModel.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
33
- cache_dir=CACHE_PATH, _from_auto=True,
34
- trust_remote_code=True, local_files_only=True).to(self.device)
35
- except SSLError:
28
+ except RequestException:
36
29
  self.tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
37
30
  cache_dir=CACHE_PATH, _from_auto=True,
38
31
  trust_remote_code=True, local_files_only=True)
deeplotx/ner/bert_ner.py CHANGED
@@ -1,8 +1,8 @@
1
1
  import logging
2
2
  import os
3
- from requests.exceptions import ConnectTimeout, SSLError
4
3
 
5
4
  import torch
5
+ from requests.exceptions import RequestException
6
6
  from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
7
7
 
8
8
  from deeplotx import __ROOT__
@@ -30,14 +30,7 @@ class BertNER(BaseNER):
30
30
  self.encoder = AutoModelForTokenClassification.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
31
31
  cache_dir=CACHE_PATH, _from_auto=True,
32
32
  trust_remote_code=True).to(self.device)
33
- except ConnectTimeout:
34
- self.tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
35
- cache_dir=CACHE_PATH, _from_auto=True,
36
- trust_remote_code=True, local_files_only=True)
37
- self.encoder = AutoModelForTokenClassification.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
38
- cache_dir=CACHE_PATH, _from_auto=True,
39
- trust_remote_code=True, local_files_only=True).to(self.device)
40
- except SSLError:
33
+ except RequestException:
41
34
  self.tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path=model_name_or_path,
42
35
  cache_dir=CACHE_PATH, _from_auto=True,
43
36
  trust_remote_code=True, local_files_only=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deeplotx
3
- Version: 0.9.7
3
+ Version: 0.9.8
4
4
  Summary: An out-of-the-box long-text NLP framework.
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -1,11 +1,11 @@
1
1
  deeplotx/__init__.py,sha256=x4CbJuW20al6S5KkKyrReeuwNGv04JGoqtGUyx-ACtg,1356
2
2
  deeplotx/encoder/__init__.py,sha256=BrsF5_4O-4pfihYF2wjExDOoAY-03kGJTH-Mhez4tsE,129
3
- deeplotx/encoder/encoder.py,sha256=wVRl3p_7eg7qT_tJEit5qnmZx7dXkMVLxAtao5vImkk,4201
3
+ deeplotx/encoder/encoder.py,sha256=uJswUSrYVDWP84HeCD40R9KgXGPUEa080konv7jEp8I,3539
4
4
  deeplotx/encoder/long_text_encoder.py,sha256=4oRa9FqfGNZ8-gq14UKuhDkZC0A1Xi-wKmbQsn-uZ58,3966
5
- deeplotx/encoder/longformer_encoder.py,sha256=7Lm65AUD3qwbrzrhJ3dPZkyHeNRSapga3f-5QJCxV5A,3538
5
+ deeplotx/encoder/longformer_encoder.py,sha256=mfAI_NE3QQZhvGHbZkP7S6g0Jj59wmLWQ9QW7HOjqm0,2876
6
6
  deeplotx/ner/__init__.py,sha256=Rss1pup9HzHZCG8U9ub8niWa9zRjWCy3Z7zg378KZQg,114
7
7
  deeplotx/ner/base_ner.py,sha256=pZTl50OrHH_FJm4rKp9iuixeOE6FX_AzgDXD32aXsN0,204
8
- deeplotx/ner/bert_ner.py,sha256=xTePPaf-EI-m3Sx6u9fJrEHxix5-To2YWiatcAEimGA,9309
8
+ deeplotx/ner/bert_ner.py,sha256=6al5iMc8gb3XuJf7dbJd-noXShLYmRoLXTd8L1-wYMM,8581
9
9
  deeplotx/ner/named_entity.py,sha256=c6XufIwH6yloJ-ccUjagf4mBl1XbbYDT8xyEJJ_-ZNs,269
10
10
  deeplotx/ner/n2g/__init__.py,sha256=b6fOWJVLaOCtoz8Qlp8NWQbL5lUSbn6H3-8fnVNIPi0,3940
11
11
  deeplotx/nn/__init__.py,sha256=YILwbxb-NHdiJjfOwBKH8F7PuZSDZSrGpTznPDucTro,710
@@ -33,8 +33,8 @@ deeplotx/trainer/text_binary_classification_trainer.py,sha256=TFxOX8rWU_zKliI9zm
33
33
  deeplotx/util/__init__.py,sha256=5CH4MTeSgsmCe3LPMfvKoSBpwh6jDSBuHVElJvzQzgs,90
34
34
  deeplotx/util/hash.py,sha256=qbNU3RLBWGQYFVte9WZBAkZ1BkdjCXiKLDaKPN54KFk,662
35
35
  deeplotx/util/read_file.py,sha256=O9nieNgAGQ7Ct1EFxCdcgL6hVs5s2Vw_ItcUK6VeTwY,981
36
- deeplotx-0.9.7.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
37
- deeplotx-0.9.7.dist-info/METADATA,sha256=Q-3dVHeAaVuh6yN0cJTY4axk8jRFd2vkHqsbMa0jPoA,14442
38
- deeplotx-0.9.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
39
- deeplotx-0.9.7.dist-info/top_level.txt,sha256=hKg4pVDXZ-WWxkRfJFczRIll1Sv7VyfKCmzHLXbuh1U,9
40
- deeplotx-0.9.7.dist-info/RECORD,,
36
+ deeplotx-0.9.8.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
37
+ deeplotx-0.9.8.dist-info/METADATA,sha256=XtNTeBMMC9kAQ710DmyGFsC6SCWPwbJ-vt10GybeTAU,14442
38
+ deeplotx-0.9.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
39
+ deeplotx-0.9.8.dist-info/top_level.txt,sha256=hKg4pVDXZ-WWxkRfJFczRIll1Sv7VyfKCmzHLXbuh1U,9
40
+ deeplotx-0.9.8.dist-info/RECORD,,