Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old transformers #23

Open
wants to merge 8 commits into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
1 change: 1 addition & 0 deletions materials_entity_recognition/scripts/mat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ def matTP_identify_sents(self, input_sents):
)
if self.prefetch_size > 0:
data_X.prefetch(self.prefetch_size)

# Prediction
all_y_preds = self.model.predict_label(x_batches=data_X)

Expand Down
4 changes: 2 additions & 2 deletions materials_entity_recognition/scripts/model_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ def __init__(self,
self.parameters_path = os.path.join(self.model_path, 'parameters.pkl')

self.last_cp_dir = os.path.join(self.model_path, 'last_cp')
if not os.path.exists(self.last_cp_dir):
if not (to_reload_model or os.path.exists(self.last_cp_dir)):
os.makedirs(self.last_cp_dir)
self.last_cp_path = os.path.join(self.last_cp_dir, 'cp.ckpt')
self.opt_cp_dir = os.path.join(self.model_path, 'opt_cp')
if not os.path.exists(self.opt_cp_dir):
if not (to_reload_model or os.path.exists(self.opt_cp_dir)):
os.makedirs(self.opt_cp_dir)
self.opt_cp_path = os.path.join(self.opt_cp_dir, 'cp.ckpt')

Expand Down
3 changes: 2 additions & 1 deletion materials_entity_recognition/scripts/sent_ele_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

# constant
if found_package('material_parser'):
from material_parser.material_parser import MaterialParser
from material_parser.material_parser_old import MaterialParser
mp = MaterialParser(pubchem_lookup=False)
print ("Using Material Parser (old version).")
allNonMetalElements = set(['C', 'H', 'O', 'N', 'Cl', 'F', 'P', 'S', 'Br', 'I', 'Se'] + ['He', 'Ne', 'Ar', 'Kr', 'Xe', 'Rn'])
# element table by symbol of elements
elementTable = {
Expand Down
7 changes: 3 additions & 4 deletions requirement.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
tensorflow>=2.3.0
tensorflow==2.3.0
tensorflow-addons>=0.12.0
transformers>=4.3.2
torch
transformers==4.2.2
spacy
chemdataextractor
numpy
psutil
psutil
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
packages=find_packages(),
include_package_data=True,
install_requires=[
'tensorflow>=2.3.0',
'tensorflow==2.3.0',
'tensorflow-addons>=0.12.0',
'spacy',
'chemdataextractor',
'numpy',
'transformers>=4.3.2',
'torch',
'transformers==4.2.2',
'psutil',
],
zip_safe=False)