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

Unhashable type numpy error #52

Closed
Potajito opened this issue Apr 6, 2023 · 10 comments
Closed

Unhashable type numpy error #52

Potajito opened this issue Apr 6, 2023 · 10 comments
Assignees
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@Potajito
Copy link

Potajito commented Apr 6, 2023

Hi!
I'm trying to run the script, but I'm getting the numpy error "TypeError: unhashable type: 'numpy.ndarray'". This is on latest version, tried in windows and ubuntu, same issue. Python 3.10 and 3.11. The script seems to see the screen, but fails to continue.
Any idea?
Thanks!

INFO main.py 56 Running...
INFO deploy_agent.py 94 INITIALIZATION [self.run]: Loading Model
INFO deploy_agent.py 97 INITIALIZATION [self.run]: Create SuperAutoPetsEnv Object
INFO deploy_agent.py 104 CV SYSTEM [self.run]: Detect the Pets and Food in the Shop Slots
INFO deploy_agent.py 106 CV SYSTEM [self.run]: Calls [image_detection.find_the_animals]
INFO deploy_agent.py 111 CV SYSTEM [self.run]: The detected Pets and Food in the Shop is : ['fish', 'horse', 'pig', 'honey']
INFO deploy_agent.py 112 GAME ENGINE [self.run]: Set Environment Shop = detected Pets and Food
INFO deploy_agent.py 121 GAME ENGINE [self.run]: Get the best action to make for the given state from the loaded model
Traceback (most recent call last):
  File "/home/pablo/super-ml-pets/main.py", line 63, in <module>
    main()
  File "/home/pablo/super-ml-pets/main.py", line 57, in main
    run(ret)
  File "/home/pablo/super-ml-pets/src/deploy_agent.py", line 128, in run
    " Current Team and Shop \n{}".format(s[action][0]))
TypeError: unhashable type: 'numpy.ndarray'
@Potajito Potajito changed the title INFO main.py 56 Running... INFO deploy_agent.py 94 INITIALIZATION [self.run]: Loading Model INFO deploy_agent.py 97 INITIALIZATION [self.run]: Create SuperAutoPetsEnv Object INFO deploy_agent.py 104 CV SYSTEM [self.run]: Detect the Pets and Food in the Shop Slots INFO deploy_agent.py 106 CV SYSTEM [self.run]: Calls [image_detection.find_the_animals] INFO deploy_agent.py 111 CV SYSTEM [self.run]: The detected Pets and Food in the Shop is : ['fish', 'horse', 'pig', 'honey'] INFO deploy_agent.py 112 GAME ENGINE [self.run]: Set Environment Shop = detected Pets and Food INFO deploy_agent.py 121 GAME ENGINE [self.run]: Get the best action to make for the given state from the loaded model Traceback (most recent call last): File "/home/pablo/super-ml-pets/main.py", line 63, in <module> main() File "/home/pablo/super-ml-pets/main.py", line 57, in main run(ret) File "/home/pablo/super-ml-pets/src/deploy_agent.py", line 128, in run " Current Team and Shop \n{}".format(s[action][0])) Unhashable type numpy error Apr 6, 2023
@andreped andreped added the bug Something isn't working label Apr 7, 2023
@andreped
Copy link
Owner

andreped commented Apr 7, 2023

I'm currently on Easter holiday, but I could take a look after the weekend.

I believe the deployment used to work just fine. Might be that we should change the numpy version, or similar.

Could also be that the deployment was not done according to the documentations. Could you take another look to ensure you have followed every single step (see here).

Could also be that the game's UI has changed drastically from last time resulting in unexpected behaviour.

@andreped
Copy link
Owner

andreped commented Apr 7, 2023

BTW: Did you observe any mouse movements?

I launched the game to check, and I noticed that the icons of all animals seem to have changed. The UI also has been modified slightly. Hence, we might have to update the machine vision system to work with the new version of the game.

@andreped
Copy link
Owner

andreped commented Apr 7, 2023

I was unable to debug this right now, as I only have a macbook and ran into the issue #54.

@Potajito
Copy link
Author

Potajito commented Apr 7, 2023

Yeah, I'm leaning towards UI changes. I reverted animal icons to classic style, and that helped the script to see them, but I think it has troubles with the interface. No mouse movements over here. Gonna tinker a bit with the vision system on my side see what I can come up. CHeers!

@andreped
Copy link
Owner

andreped commented Apr 7, 2023

Oh, it is possible to do that! Great!

