From 87852f79790a91fb1e09e03ef2465b331c8c4781 Mon Sep 17 00:00:00 2001
From: Gerard Planella <37297822+gerardPlanella@users.noreply.github.com>
Date: Sat, 15 Apr 2023 21:43:48 +0200
Subject: [PATCH 1/2] Update utils.py to work for python versions > 3.10
---
senteval/utils.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/senteval/utils.py b/senteval/utils.py
index 425f60cd..e9bd1d8e 100644
--- a/senteval/utils.py
+++ b/senteval/utils.py
@@ -11,6 +11,7 @@
import re
import inspect
from torch import optim
+import sys
def create_dictionary(sentences):
@@ -86,7 +87,10 @@ def get_optimizer(s):
raise Exception('Unknown optimization method: "%s"' % method)
# check that we give good parameters to the optimizer
- expected_args = inspect.getargspec(optim_fn.__init__)[0]
+ if if sys.version_info < (3, 10):
+ expected_args = inspect.getargspec(optim_fn.__init__)[0]
+ else:
+ expected_args = list(inspect.signature(optim_fn.__init__).parameters.keys())
assert expected_args[:2] == ['self', 'params']
if not all(k in expected_args[2:] for k in optim_params.keys()):
raise Exception('Unexpected parameters: expected "%s", got "%s"' % (
From 00a0da1a60e1652535242ba04b16139d568a3b40 Mon Sep 17 00:00:00 2001
From: Gerard Planella <37297822+gerardPlanella@users.noreply.github.com>
Date: Mon, 7 Aug 2023 07:50:20 +0000
Subject: [PATCH 2/2] Removed double if
---
build/lib/senteval/utils.py | 99 +++++++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
create mode 100644 build/lib/senteval/utils.py
diff --git a/build/lib/senteval/utils.py b/build/lib/senteval/utils.py
new file mode 100644
index 00000000..e9bd1d8e
--- /dev/null
+++ b/build/lib/senteval/utils.py
@@ -0,0 +1,99 @@
+# Copyright (c) 2017-present, Facebook, Inc.
+# All rights reserved.
+#
+# This source code is licensed under the license found in the
+# LICENSE file in the root directory of this source tree.
+#
+
+from __future__ import absolute_import, division, unicode_literals
+
+import numpy as np
+import re
+import inspect
+from torch import optim
+import sys
+
+
+def create_dictionary(sentences):
+ words = {}
+ for s in sentences:
+ for word in s:
+ if word in words:
+ words[word] += 1
+ else:
+ words[word] = 1
+ words[''] = 1e9 + 4
+ words[''] = 1e9 + 3
+ words['
'] = 1e9 + 2
+ # words['