English
File size: 935 Bytes
de00bef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
32
# main.py

import os
from AgGPT10m import AgGPT10m  

def main():
    vocab_file = "vocab.json"
    agmodel_file = "AgGPT10m.agmodel"

    if not os.path.exists(vocab_file):
        print(f"Error: Required file '{vocab_file}' not found. Please ensure your vocabulary is built.")
        return

    if not os.path.exists(agmodel_file):
        print(f"Error: Required file '{agmodel_file}' not found. Please ensure your encoded model data is generated.")
        return

    try:
        ag_gpt_model = AgGPT10m(max_n=2, vocab_path=vocab_file, agmodel_path=agmodel_file)
        print("AgGPT10m model initialized and trained for N=1 to N=5.")

        prompt = "The"
        length = 50
        response = ag_gpt_model.ask(prompt, length)
        print(f"\nModel response for prompt '{prompt}' (length {length}):\n{response}")

    except Exception as e:
        print(f"An error occurred: {e}")

if __name__ == "__main__":
    main()