I could see if it works on my old ass windows laptop. Hang on a bit.

If you fork the repo, you could adjust it as you'd like. If you manage to get it working, you could make a PR and I could try it on my end :]

@andreped
Copy link
Owner

andreped commented Apr 7, 2023

I tried changing it but it still looks like this? I'm using the web app without being logged in. Did it work for you?

Screenshot 2023-04-07 at 14 30 29

@Potajito
Copy link
Author

Potajito commented Apr 7, 2023

Its a bit counter intuitive to change the animal graphics. You do it in the main menu, customize, pets, change all, classic.
Gonna try and fork it this weekend if I got time and play with it a bit. Also gonna try my hand at fixing the 1080p res requirement, should be that hard.

@andreped
Copy link
Owner

andreped commented Apr 7, 2023

Its a bit counter intuitive to change the animal graphics. You do it in the main menu, customize, pets, change all, classic.

Yeah, I tried. Did not seem like it changed the animals, but it did change the UI in general, as far as I could see.

Also gonna try my hand at fixing the 1080p res requirement, should be that hard.

I made an issue regarding that which I could assign to you if you want, see issue #17. I made a new comment there regarding what you likely need to change to get this working (see here).

@andreped
Copy link
Owner

andreped commented Apr 7, 2023

I managed to reproduce this issue. Note that you can increase verbosity by adding --verbose 2 to the run command.

From my verbose below, you can see this line INFO deploy_agent.py 111 CV SYSTEM [self.run]: The detected Pets and Food in the Shop is : ['apple'], which means that it was unable to find any pets. Hence, this would indicate that the templates of all animals needs updating.

Could you send me a screenshot how it looks before and after changing style of animals/UI?

This is my verbose:

(venv) PS C:\Users\andrp\workspace\super-ml-pets> python .\main.py --task deploy --infer_model .\models\model_sap_gym_sb3_180822_checkpoint_2175_steps --verbose 2
DEBUG main.py 41 Namespace(batch_size=512, finetune=None, gamma=0.99, infer_model='.\\models\\model_sap_gym_sb3_180822_checkpoint_2175_steps', infer_pversion='3.7', learning_rate=0.0003, model_name='rl_model', nb_games=10000, nb_retries=1, nb_steps=10000, save_freq=10000, task='deploy', verbose=2)
DEBUG __init__.py 277 matplotlib data path: C:\Users\andrp\workspace\super-ml-pets\venv\lib\site-packages\matplotlib\mpl-data
DEBUG __init__.py 277 CONFIGDIR=C:\Users\andrp\.matplotlib
DEBUG __init__.py 1447 interactive is False
DEBUG __init__.py 1448 platform is win32
[...]
DEBUG __init__.py 277 CACHEDIR=C:\Users\andrp\.matplotlib
DEBUG font_manager.py 1439 Using fontManager instance from C:\Users\andrp\.matplotlib\fontlist-v330.json
INFO main.py 53 Pausing...
INFO main.py 56 Running...
INFO deploy_agent.py 94 INITIALIZATION [self.run]: Loading Model
INFO deploy_agent.py 97 INITIALIZATION [self.run]: Create SuperAutoPetsEnv Object
INFO deploy_agent.py 104 CV SYSTEM [self.run]: Detect the Pets and Food in the Shop Slots
INFO deploy_agent.py 106 CV SYSTEM [self.run]: Calls [image_detection.find_the_animals]
INFO deploy_agent.py 111 CV SYSTEM [self.run]: The detected Pets and Food in the Shop is : ['apple']
INFO deploy_agent.py 112 GAME ENGINE [self.run]: Set Environment Shop = detected Pets and Food
INFO deploy_agent.py 121 GAME ENGINE [self.run]: Get the best action to make for the given state from the loaded model
Traceback (most recent call last):
  File ".\main.py", line 63, in <module>
    main()
  File ".\main.py", line 57, in main
    run(ret)
  File "C:\Users\andrp\workspace\super-ml-pets\src\deploy_agent.py", line 128, in run
    " Current Team and Shop \n{}".format(s[action][0]))
TypeError: unhashable type: 'numpy.ndarray'

@andreped andreped self-assigned this Apr 11, 2023
@andreped andreped added the duplicate This issue or pull request already exists label Apr 11, 2023
@andreped
Copy link
Owner

A fix for this was added by @laughinggaschambers in dd96345.

See #55 (comment) for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
Development

No branches or pull requests

2 participants