[英]Tetxtgenrnn save to a specific path
I am trying to save the weights and generated text from running a model to a specific path (such as current directory/results).我正在尝试将运行 model 的权重和生成的文本保存到特定路径(例如当前目录/结果)。 Is there a parameter I can pass to my train function to specify a path?
是否有一个参数可以传递给我的火车 function 来指定路径? Such as:
如:
train_function(
file_path=file,
new_model=True,
save_path='./results'
)
Currently it is just saving to my root directory.目前它只是保存到我的根目录。 Also, is there documentation for all of the parameters you can pass to a train function?
此外,是否有关于您可以传递给火车 function 的所有参数的文档? Thank, Binkie
谢谢,宾基
Actually you gotta use the generate_to_file function.实际上你必须使用 generate_to_file function。 So, something like:
所以,像:
# 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)
This should get it to save generated text to a specific file/path.这应该让它将生成的文本保存到特定的文件/路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.