Skip to content

Commit 5b63d72

Browse files
committed
Merge pull request #1459 from alexunderch:cleanup
PiperOrigin-RevId: 861173283 Change-Id: Id57d655e7ce13a9938316eb2fdb45b5e65f39b98
2 parents c65304e + ac8b162 commit 5b63d72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+11
-7956
lines changed

.github/workflows/wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ jobs:
132132
133133
# Install the built wheel and run the full tests on this host. The full
134134
# tests include all the ones that use the machine learning libraries,
135-
# such as Tensorflow, PyTorch, and JAX.
135+
# such as PyTorch, and JAX.
136136
- name: Install bdist_wheel and full tests
137137
run: |
138138
source ./venv/bin/activate

docs/alpha_zero.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# AlphaZero
22

3-
OpenSpiel includes two implementations of AlphaZero, one based on Tensorflow (in
4-
Python). The other based on C++ LibTorch. This document covers mostly the
5-
TF-based implementation and common components. For the Libtorch-based
6-
implementation,
3+
This was an old implementation of OpenSpiel based on TF1. There is another other
4+
based on C++ LibTorch. This document covers mostly the old TF-based
5+
implementation and common components. For the Libtorch-based implementation,
76
[see here](https://github.com/deepmind/open_spiel/tree/master/open_spiel/algorithms/alpha_zero_torch).
87

9-
**Note**: as of OpenSpiel 1.6, the Tensorflow version (based on TF1) is no
10-
longer maintained.
11-
128
**Disclaimer**: this is not the code that was used for the Go challenge matches
139
or the AlphaZero paper results. It is a re-implementation for illustrative
1410
purposes, and although it can handle games like Connect Four, it is not designed

open_spiel/data/paper_data/routing_game_experiments/utils.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import matplotlib.pyplot as plt
2323
import numpy as np
24-
import tensorflow.compat.v1 as tf
2524

2625
from open_spiel.python import policy as policy_module
2726
from open_spiel.python import rl_environment
@@ -30,7 +29,6 @@
3029
from open_spiel.python.algorithms import exploitability
3130
from open_spiel.python.algorithms import external_sampling_mccfr as external_mccfr
3231
from open_spiel.python.algorithms import fictitious_play
33-
from open_spiel.python.algorithms import nfsp
3432
from open_spiel.python.algorithms import noisy_policy
3533
from open_spiel.python.games import dynamic_routing
3634
from open_spiel.python.games import dynamic_routing_utils
@@ -41,6 +39,7 @@
4139
from open_spiel.python.mfg.algorithms import policy_value
4240
from open_spiel.python.mfg.games import dynamic_routing as mean_field_routing_game
4341
import pyspiel
42+
from open_spiel.python.pytorch import nfsp
4443
# pylint:enable=line-too-long
4544

4645

@@ -738,7 +737,6 @@ def action_probabilities(self, state, player_id=None):
738737

739738
def neural_ficticious_self_play(seq_game,
740739
num_epoch,
741-
sess,
742740
compute_metrics=False):
743741
env = rl_environment.Environment(seq_game)
744742
# Parameters from the game.
@@ -769,13 +767,13 @@ def neural_ficticious_self_play(seq_game,
769767

770768
# freq_epoch_printing = num_epoch // 10
771769
agents = [
772-
nfsp.NFSP(sess, idx, info_state_size, num_actions, hidden_layers_sizes,
773-
**kwargs) for idx in range(num_players)
770+
nfsp.NFSP(
771+
idx, info_state_size, num_actions, hidden_layers_sizes, **kwargs
772+
)
773+
for idx in range(num_players)
774774
]
775775
joint_avg_policy = NFSPPolicies(env, agents, nfsp.MODE.average_policy)
776776

777-
sess.run(tf.global_variables_initializer())
778-
# print("TF initialized.")
779777
tick_time = time.time()
780778
for _ in range(num_epoch):
781779
# if ep % freq_epoch_printing == 0:

open_spiel/python/algorithms/tf/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

open_spiel/python/algorithms/tf/alpha_zero_example.py

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)