Skip to content

Commit

Permalink
Fix missing name code logging in q-learning.
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfi1 committed Oct 20, 2024
1 parent 8770e4c commit e2ec94b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions slippi_ai/train_q_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,10 @@ def train(config: Config):
json.dump(name_map, f)
wandb.save(name_map_path, policy='now')

missing_name_code = len(name_map)
num_codes = missing_name_code + 1

def encode_name(name: str) -> np.uint8:
return np.uint8(name_map.get(name, missing_name_code))
batch_encode_name = np.vectorize(encode_name)
num_codes = nametags.max_name_code(name_map) + 1
encode_name = nametags.name_encoder(name_map)
encode_name_uint8 = lambda name: np.uint8(encode_name(name))
batch_encode_name = np.vectorize(encode_name_uint8)

# Create data sources for train and test.
data_config = dict(
Expand Down

0 comments on commit e2ec94b

Please sign in to comment.