Untitled
unknown
plain_text
2 years ago
852 B
7
Indexable
import gpt_2_simple as gpt2
import os
import requests
model_name = "124M"
if not os.path.isdir(os.path.join("models", model_name)):
print(f"Downloading {model_name} model...")
gpt2.download_gpt2(model_name=model_name) # model is saved into current directory under /models/124M/
# Let op: preprocess_text_file wordt niet meer gebruikt, omdat finetune een pad naar een bestand verwacht.
def finetune_from_document(sess, document_path, model_name=model_name, steps=10):
if not os.path.exists(document_path):
print("Error: Document path does not exist.")
return
gpt2.finetune(sess, dataset=document_path, model_name=model_name, steps=steps)
sess = gpt2.start_tf_sess()
finetune_from_document(sess, "ib.txt") # Zorg ervoor dat "ib.txt" het correcte pad naar je bestand is.
gpt2.generate(sess)
Editor is loading...
Leave a Comment