From 408f45fe3084fd05cba1b5a644271d1387441c8b Mon Sep 17 00:00:00 2001 From: rolczynski Date: Sun, 1 Aug 2021 22:47:42 +0200 Subject: [PATCH] Upgrade Python Version to 3.7 (compatible with Colab) --- README.md | 1 + aspect_based_sentiment_analysis/models.py | 6 +++--- environment.yml | 4 ++-- setup.py | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index aff3f22..9e4cda1 100755 --- a/README.md +++ b/README.md @@ -200,6 +200,7 @@ git clone git@github.com:ScalaConsultants/Aspect-Based-Sentiment-Analysis.git conda env create -f=environment.yml conda activate Aspect-Based-Sentiment-Analysis ``` +The package works with the Python in the version 3.7 (the same as in Colab 2021).
diff --git a/aspect_based_sentiment_analysis/models.py b/aspect_based_sentiment_analysis/models.py index 8ca6432..ae011e9 100755 --- a/aspect_based_sentiment_analysis/models.py +++ b/aspect_based_sentiment_analysis/models.py @@ -6,9 +6,9 @@ import numpy as np import transformers -from transformers.modeling_tf_utils import TFModelInputType import tensorflow as tf from tensorflow.keras import layers +from transformers.modeling_tf_utils import TFModelInputType logger = logging.getLogger('absa.model') @@ -56,7 +56,7 @@ class ABSClassifier(tf.keras.Model, ABC): @abstractmethod def call( self, - token_ids: tf.Tensor, + input_ids: tf.Tensor, attention_mask: tf.Tensor = None, token_type_ids: tf.Tensor = None, training: bool = False, @@ -70,7 +70,7 @@ def call( Parameters ---------- - token_ids + input_ids Indices of input sequence subtokens in the vocabulary. attention_mask Bool mask used to avoid performing attention on padding token diff --git a/environment.yml b/environment.yml index db1d884..22c86e3 100755 --- a/environment.yml +++ b/environment.yml @@ -1,11 +1,10 @@ name: Aspect-Based-Sentiment-Analysis dependencies: - - python=3.6.9 + - python=3.7 - scikit-learn=0.24.2 - pytest=6.2.4 - pytest-timeout=1.4.2 - ipython=7.3 - - spacy=3.1.0 - dataclasses=0.8 - pip: - tensorflow==2.5.0 @@ -13,3 +12,4 @@ dependencies: - testfixtures==6.17.1 - transformers==4.8.2 - optuna==2.8.0 + - spacy==3.1.1 diff --git a/setup.py b/setup.py index 1bb0ede..4fcdbbf 100644 --- a/setup.py +++ b/setup.py @@ -24,8 +24,8 @@ include_package_data=False, packages=find_packages(), install_requires=[ - 'tensorflow==2.5.0', - 'transformers==4.8.2', + 'tensorflow==2.5', + 'transformers==4.8', 'pytest', 'scikit-learn', 'ipython', @@ -34,5 +34,5 @@ 'optuna', 'spacy' ], - python_requires='>=3.6.9', + python_requires='==3.7.*', )