Bernard
Bernard

Reputation: 11

Elephas tutorial error - ValueError: Could not interpret optimizer identifier

I'm trying to run this elephas tutorial on Colab.

I prepared the environment with

!apt-get install openjdk-8-jdk-headless -qq > /dev/null
!wget -q https://downloads.apache.org/spark/spark-2.4.6/spark-2.4.6-bin-hadoop2.7.tgz
!tar xf spark-2.4.6-bin-hadoop2.7.tgz
!pip install -q findspark
import os
os.environ["JAVA_HOME"] = "/usr/lib/jvm/java-8-openjdk-amd64"
os.environ["SPARK_HOME"] = "/content/spark-2.4.6-bin-hadoop2.7"
import findspark
findspark.init("spark-2.4.6-bin-hadoop2.7")
!pip install elephas

When I fit the model

pipeline = Pipeline(stages=[estimator])
fitted_pipeline = pipeline.fit(df)

I get the following error message

>>> Fit model
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-11-6d2ae7604dd2> in <module>()
      1 # Fitting a model returns a Transformer
      2 pipeline = Pipeline(stages=[estimator])
----> 3 fitted_pipeline = pipeline.fit(df)

11 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/optimizers.py in get(identifier)
    901   else:
    902     raise ValueError(
--> 903         'Could not interpret optimizer identifier: {}'.format(identifier))

ValueError: Could not interpret optimizer identifier: 1e-06

As you can see, the error relates to decay (decay=1e-6). Anyway, I still get the same error even when I change this value.

sgd = optimizers.SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True)
sgd_conf = optimizers.serialize(sgd)

Any ideas?

Upvotes: 1

Views: 376

Answers (1)

danielcahall
danielcahall

Reputation: 2752

This may have had to do with an incompatibility if you were working with Tensorflow 2.0 API. I would recommend retrying with the latest release: https://github.com/danielenricocahall/elephas/releases/tag/1.0.0 which now contains support for Tensorflow 2.1.x and Tensorflow 2.3.x.

Upvotes: 0

Related Questions