From 49966cd207cbc620d3c701cff88a2c96bfea908c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20M=C3=BCller=20Madsen?= Date: Sat, 10 Mar 2018 01:07:56 +0100 Subject: [PATCH] add script to save models as tar archives --- bin/save_model | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/save_model diff --git a/bin/save_model b/bin/save_model new file mode 100755 index 0000000..37362cc --- /dev/null +++ b/bin/save_model @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +require 'date' + +models_dir = 'models' +model_name = ARGV[0] +model_path = File.join(models_dir, model_name) + +episode_count = (File.read File.join(model_path, 'model.episodes')).to_i + +puts "Found model #{model_name} with episodes #{episode_count} trained!" + +file_name = "model-#{model_name}-#{episode_count}-#{Time.now.strftime('%Y%m%d-%H%M%S')}.tar.gz" +save_path = File.join(models_dir, 'saves', file_name) +puts "Saving to #{save_path}" + +`tar -cvzf #{save_path} -C #{models_dir} #{model_name}`