Code Monkey home page Code Monkey logo

Comments (4)

CyberZHG avatar CyberZHG commented on May 18, 2024

I think the newer releases are compatible with tf-1.13.

from keras-radam.

flydsc avatar flydsc commented on May 18, 2024

Thank you for your updating! Worked fine with the demo code. Still I got the error when I was trying to replace Adam with RAdam() with following code:

        model.compile(
            loss='categorical_crossentropy',
            # optimizer=tf.keras.optimizers.Adam(lr=0.001),
            optimizer=RAdam(),
            metrics=['accuracy'],)
        model.fit(X, labels, batch_size=batch_size, epochs=epochs, callbacks=[early_stop,scheduler])

Please find the error message below:

Traceback (most recent call last):
  File "classifier.py", line 95, in <module>
    classfier.pre_train()
  File "classifier.py", line 79, in pre_train
    self.train_source_classifier(source_)
  File "classifier.py", line 74, in train_source_classifier
    model.fit(X, labels, batch_size=batch_size, epochs=epochs, callbacks=[early_stop,scheduler])
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 880, in fit
    validation_steps=validation_steps)
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 195, in model_iteration
    f = _make_execution_function(model, mode)
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 122, in _make_execution_function
    return model._make_execution_function(mode)
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 1983, in _make_execution_function
    self._make_fit_function()
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 1926, in _make_fit_function
    '_fit_function', [self.total_loss] + metrics_tensors)
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 1895, in _make_train_function_helper
    params=self._collected_trainable_weights, loss=self.total_loss)
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py", line 379, in get_updates
    return [self.apply_gradients(grads_and_vars)]
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py", line 364, in apply_gradients
    update_ops.append(update_grad_to_var(grad, var))
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py", line 351, in update_grad_to_var
    grad.values, var, grad.indices)
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py", line 693, in _resource_apply_sparse_duplicate_indices
    return self._resource_apply_sparse(summed_grad, handle, unique_indices)
  File "/home/flydsc/.local/lib/python3.6/site-packages/keras_radam/optimizer_v2.py", line 180, in _resource_apply_sparse
    m_t = self._resource_scatter_add(m, indices, m_scaled_g_values)
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py", line 415, in __getattribute__
    raise e
  File "/home/flydsc/.local/lib/python3.6/site-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py", line 405, in __getattribute__
    return super(OptimizerV2, self).__getattribute__(name)
AttributeError: 'RAdam' object has no attribute '_resource_scatter_add'

maybe I should follow some rules to do the replacement?

Any thoughts or ideas are appraciated.

from keras-radam.

stale avatar stale commented on May 18, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from keras-radam.

ferrydjaja avatar ferrydjaja commented on May 18, 2024

I have the same issue here AttributeError: 'RAdam' object has no attribute '_resource_scatter_add'. how can I resolve it?

from keras-radam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.