GithubHelp home page GithubHelp logo

Comments (5)

kopopt avatar kopopt commented on August 20, 2024

@snnn Thanks for your feedback. Can you be more specific? Currently I did not implement the shape function as it doesn't affect training/testing. Will it affect your usage case? Thanks.

from fast_tffm.

snnn avatar snnn commented on August 20, 2024

Hi kopopt,

I guess it is no longer optional. There is a small change in their document of "Adding a New Op" between r0.11 and r0.10. Could you please check it? Sorry, I'm new to tensorflow so I'm not sure if I understood it correctly.

Here is my usage:
I'm trying to running your code on Windows with python 3.5 and tensorflow compiled from master branch. By now, tensorflow on Windows doesn't support dynamic loading user dlls, so I moved fm_grad_op.cc, fm_parser_op.cc and fm_scorer_op.cc to tensorflow\core\user_ops dir in my build.

And this is the output: (for command "python fast_tffm.py train sample.cfg")

Config:
  factor_num = 8
  vocabulary_size = 50000
  vocabulary_block_num = 2
  model_file = ./model
  hash_feature_id = True
  batch_size = 100
  init_value_range = 0.0001
  factor_lambda = 1
  bias_lambda = 1
  thread_num = 10
  epoch_num = 2
  train_files = ./data/train_0,./data/train_1,./data/train_2,./data/train_3,./data/train_4
  weight_files = ./data/weight_0,./data/weight_1,./data/weight_2,./data/weight_3,./data/weight_4
  validation_files = ./data/test_0,./data/test_1
  learning_rate = 0.01
  adagrad.initial_accumulator = 0.1
  loss_type = logistic
Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1789, in set_shapes_for_outputs
    shape_func = _shape_registry.lookup(op.type)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\registry.py", line 93, in lookup
    "%s registry has no entry for: %s" % (self._name, name))
LookupError: shape functions registry has no entry for: FmParser

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1792, in set_shapes_for_outputs
    shape_func = _default_shape_function_registry.lookup(op.type)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\registry.py", line 93, in lookup
    "%s registry has no entry for: %s" % (self._name, name))
LookupError: default shape functions registry has no entry for: FmParser

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "fast_tffm.py", line 101, in <module>
    local_train(train_files, weight_files, validation_files, epoch_num, vocabulary_size, vocabulary_block_num, hash_feature_id, factor_num, init_value_range, loss_type, optimizer, batch_size, factor_lambda, bias_lambda, thread_num, model_file)
  File "D:\os\tensorflow\tensorflow\contrib\cmake\fast_tffm\py\fm_train.py", line 100, in local_train
    model = LocalFmModel(_queue_size(train_files, validation_files, epoch_num), epoch_num, vocabulary_size, vocabulary_block_num, hash_feature_id,factor_num, init_value_range, loss_type, optimizer, batch_size, factor_lambda, bias_lambda)
  File "D:\os\tensorflow\tensorflow\contrib\cmake\fast_tffm\py\fm_model.py", line 68, in __init__
    self.saver = tf.train.Saver(self.vocab_blocks)
  File "C:\Python35\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 3126, in device
    yield
  File "D:\os\tensorflow\tensorflow\contrib\cmake\fast_tffm\py\fm_model.py", line 55, in __init__
    labels, weights, ori_ids, feature_ids, feature_vals, feature_poses = fm_ops.fm_parser(self.file_id, self.data_file, self.weight_file, batch_size, vocabulary_size, hash_feature_id)
  File "C:\Python35\lib\site-packages\tensorflow\python\ops\gen_user_ops.py", line 95, in fm_parser
    hash_feature_id=hash_feature_id, name=name)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 759, in apply_op
    return op
  File "C:\Python35\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 3698, in get_controller
    yield default
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 759, in apply_op
    return op
  File "C:\Python35\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 4216, in name_scope
    yield scope
  File "C:\Python35\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 3698, in get_controller
    yield default
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 4216, in name_scope
    yield scope
  File "C:\Python35\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2944, in name_scope
    yield "" if new_stack is None else new_stack + "/"
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 4216, in name_scope
    yield scope
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 759, in apply_op
    return op
  File "C:\Python35\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 254, in _MaybeColocateWith
    yield
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 750, in apply_op
    op_def=op_def)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2423, in create_op
    set_shapes_for_outputs(ret)
  File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1795, in set_shapes_for_outputs
    % op.type)
RuntimeError: No shape function registered for standard op: FmParser

from fast_tffm.

kopopt avatar kopopt commented on August 20, 2024

@snnn
I upgraded tensorflow on my mac and ubuntu from 0.10 to 0.11.0rc2, and it is still working.. I use python 2.

from fast_tffm.

snnn avatar snnn commented on August 20, 2024

You are right. I tested it on my Fedora machine, it works well. So it is a windows specific problem.

from fast_tffm.

snnn avatar snnn commented on August 20, 2024

Added

_ops.RegisterShape("FmGrad")(None)
_ops.RegisterShape("FmParser")(None)
_ops.RegisterShape("FmScorer")(None)

to C:\Python35\Lib\site-packages\tensorflow\python\ops\gen_user_ops.py in my tensorflow installation, now it works on Windows.

Thank you!

from fast_tffm.

Related Issues (7)

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.