finalfusion / finalfusion-tensorflow-ops Goto Github PK
View Code? Open in Web Editor NEWTensorflow Op for finalfusion embeddings
Home Page: https://finalfusion.github.io/
License: Other
Tensorflow Op for finalfusion embeddings
Home Page: https://finalfusion.github.io/
License: Other
Take optional embedding to mask failed lookups in ff_lookup
op.
Related to addition of an unknown word representation in finalfusion-rust
The failure part of the log. Environment file below (but pretty boring), same setup works on Linux.
=================================== FAILURES ===================================
7: ______________________________ test_graph_lookup _______________________________
7:
7: ff_lib = <module '35d08339424fb7a799b84234e2d9d0a3'>
7:
7: def test_graph_lookup(ff_lib):
7: embeddings = ff_lib.ff_embeddings()
7: > init = ff_lib.initialize_ff_embeddings(embeddings, "tests/data/test.fifu", False)
7:
7: ../../tests/test_graph_mode.py:8:
7: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
7: <string>:172: in initialize_ff_embeddings
7: ???
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py:527: in _apply_op_helper
7: preferred_dtype=default_dtype)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/ops.py:1224: in internal_convert_to_tensor
7: ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:305: in _constant_tensor_conversion_function
7: return constant(v, dtype=dtype, name=name)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:246: in constant
7: allow_broadcast=True)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:284: in _constant_impl
7: allow_broadcast=allow_broadcast))
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/tensor_util.py:573: in make_tensor_proto
7: append_fn(tensor_proto, proto_values)
7: tensorflow/python/framework/fast_tensor_util.pyx:134: in tensorflow.python.framework.fast_tensor_util.AppendBoolArrayToTensorProto
7: ???
7: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
7:
7: def append(self, value):
7: """Appends an item to the list. Similar to list.append()."""
7: > self._values.append(self._type_checker.CheckValue(value))
7: E UnboundLocalError: local variable 'self' referenced before assignment
7:
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/google/protobuf/internal/containers.py:255: UnboundLocalError
7: ___________________________ test_graph_lookup_masked ___________________________
7:
7: ff_lib = <module '35d08339424fb7a799b84234e2d9d0a3'>
7:
7: def test_graph_lookup_masked(ff_lib):
7: embeddings = ff_lib.ff_embeddings()
7: > init = ff_lib.initialize_ff_embeddings(embeddings, "tests/data/test.fifu", True)
7:
7: ../../tests/test_graph_mode.py:41:
7: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
7: <string>:172: in initialize_ff_embeddings
7: ???
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py:527: in _apply_op_helper
7: preferred_dtype=default_dtype)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/ops.py:1224: in internal_convert_to_tensor
7: ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:305: in _constant_tensor_conversion_function
7: return constant(v, dtype=dtype, name=name)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:246: in constant
7: allow_broadcast=True)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:284: in _constant_impl
7: allow_broadcast=allow_broadcast))
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/tensor_util.py:573: in make_tensor_proto
7: append_fn(tensor_proto, proto_values)
7: tensorflow/python/framework/fast_tensor_util.pyx:134: in tensorflow.python.framework.fast_tensor_util.AppendBoolArrayToTensorProto
7: ???
7: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
7:
7: def append(self, value):
7: """Appends an item to the list. Similar to list.append()."""
7: > self._values.append(self._type_checker.CheckValue(value))
7: E UnboundLocalError: local variable 'self' referenced before assignment
7:
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/google/protobuf/internal/containers.py:255: UnboundLocalError
7: ______________________________ test_graph_errors _______________________________
7:
7: ff_lib = <module '35d08339424fb7a799b84234e2d9d0a3'>
7:
7: def test_graph_errors(ff_lib):
7: embeddings = ff_lib.ff_embeddings()
7: tuebingen_unmasked = ff_lib.ff_lookup(embeddings, "Tübingen", mask_empty_string=False, mask_failed_lookup=False,
7: embedding_len=100)
7: ber_bad_shape = ff_lib.ff_lookup(embeddings, "Berlin", mask_empty_string=False, mask_failed_lookup=False,
7: embedding_len=10)
7: assert ber_bad_shape.shape == (10,)
7: empty_unmasked = ff_lib.ff_lookup(embeddings, "", mask_empty_string=False, mask_failed_lookup=False,
7: embedding_len=100)
7:
7: with tf.Session() as sess:
7: with pytest.raises(tf.errors.UnknownError):
7: > sess.run([ff_lib.initialize_ff_embeddings(embeddings, "foo.fifu", False)])
7:
7: ../../tests/test_graph_mode.py:65:
7: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
7: <string>:172: in initialize_ff_embeddings
7: ???
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/op_def_library.py:527: in _apply_op_helper
7: preferred_dtype=default_dtype)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/ops.py:1224: in internal_convert_to_tensor
7: ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:305: in _constant_tensor_conversion_function
7: return constant(v, dtype=dtype, name=name)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:246: in constant
7: allow_broadcast=True)
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:284: in _constant_impl
7: allow_broadcast=allow_broadcast))
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/tensorflow/python/framework/tensor_util.py:573: in make_tensor_proto
7: append_fn(tensor_proto, proto_values)
7: tensorflow/python/framework/fast_tensor_util.pyx:134: in tensorflow.python.framework.fast_tensor_util.AppendBoolArrayToTensorProto
7: ???
7: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
7:
7: def append(self, value):
7: """Appends an item to the list. Similar to list.append()."""
7: > self._values.append(self._type_checker.CheckValue(value))
7: E UnboundLocalError: local variable 'self' referenced before assignment
7:
7: /nix/store/hpi9pphfy2pg3w5j4yhl1bqbv7slclvh-python3-3.7.4-env/lib/python3.7/site-packages/google/protobuf/internal/containers.py:255: UnboundLocalError
7: ----------------------------- Captured stderr call -----------------------------
7: WARNING: Logging before flag parsing goes to stderr.
7: W0925 14:35:32.100250 4597292352 deprecation_wrapper.py:119] From /Users/daniel/git/finalfusion-tensorflow/tests/test_graph_mode.py:63: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
7:
7: 2019-09-25 14:35:32.102395: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
7: ------------------------------ Captured log call -------------------------------
7: WARNING tensorflow:deprecation_wrapper.py:119 From /Users/daniel/git/finalfusion-tensorflow/tests/test_graph_mode.py:63: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
7: ============================== 3 failed in 1.07s ===============================
7/7 Test #7: graph-mode .......................***Failed 5.75 sec
86% tests passed, 1 tests failed out of 7
Total Test time (real) = 9.89 sec
The following tests FAILED:
7 - graph-mode (Failed)
Errors while running CTest
shell.nix
:
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "tensorflow-op-env";
env = buildEnv { name = name; paths = buildInputs; };
nativeBuildInputs = [
cargo
cmake
];
buildInputs = [
darwin.Security
(python3.withPackages (ps: with ps; [
pytest
setuptools
tensorflow-bin
]))
];
propagatedBuildInputs = [
];
}
We're currently running ctest
everytime setup.py
is invoked. We might want to gate this with some flag since not everyone every build needs to run these tests. Also, the tests add a dependency on pytest
which we don't check for in setup.py
(perhaps add as an extra?).
Would it be ok to rename this repository to finalfusion-tensorflow-op
, so that finalfusion-tensorflow
could be used for the finalfusion-tensorflow interoperability crate that I proposed in the alignment PR?
Currently
ff_tf.initialize_ff_embeddings(embeddings, ["./tests/testdata/test", "fifu"])
results in an unhandled exception
2019-09-29 16:08:52.166283: F tensorflow/core/framework/tensor.cc:638] Check failed: 1 == NumElements() (1 vs. 2)Must have a one element tensor
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.