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
File details
Details for the file tictactoe-gpt-finetuning-0.1.3.tar.gz
.
File metadata
- Download URL: tictactoe-gpt-finetuning-0.1.3.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f376d792a80aa0e322fbc2d9e08c7ebda83e87c29d6f3d30d63aef5dcccbca5d |
|
MD5 | 55c57ce1a4b533e881458f067c6c9abb |
|
BLAKE2b-256 | f68f1e64cdedf60ffef82158c690e1725b2f43746d6d305f398aca7309e07a2e |