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

AttributeError: can't set attribute 'model' #77

Open
surajssamal opened this issue Apr 21, 2024 · 1 comment
Open

AttributeError: can't set attribute 'model' #77

surajssamal opened this issue Apr 21, 2024 · 1 comment

Comments

@surajssamal
Copy link

UserWarning: Do not pass an input_shape/input_dim argument to a layer. When using Sequential models, prefer using an Input(shape) object as the first layer in the model instead.
super().init(**kwargs)
2024-04-21 14:05:53.118504: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:998] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355
2024-04-21 14:05:53.170341: W tensorflow/core/common_runtime/gpu/gpu_device.cc:2251] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
wandb: WARNING The save_model argument by default saves the model in the HDF5 format that cannot save custom objects like subclassed models and custom layers. This behavior will be deprecated in a future release in favor of the SavedModel format. Meanwhile, the HDF5 model is saved as W&B files and the SavedModel as W&B Artifacts.
wandb: WARNING The data_type argument of wandb.keras.WandbCallback is deprecated and will be removed in a future release. Please use input_type instead.
wandb: WARNING Setting input_type = data_type.
Traceback (most recent call last):
File "ml-class/videos/intro/perceptron-single.py", line 33, in
model.fit(X_train, is_five_train, epochs=config.epochs, validation_data=(X_test, is_five_test),
File "/home/nox/.local/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 122, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/nox/.local/lib/python3.10/site-packages/wandb/integration/keras/keras.py", line 555, in set_model
self.model = model
AttributeError: can't set attribute 'model'
Traceback (most recent call last):
File "ml-class/videos/intro/perceptron-single.py", line 33, in
model.fit(X_train, is_five_train, epochs=config.epochs, validation_data=(X_test, is_five_test),
File "/home/nox/.local/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 122, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/nox/.local/lib/python3.10/site-packages/wandb/integration/keras/keras.py", line 555, in set_model
self.model = model
AttributeError: can't set attribute 'model'
wandb: 🚀 View run dark-spaceship-22 at: https://wandb.ai/dailynet/ml-class-videos_intro/runs/yrv31kua
wandb: ⭐️ View project at: https://wandb.ai/dailynet/ml-class-videos_intro
wandb: Synced 5 W&B file(s), 0 media file(s), 2 artifact file(s) and 0 other file(s)
wandb: Find logs at: ./wandb/run-20240421_140549-yrv31kua/logs

@thisisvk45
Copy link

Certainly! Here’s the response starting with the suggested phrasing:


As far as I know from what I learned in my deep learning course, here are the solutions to the issues related to TensorFlow/Keras and Weights & Biases (W&B) integration:

  1. UserWarning: Do not pass input_shape/input_dim to a layer.

    • Use Input(shape) as the first layer:
      model = Sequential([
          Input(shape=(784,)),
          Dense(128),
          Activation('relu'),
          Dense(10),
          Activation('softmax')
      ])
  2. CUDA and GPU Libraries Warning:

  3. W&B Warnings:

    • save_model is deprecated, so switch to the SavedModel format.
    • data_type is deprecated; use input_type instead:
      model.fit(X_train, y_train, 
                epochs=config.epochs, 
                validation_data=(X_test, y_test),
                callbacks=[WandbCallback(input_type='numpy')])
  4. AttributeError: can't set attribute 'model':

    • Ensure you have the latest versions of wandb and Keras. If the issue persists, consider reporting it on the wandb GitHub page.

If problems continue, updating libraries and checking GitHub or relevant forums for similar issues might help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants