Skip to main content

Python tic tac toe state generator and GPT fine tuning

Project description

Simple python implementation of Tic Tac Toe.

Designed to make GPT able to recognize valid moves in Tic Tac Toe

$ pip install tictactoe-gpt-finetuning

Examples

Generate a game:

from tictactoe_gpt_finetuning import tictactoe
print( tictactoe.generate_random_game() )

Generate many games:

from tictactoe_gpt_finetuning import tictactoe
print( tictactoe.generate_n_games() )

Initialize and use the game board to place in top left:

from tictactoe_gpt_finetuning import tictactoe
b = tictactoe.BoardState()
b.make_move( 0, 0, 'x' )
print( b )
# output:
# x - -
# - - -
# - - -

Train a Model

We can compare inputs to outputs of the model, and compare predictions of the model before and after finetuning.

from tictactoe import Model, finetune, compare_tictactoe_predictions
gpt = Model()

# See what predictions look like before finetuning
compare_tictactoe_predictions( gpt )

# Fine-tune the model
finetune( gpt, n_epochs=10 )

# See what new predictions look like after finetuning
compare_tictactoe_predictions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tictactoe-gpt-finetuning-0.1.3.tar.gz (5.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page