Metadata-Version: 2.1
Name: tictactoe-gpt-finetuning
Version: 0.1.2
Summary: Python tic tac toe state generator and GPT fine tuning
Home-page: https://github.com/pesvut/tictactoe-gpt-finetuning
Author: Nicky Pochinkov
Author-email: work@nicky.pro
License: MIT
Keywords: tictactoe,llm,language-models
License-File: LICENSE

TicTacToe GPT Finetuning
========================

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:

.. code:: python

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

Generate many games:

.. code:: python

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

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

.. code:: python

    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.

.. code:: python

    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

