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