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

Upgrade to tensorflow 2.16 and Keras 3.0 #170

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions delft/sequenceLabelling/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

from packaging import version

# for using legacy Keras 2, and not Keras 3 installed by default from TensorFlow 2.16
os.environ["TF_USE_LEGACY_KERAS"] = "1"
os.environ["KERAS_BACKEND"] = "tensorflow"
import tf_keras as keras

# ask tensorflow to be quiet and not print hundred lines of logs
from delft.utilities.Transformer import TRANSFORMER_CONFIG_FILE_NAME, DEFAULT_TRANSFORMER_TOKENIZER_DIR
from delft.utilities.misc import print_parameters
Expand Down
7 changes: 7 additions & 0 deletions delft/textClassification/wrapper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import os

from packaging import version

# for using legacy Keras 2, and not Keras 3 installed by default from TensorFlow 2.16
os.environ["TF_USE_LEGACY_KERAS"] = "1"
os.environ["KERAS_BACKEND"] = "tensorflow"
import tf_keras as keras

from delft.sequenceLabelling.trainer import LogLearningRateCallback
# ask tensorflow to be quiet and not print hundred lines of logs
from delft.utilities.misc import print_parameters
Expand Down
2 changes: 2 additions & 0 deletions delft/utilities/Transformer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
from typing import Union, Iterable

os.environ["KERAS_BACKEND"] = "tensorflow"

from transformers import AutoTokenizer, TFAutoModel, AutoConfig, BertTokenizer, TFBertModel

TRANSFORMER_CONFIG_FILE_NAME = 'transformer-config.json'
Expand Down
16 changes: 10 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
numpy==1.22.3
numpy==1.23.5
regex==2021.11.10
scikit-learn==1.0.1
scikit-learn==1.1
tqdm==4.62.3
tensorflow==2.9.3
h5py==3.6.0
#tensorflow==2.16.1
tensorflow[and-cuda]==2.16.1
tf_keras==2.16.0
h5py==3.10.0
unidecode==1.3.2
pydot==1.4.0
lmdb==1.2.1
truecase
requests>=2.20
pandas==1.3.5
transformers==4.33.2
torch==1.10.1
#transformers==4.40.0
torch==1.11.0
pytest
tensorflow-addons==0.19.0
#tensorflow-addons==0.19.0
tfa-nightly
blingfire==0.1.8
accelerate>=0.20.3
18 changes: 11 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,26 @@
include_package_data=True,
python_requires='>=3.7',
install_requires=[
'numpy==1.22.3',
'numpy==1.23.5',
'regex==2021.11.10',
'scikit-learn==1.0.1',
'scikit-learn==1.1',
'tqdm==4.62.3',
'tensorflow==2.9.3',
'h5py==3.6.0',
#'tensorflow==2.16.1',
'tensorflow[and-cuda]==2.16.1',
'tf_keras==2.16.0',
'h5py==3.10.0',
'unidecode==1.3.2',
'pydot==1.4.0',
'lmdb==1.2.1',
'transformers==4.33.2',
'torch==1.10.1',
#'transformers==4.33.2',
'transformers==4.40.0',
'torch==1.11.0',
'truecase',
'requests>=2.20',
'pandas==1.3.5',
'pytest',
'tensorflow-addons==0.19.0',
#'tensorflow-addons==0.19.0',
'tfa-nightly',
'accelerate>=0.20.3'
],
classifiers=[
Expand Down
Loading