fix import and some error

This commit is contained in:
2023-06-01 17:23:39 +08:00
parent fe2c327f4e
commit be222b4c82
12 changed files with 328 additions and 317 deletions
+4 -2
View File
@@ -1,6 +1,7 @@
from tugo.agents.base import Agent
from tugo.agents.helpers import is_point_an_eye
from game_logic import goboard
# from game_logic import goboard
from tugo.game_logic import goboard_fast as goboard
from tugo.models import AlphaGoModel
import numpy as np
@@ -44,6 +45,7 @@ class DeepLearningAgent(Agent):
@classmethod
def load(cls, file_path, encoder):
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model = AlphaGoModel(encoder.get_input_shape(), is_policy_net=True).to(device)
# model = AlphaGoModel(encoder.get_input_shape(), is_policy_net=True).to(device)
model = AlphaGoModel(encoder.shape(), is_policy_net=True, num_classes=361).to(device)
model.load_state_dict(torch.load(file_path))
return cls(model, encoder)