Giter Site home page Giter Site logo

Comments (5)

delesley avatar delesley commented on May 18, 2024

from fold.

moshelooks avatar moshelooks commented on May 18, 2024

Hrm, sorry you're getting a segfault! The code does seem fine, I don't know what's going wrong based on what you've provided. Maybe you could share the code that actually generated the segfault?

Also you could try running some of our example code (and some TF examples) to see if the problem is with your particular model vs. TF or Fold not running well in general on your machine.

from fold.

moshelooks avatar moshelooks commented on May 18, 2024

P.S. One more thing to check is to make sure that the segfault is actually being generated while the code is running, by e.g. adding a print statement at the very end of your code. I ask this because during development we encountered some issues due to the way TF does dynamic library loading that could cause a segfault when unlinking the library (which happens when the python interpreter exits). FWIW we never encountered any segfaults while code was being run, although ipython would occasionally segfault durring tab completion (this was not a Fold problem per se, TF did the same thing in some cases for unclear reasons).

from fold.

Yan-Huang-Cam avatar Yan-Huang-Cam commented on May 18, 2024

Thank you very much for your prompt replies and help! Following your advice, I found that the problem can be solved by adding a virtualenv (as is suggested by the installation document -- sorry I omitted this at the beginning). As a result, this problem seemed to result from a conflict between some python modules and TF or TF Fold.

However, another problem came up. While the code can run now, the batched cross entropy loss turned out to be the same for each example across all batches during training. I was wondering if there was anything wrong with the training code (a continuation of the code for defining and compiling the blocks in the original post):

     init = tf.global_variables_initializer()
     sess = tf.Session()
     sess.run(init)
     tf.summary.FileWriter('./tf_graph', graph = sess.graph)
     batch_size = 30

     train_set = compiler.build_loom_inputs(Input_train_tf)
     train_feed_dict = {}
     dev_feed_dict = compiler.build_feed_dict(Input_dev_tf)
     for epoch, shuffled in enumerate(td.epochs(train_set, epochs), 1):
       train_loss = 0.0
       for batch in td.group_by_batches(shuffled, batch_size):
        train_feed_dict[compiler.loom_input_tensor] = batch
         _, batch_loss = sess.run([train_step, cross_entropy], train_feed_dic    t)
         print batch_loss
         train_loss += np.sum(batch_loss)
      dev_loss = np.average(sess.run(cross_entropy, dev_feed_dict))
      print dev_loss

Otherwise, would it be possible for you to indicate how to diagnose this problem? Thanks a lot for your attention and time!

from fold.

moshelooks avatar moshelooks commented on May 18, 2024

Train code looks ok. What I would recommend doing here is breaking the code for defining your model down into pieces and putting each inside a function. Then if you have e.g. a foo_block() function you can write unit tests against it and/or interactively debug it with

foo_block().eval(foo_input)

and see that each piece does what you expect.

from fold.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.