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 details)

Uploaded Source

File details

Details for the file tictactoe-gpt-finetuning-0.1.3.tar.gz.

File metadata

File hashes

Hashes for tictactoe-gpt-finetuning-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f376d792a80aa0e322fbc2d9e08c7ebda83e87c29d6f3d30d63aef5dcccbca5d
MD5 55c57ce1a4b533e881458f067c6c9abb
BLAKE2b-256 f68f1e64cdedf60ffef82158c690e1725b2f43746d6d305f398aca7309e07a2e

See more details on using hashes here.

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