File size: 708 Bytes
1532c35
 
7fe9bd6
 
 
6d4a32a
 
1532c35
 
6d4a32a
1532c35
 
7fe9bd6
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from transformers import AutoTokenizer

from src.constants import MAX_ATTEMPTS
from src.constants import STARTING_INDEX
from src.params import ReducerParams
from src.predictions import make_predictions
from src.text import get_text

tokenizer = AutoTokenizer.from_pretrained("gpt2")
token_id_predictions, token_predictions = make_predictions(tokenizer)
text = get_text()
all_tokens = tokenizer.encode(text)

INITIAL_STATE = ReducerParams(
    prompt_text=tokenizer.decode(all_tokens[:STARTING_INDEX]),
    player_points=0,
    lm_points=0,
    current_guesses="",
    lm_guesses="",
    remaining_attempts=MAX_ATTEMPTS,
    guess_field="",
    button_label="Guess!",
    bottom_html="",
    word_number=0,
)