Code Monkey home page Code Monkey logo

big-phoney's People

Contributors

repp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

big-phoney's Issues

Dimension incompatibility Issue during Initialization

Hello!

Thanks for the initiative to bring this open source project.

I was on the way to give it a try, and found the error while executing the following line after importing the module successfully.

phoney = BigPhoney()

The error generated is mentioned below. Numpy 1.19.5 is installed. Any help towards resolution would be appreciated.

`---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in
----> 1 phoney = BigPhoney(preprocessors=[])

~/anaconda3/lib/python3.7/site-packages/big_phoney/big_phoney.py in init(self, preprocessors)
13 self.preprocessors = [preprocessor_class() for preprocessor_class in preprocessors]
14 self.phonetic_dict = PhoneticDictionary()
---> 15 self.pred_model = PredictionModel()
16
17 def apply_preprocessors(self, input_string):

~/anaconda3/lib/python3.7/site-packages/big_phoney/prediction_model.py in init(self, search_width)
14 self.search_width = search_width
15 self.utils = PredictionModelUtils()
---> 16 self.training_model, self.encoder, self.decoder = self._build_model()
17 self.load_weights(PREDICTION_MODEL_WEIGHTS_PATH)
18

~/anaconda3/lib/python3.7/site-packages/big_phoney/prediction_model.py in _build_model(self)
73 phone_embeddings = embedding_reshaper(phone_embeddings)
74
---> 75 context = get_context(encoder_outputs, h)
76 phone_and_context = context_phone_concat([context, phone_embeddings])
77 phone_and_context = context_phone_dense(phone_and_context)

~/anaconda3/lib/python3.7/site-packages/big_phoney/prediction_model.py in get_context(encoder_outputs, h_prev)
36 e = attn_dense2(e)
37 attention_weights = attn_softmax(e)
---> 38 context = attn_dot([attention_weights, encoder_outputs])
39 return context
40

~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
950 if _in_functional_construction_mode(self, inputs, args, kwargs, input_list):
951 return self._functional_construction_call(inputs, args, kwargs,
--> 952 input_list)
953
954 # Maintains info about the Layer.call stack.

~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _functional_construction_call(self, inputs, args, kwargs, input_list)
1089 # Check input assumptions set after layer building, e.g. input shape.
1090 outputs = self._keras_tensor_symbolic_call(
-> 1091 inputs, input_masks, args, kwargs)
1092
1093 if outputs is None:

~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _keras_tensor_symbolic_call(self, inputs, input_masks, args, kwargs)
820 return nest.map_structure(keras_tensor.KerasTensor, output_signature)
821 else:
--> 822 return self._infer_output_signature(inputs, args, kwargs, input_masks)
823
824 def _infer_output_signature(self, inputs, args, kwargs, input_masks):

~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _infer_output_signature(self, inputs, args, kwargs, input_masks)
860 # overridden).
861 # TODO(kaftan): do we maybe_build here, or have we already done it?
--> 862 self._maybe_build(inputs)
863 outputs = call_fn(inputs, *args, **kwargs)
864

~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _maybe_build(self, inputs)
2708 # operations.
2709 with tf_utils.maybe_init_scope(self):
-> 2710 self.build(input_shapes) # pylint:disable=not-callable
2711 # We must set also ensure that the layer is marked as built, and the build
2712 # shape is stored since user defined build functions may not be calling

~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/utils/tf_utils.py in wrapper(instance, input_shape)
270 if input_shape is not None:
271 input_shape = convert_shapes(input_shape, to_tuples=True)
--> 272 output_shape = fn(instance, input_shape)
273 # Return shapes from fn as TensorShapes.
274 if output_shape is not None:

~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/layers/merge.py in build(self, input_shape)
678 '%s != %s. ' % (shape1[axes[0]], shape2[axes[1]]) +
679 'Layer shapes: %s, %s. ' % (shape1, shape2) +
--> 680 'Chosen axes: %s, %s' % (axes[0], axes[1]))
681
682 def _merge_function(self, inputs):

ValueError: Dimension incompatibility 20 != None. Layer shapes: (None, 20, 1), (None, None, 512). Chosen axes: 1, 1
`

phoney = BigPhoney() -> global name 'FileNotFoundError' is not defined

