You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been playing around with the idea of having the python script that interacts with dolphin perform computation using a pytorch model. However, when doing this I found that creating a pytorch tensor hangs dolphin, but only after await event.framedrawn() or event.frameadvance() has been called. Importing Pytorch and even loading a pytorch model appears to work fine before one of the aforementioned functions are called. This is done with the --no-subinterpreters version as this uses numpy.
Here's the code for recreation:
from dolphin import event, gui, savestate, memory, controller
import sys
sys.path.append("C:\\Users\\TYLER\\AppData\\Local\\Programs\\Python\\Python38\\Lib\\site-packages")
import torch
import numpy as np
red = 0xffff0000
x = np.array([1,2,3,4])
frame_counter = 0
while True:
frame_counter += 1
# this first part works fine!
tensor = torch.tensor(x, dtype=torch.float)
(width, height, data) = await event.framedrawn()
# await event.frameadvance() # no difference with this instead!
# This line hands Dolphin!
tens = torch.tensor(x, dtype=torch.float)
gui.draw_text((10, 10), red, f"Frame: {frame_counter}")
The text was updated successfully, but these errors were encountered:
Hey, thanks for reporting this issue. Just to make sure what version of the scripting fork this happens on, I see you're importing numpy and pytorch from a Python38 directory, so this is an issue with the Python Scripting Preview 2, correct?
Yes, this is an older version. Thanks for pointing that out - I've been using the new version for some other games, but was testing a new setup on the old mario kart version
Sounds not good, I'll take a look. But fyi maybe I won't be able to fix it this year anymore due to a large vacation, christmas, new years and stuff, just so you know.
VIPTankz
changed the title
Creating PyTorch Tensors hands Dolphin
Creating PyTorch Tensors hangs Dolphin
Nov 17, 2023
I've been playing around with the idea of having the python script that interacts with dolphin perform computation using a pytorch model. However, when doing this I found that creating a pytorch tensor hangs dolphin, but only after await event.framedrawn() or event.frameadvance() has been called. Importing Pytorch and even loading a pytorch model appears to work fine before one of the aforementioned functions are called. This is done with the --no-subinterpreters version as this uses numpy.
Here's the code for recreation:
The text was updated successfully, but these errors were encountered: