Skip to content

AttributeError: 'str' object has no attribute 'decode' #1

Description

@way-thu

hello mamba, thank you for your sharing, your project has been really helpful to me, but I've encountered some issues during the running, and I hope you can help me resolve them. When i run the testing.py, It displays the following error:
image
As I'm a beginner, there are many things I still can't quite understand, and I hope to have more opportunities to communicate with you. I'm wondering if it's possible to exchange contact information for convenience. I hope this won't be a bother to you. Thank you very much.

Activity

  1. basil-k-aji-dev commented on Oct 12, 2023

    @basil-k-aji-dev
    Owner

    Ensure that you are using a compatible version of TensorFlow, Keras, and other relevant packages. Different versions of TensorFlow may have variations in how data is loaded and processed. Train the model correctly and assess its performance on the SUMO simulator. Training creates a 'model' folder with training data. Do you have it?. If you have limited computational resources, you can reduce the number of episodes in the 'training_settings.ini' file.

    The error message AttributeError: 'str' object has no attribute 'decode' indicates that you are trying to call the decode() method on a string that is already decoded from bytes. This can happen if you are trying to load a model that was saved with a different version of TensorFlow than the version you are currently using.

    • Upgrade to the latest version of TensorFlow.
    • Downgrade to the version of TensorFlow that was used to save the model.
  2. way-thu commented on Oct 13, 2023

    @way-thu
    Author

    Ensure that you are using a compatible version of TensorFlow, Keras, and other relevant packages. Different versions of TensorFlow may have variations in how data is loaded and processed. Train the model correctly and assess its performance on the SUMO simulator. Training creates a 'model' folder with training data. Do you have it?. If you have limited computational resources, you can reduce the number of episodes in the 'training_settings.ini' file.

    The error message AttributeError: 'str' object has no attribute 'decode' indicates that you are trying to call the decode() method on a string that is already decoded from bytes. This can happen if you are trying to load a model that was saved with a different version of TensorFlow than the version you are currently using.

    • Upgrade to the latest version of TensorFlow.
    • Downgrade to the version of TensorFlow that was used to save the model.

    thank u very much, mamba. I have solved the above problem. However, due to the limited computer resources, I spend one hour to train 10 episodes. How can I determine an appropriate number of episodes that will have a good performance and also save time?

  3. basil-k-aji-dev commented on Oct 13, 2023

    @basil-k-aji-dev
    Owner

    The model should run at least 100 episodes to achieve better accuracy. Episodes are akin to knobs in a model, referred to as hyperparameters, and they need to be carefully tuned. The number of episodes is an important hyperparameter because it controls how long the agent will train for. If the agent trains for too few episodes, it may not have enough time to learn the optimal policy.

    To accomplish this, techniques like

    • grid search
    • Hyperband and Bayesian optimization are employed.

    If you don't have sufficient computational resources, consider using an external GPU. Hyperparameter tuning is also quite computationally expensive for complex ML models. This is because hyperparameter optimization involves training the model multiple times with different hyperparameter settings.

  4. way-thu commented on Oct 15, 2023

    @way-thu
    Author

    The model should run at least 100 episodes to achieve better accuracy. Episodes are akin to knobs in a model, referred to as hyperparameters, and they need to be carefully tuned. The number of episodes is an important hyperparameter because it controls how long the agent will train for. If the agent trains for too few episodes, it may not have enough time to learn the optimal policy.

    To accomplish this, techniques like

    • grid search
    • Hyperband and Bayesian optimization are employed.

    If you don't have sufficient computational resources, consider using an external GPU. Hyperparameter tuning is also quite computationally expensive for complex ML models. This is because hyperparameter optimization involves training the model multiple times with different hyperparameter settings.

    Really appreciate! mamba. I may try to run the model for 100 episodes firstly. But how can I be sure that I have achieved a good result after I have run a hundred episodes? Training creates a 'model' folder with training data., there is a picture named "plot_reward". when reward converges, does it indicate that the model has achieved a good result?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions