umair-nasir14 / Word2World

Word2World is an LLM-based PCG system that creates playable 2D world from stories
Apache License 2.0
35 stars 5 forks source link

[Linux] Exceptions/Warning during generating stage #4

Closed Gracesta closed 3 months ago

Gracesta commented 3 months ago

@umair-nasir14

Hi! Thanks for all the help you gave me, I already ran your project successfully!

However, as we discussed, there are some warnings/exceptions happened during generating stage on below:

TOTAL REWARD for EPISODE: 350
Exception raised: TiffWriter.write() got an unexpected keyword argument 'fps'
 Traceback (most recent call last):
  File "/home/jupyter/Word2World/word2world/generators/openai_model.py", line 688, in action_generation
    video.append_data(frame)
  File "/opt/conda/envs/word2world/lib/python3.10/site-packages/imageio/v2.py", line 226, in append_data
    return self.instance.write(im, **self.write_args)
  File "/opt/conda/envs/word2world/lib/python3.10/site-packages/imageio/plugins/tifffile_v3.py", line 224, in write
    self._fh.write(image, **kwargs)
TypeError: TiffWriter.write() got an unexpected keyword argument 'fps'

Exception raised: '>' not supported between instances of 'builtin_function_or_method' and 'int'
 Traceback (most recent call last):
  File "/home/jupyter/Word2World/word2world/generators/openai_model.py", line 434, in world_generation
    story_paragraphs, total_objectives, no_of_important_tiles, bad_feedback_prompt, good_feedback_prompt = self.feedback_checks(world_eval_dict, previous_eval, story_paragraphs, total_objectives, no_of_important_tiles)
  File "/home/jupyter/Word2World/word2world/generators/generation_base.py", line 90, in feedback_checks
    if round > 0:
TypeError: '>' not supported between instances of 'builtin_function_or_method' and 'int'

Exception raised: 'NoneType' object is not subscriptable
 Traceback (most recent call last):
  File "/home/jupyter/Word2World/word2world/generators/openai_model.py", line 529, in action_generation
    astar_path, _, _, game_map_updated, _ = astar_agent.getSolution(game_state,maxIterations=10000)
  File "/home/jupyter/Word2World/word2world/solvers.py", line 286, in getSolution
    queue.put(Node(state.clone(), None, None))
  File "/home/jupyter/Word2World/word2world/solvers.py", line 622, in clone
    clone.player={"x":self.player["x"], "y":self.player["y"]}
TypeError: 'NoneType' object is not subscriptable

Exception raised: 'NoneType' object is not subscriptable
 Traceback (most recent call last):
  File "/home/jupyter/Word2World/word2world/generators/openai_model.py", line 607, in action_generation
    state, _r, done, _ = env.step(action)
  File "/home/jupyter/Word2World/word2world/agent.py", line 76, in step
    self.move_player(action)
  File "/home/jupyter/Word2World/word2world/agent.py", line 90, in move_player
    new_row = self.player_pos[0] + dx
TypeError: 'NoneType' object is not subscriptable

Exception raised: max() arg is an empty sequence
 Traceback (most recent call last):
  File "/home/jupyter/Word2World/word2world/generators/openai_model.py", line 427, in world_generation
    llm_agent_reward, astar_path, objectives = self.action_generation(round,story['choices'][0]['message']['content'],"protagonist","antagonist", character_discriptions_dict,world_map_fixed,world_map_fixed_with_chars,used_char_dict,used_char_dict_with_char,"color_tiles_img_with_char",
  File "/home/jupyter/Word2World/word2world/generators/openai_model.py", line 702, in action_generation
    return max(all_episodes_rewards), len(astar_path), objective_tile_dict
ValueError: max() arg is an empty sequence

You said these warnings wouldn't hurt the quality of generated stage, but some look kinda dangerous. The world I generated didn't generated enemy, maybe it's because I just ran the algorithm for only two rounds?

I'll upload and merge the environment on my Linux machine later. It might not be the minimal environment but works on my Linux machine.

May I ask a small question here? Is it possible to generate games in other domain using Word2World? (e.g. billiards/ bowling game) It seems very possible if we can adjust the algorithm and prompt to LLM for me, just curious what you think about this possibility of Word2World.

Thanks!

Gracesta commented 3 months ago

Done with uploading the yaml file for Linux machine!

https://github.com/umair-nasir14/Word2World/pull/5#issue-2322405556

umair-nasir14 commented 3 months ago

Hi @Gracesta! Apologies that you are facing a few issues. I have pushed a fix on environment-fix branch. Please let me know if that fixes this issue. Cleaning the code had me ignoring quite a few bugs.

umair-nasir14 commented 3 months ago

I believe this Word2World can be used in any sort of game but the prompting needs to be tuned for that style of game. It would definitely be exciting to see these games come up.

Gracesta commented 3 months ago

Hi @umair-nasir14 ! Thanks for your environment_fix.yml file. I tried but PackagesNotFoundError happened. It seems the new yml file is very similar to the original one?

I believe this Word2World can be used in any sort of game but the prompting needs to be tuned for that style of game. It would definitely be exciting to see these games come up.

Yea, it would be exciting too see those games come up!

umair-nasir14 commented 3 months ago

Thanks for your environment_fix.yml file. I tried but PackagesNotFoundError happened. It seems the new yml file is very similar to the original one?

This is probably because I never texted for Linux. I just tried to remake it and see if I made any mistakes but again, I could not test it on Linux. If you get it to run on Linux then you can make a environment_linux.yml which will be very helpful for community using after you and they will not face the headache you are facing. ;)

umair-nasir14 commented 3 months ago

Hi @Gracesta!

I have fixed the issue which was in the feedback_check and pushed it to main.

Thanks for pointing it out!

Remember there will be some exceptions thrown as it is an out-of-distribution problem for LLMs but eventually, it should be generating the game. Let me know how it goes