Hi,
I have installed the library and tried:

from big_phoney import BigPhoney
phoney = BigPhoney()

but this produces the following error:

/Users/rlujo/env/tmp2/phoney/lib/python2.7/site-packages/big_phoney/utils.pyc in load_pickle_dict(dict_path)
     61 def load_pickle_dict(dict_path):
     62     if not os.path.isfile(dict_path):
---> 63         raise FileNotFoundError('The dictionary file is missing. Generate it by running '
     64                                 '`python dev/generate_dictionaries.py`')

global name 'FileNotFoundError' is not defined

Keras dimension incompatibility when trying to create BigPhoney instance

from big_phoney import BigPhoney
p = BigPhoney()

2020-06-29 17:22:37.950128: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-06-29 17:22:37.965589: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fa9bae19a30 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-29 17:22:37.965621: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/big_phoney.py", line 15, in init
self.pred_model = PredictionModel()
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/prediction_model.py", line 16, in init
self.training_model, self.encoder, self.decoder = self._build_model()
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/prediction_model.py", line 75, in _build_model
context = get_context(encoder_outputs, h)
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/big_phoney/prediction_model.py", line 38, in get_context
context = attn_dot([attention_weights, encoder_outputs])
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 897, in call
self._maybe_build(inputs)
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 2416, in _maybe_build
self.build(input_shapes) # pylint:disable=not-callable
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/utils/tf_utils.py", line 316, in wrapper
output_shape = fn(instance, input_shape)
File "/usr/local/anaconda3/envs/nlu/lib/python3.7/site-packages/tensorflow/python/keras/layers/merge.py", line 677, in build
'Chosen axes: %s, %s' % (axes[0], axes[1]))
ValueError: Dimension incompatibility 20 != None. Layer shapes: (None, 20, 1), (None, None, 512). Chosen axes: 1, 1

Any ideas? Tensorflow is version 2.2 and keras is up to date

module not found error

Summary

I tried installing big-phoney both through pip and also wheel installation. But when I import the package in my program. It says module not found error.

How to reproduce?

install big-phoney package either with pip or .whl file installation and try to import the package in your python file.

Related screen shots

sc16

sc17

jupyter notebooks

I am trying use big-pheney with jupyter notebooks and I get a ValueError when ttrying to use it. How can I resolve this issue?

image

word preprocess

Thanks for this awesome project ! I found a preprocess issue:

print(phoney.phonize("$234.009")) 

print(phoney.phonize("$234.09"))
#T UW1  HH AH1 N D R AH0 D  AH0 N D  TH ER1 D IY2  F AO1 R  D AA1 L ER0 Z  AH0 N D  N AY1 N  S EH1 N T S

the two lines return the same phoneme sequence, but $234.009 not equals $234.09. This situation is strictly differentiated in financial scenarios.

Can not run it on windows 10

All the tensorflow debug seems good, but then I get:

Traceback (most recent call last):
File "test.py", line 3, in
phoney = BigPhoney()
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\big_phoney-1.0.1-py3.7.egg\big_phoney\big_phoney.py", line 15, in init
self.pred_model = PredictionModel()
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\big_phoney-1.0.1-py3.7.egg\big_phoney\prediction_model.py", line 16, in init
self.training_model, self.encoder, self.decoder = self._build_model()
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\big_phoney-1.0.1-py3.7.egg\big_phoney\prediction_model.py", line 75, in _build_model
context = get_context(encoder_outputs, h)
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\big_phoney-1.0.1-py3.7.egg\big_phoney\prediction_model.py", line 38, in get_context
context = attn_dot([attention_weights, encoder_outputs])
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 926, in call
input_list)
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 1098, in _functional_construction_call
self._maybe_build(inputs)
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 2643, in _maybe_build
self.build(input_shapes) # pylint:disable=not-callable
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\utils\tf_utils.py", line 323, in wrapper
output_shape = fn(instance, input_shape)
File "C:\Users\vasil\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\layers\merge.py", line 680, in build
'Chosen axes: %s, %s' % (axes[0], axes[1]))
ValueError: Dimension incompatibility 20 != None. Layer shapes: (None, 20, 1), (None, None, 512). Chosen axes: 1, 1

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.