[英]Tetxtgenrnn save to a specific path
我正在尝试将运行 model 的权重和生成的文本保存到特定路径(例如当前目录/结果)。 是否有一个参数可以传递给我的火车 function 来指定路径? 如:
train_function(
file_path=file,
new_model=True,
save_path='./results'
)
目前它只是保存到我的根目录。 此外,是否有关于您可以传递给火车 function 的所有参数的文档? 谢谢,宾基
实际上你必须使用 generate_to_file function。 所以,像:
# Use os to get the current path of your models folder
this_file_path = os.path.realpath('models/models_test')
# Generate a name for your file
timestring = datetime.now().strftime('%Y%m%d_%H%M%S')
gen_file = '{}_gentext_{}.txt'.format(model_name, timestring)
textgen.generate_to_file(this_file_path + '/results/' + gen_file,
temperature=[0.1, 0.3, 0.5, 0.7, 0.9, 1.0],
prefix=None,
n=1000,
max_gen_length=300)
这应该让它将生成的文本保存到特定的文件/路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.