@@ -5,7 +5,7 @@ | |||
<AssemblyName>TensorFlow.NET</AssemblyName> | |||
<RootNamespace>Tensorflow</RootNamespace> | |||
<TargetTensorFlow>1.14.1</TargetTensorFlow> | |||
<Version>0.14.1.1</Version> | |||
<Version>0.14.2.0</Version> | |||
<Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors> | |||
<Company>SciSharp STACK</Company> | |||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | |||
@@ -18,12 +18,13 @@ | |||
<Description>Google's TensorFlow full binding in .NET Standard. | |||
Building, training and infering deep learning models. | |||
https://tensorflownet.readthedocs.io</Description> | |||
<AssemblyVersion>0.14.1.1</AssemblyVersion> | |||
<AssemblyVersion>0.14.2.0</AssemblyVersion> | |||
<PackageReleaseNotes>Changes since v0.14.0: | |||
1: Add TransformGraphWithStringInputs. | |||
2: tf.trainer.load_graph, tf.trainer.freeze_graph</PackageReleaseNotes> | |||
2: tf.trainer.load_graph, tf.trainer.freeze_graph | |||
3: Import Protobuf.Text</PackageReleaseNotes> | |||
<LangVersion>7.3</LangVersion> | |||
<FileVersion>0.14.1.1</FileVersion> | |||
<FileVersion>0.14.2.0</FileVersion> | |||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | |||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | |||
<SignAssembly>true</SignAssembly> | |||
@@ -60,8 +61,9 @@ https://tensorflownet.readthedocs.io</Description> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Google.Protobuf" Version="3.11.2" /> | |||
<PackageReference Include="Google.Protobuf" Version="3.11.3" /> | |||
<PackageReference Include="NumSharp" Version="0.30.0-alpha" /> | |||
<PackageReference Include="Protobuf.Text" Version="0.4.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -20,6 +20,7 @@ using System.IO; | |||
using System.Linq; | |||
using static Tensorflow.SaverDef.Types; | |||
using static Tensorflow.Binding; | |||
using Protobuf.Text; | |||
namespace Tensorflow | |||
{ | |||
@@ -187,24 +188,9 @@ namespace Tensorflow | |||
var coord_checkpoint_filename = _GetCheckpointFilename(checkpoint_dir, latest_filename); | |||
if (File.Exists(coord_checkpoint_filename)) | |||
{ | |||
var file_content = File.ReadAllLines(coord_checkpoint_filename); | |||
var file_content = File.ReadAllText(coord_checkpoint_filename); | |||
// https://github.com/protocolbuffers/protobuf/issues/6654 | |||
// var ckpt = CheckpointState.Parser.ParseFrom(file_content); | |||
var ckpt = new CheckpointState(); | |||
var field = CheckpointState.Descriptor.FindFieldByName("model_checkpoint_path"); | |||
ckpt.ModelCheckpointPath = file_content.FirstOrDefault(x => x.StartsWith(field.Name + ":")).Substring(field.Name.Length + 2); | |||
// remove first and last quote. | |||
ckpt.ModelCheckpointPath = ckpt.ModelCheckpointPath.Substring(1, ckpt.ModelCheckpointPath.Length - 2); | |||
field = CheckpointState.Descriptor.FindFieldByName("all_model_checkpoint_paths"); | |||
file_content.Where(x => x.StartsWith(field.Name + ":")) | |||
.ToList() | |||
.ForEach(x => | |||
{ | |||
string value = x.Substring(field.Name.Length + 2); | |||
ckpt.AllModelCheckpointPaths.Add(value.Substring(1, value.Length - 2)); | |||
}); | |||
var ckpt = CheckpointState.Parser.ParseText(file_content); | |||
if (string.IsNullOrEmpty(ckpt.ModelCheckpointPath)) | |||
throw new ValueError($"Invalid checkpoint state loaded from {checkpoint_dir}"); | |||
// For relative model_checkpoint_path and all_model_checkpoint_paths, | |||