I want to call this main(_)
function from another Python script without spawning a new process (so that it's easier to debug). However, that function is written to work with command line arguments. What would be the cleanest way call that function directly from another function?
You can import FLAGS
and then define the required args (train_data, eval_data, save_path).
In [13]: from tensorflow.models.embedding.word2vec_optimized import FLAGS
In [14]: from tensorflow.models.embedding.word2vec_optimized import main
In [16]: main(_)
--train_data --eval_data and --save_path must be specified.
An exception has occurred, use %tb to see the full traceback.
In [17]: FLAGS.train_data = "this"
In [18]: FLAGS.eval_data = "that"
In [19]: FLAGS.save_path = "some_path"
In [20]: main(_)
I tensorflow/core/common_runtime/local_device.cc:40] Local device intra op parallelism threads: 8