Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Pass around saved/exported models everywhere #60

Closed
amj opened this issue Feb 5, 2018 · 7 comments
Closed

Pass around saved/exported models everywhere #60

amj opened this issue Feb 5, 2018 · 7 comments

Comments

@amj
Copy link
Contributor

amj commented Feb 5, 2018

instead of having our selfplay workers constantly look for the .data-00000-of-00001, .index, .meta files, we should properly export our graph. Not only would this make a lot of our scripts cleaner, it'd be a good way to run some optimizers etc. prior to farming it all out.

@killerducky
Copy link
Contributor

Running an optimizer, is that like tensorrt? The leela-chess guys had some great results with that.

@amj
Copy link
Contributor Author

amj commented Feb 6, 2018

I hadn't heard of that -- i was pointed towards toco . I'll go look up tensorrt

@killerducky
Copy link
Contributor

leela-chess benchmarks:
glinscott/leela-chess#52 (comment)

Looks like they are working on integrating into TF:
tensorflow/tensorflow#16253

@amj
Copy link
Contributor Author

amj commented Feb 6, 2018

Yes, that's it almost exactly. out_graph = tf.graph_util.convert_variables_to_constants(n.sess, n.sess.graph.as_graph_def(), ["policy_output", "value_output"])

(where n is a dual_net.DualNetworkTrainer object that's initialized)

@Error323
Copy link

Error323 commented Feb 6, 2018

Hi,

Indeed, TensorRT seems very promising, unfortunately as of now you won't be able to export your tensorflow network to uff format for importing as the Merge operator is unsupported. This leaves three possibilities:

  • Create a network clone in TensorRT using their C++ API and use exported weights from tensorflow
  • Wait for TensorRT to support tensorflow 1.4 and beyond
  • Wait for the PR mentioned above to be merged

The PR probably makes the most sense. Nice project! (offtopic: @amj it looks like you're from the AlphaGo documentary, awesome!)

@amj
Copy link
Contributor Author

amj commented Feb 6, 2018

@Error323 thanks for the great summary, much appreciated! We'll check it out. I think it's a pretty open space w.r.t. what sort of optimizations are possible so we might not lock in to TensorRT immediately. (I am the guy from doc, yep -- had to study up on NNs since then ;) I'm really watching the leela chess project with great interest!

@brilee
Copy link
Contributor

brilee commented Jul 14, 2018

I think we've done this in the course of implementing C++ selfplay?

@amj amj closed this as completed Oct 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants