Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: create_run_config() got an unexpected keyword argument 'shard_to_cpu' #168

Open
william-vw opened this issue Jan 16, 2019 · 8 comments

Comments

@william-vw
Copy link

I just tried running the tests using sudo python setup.py test and got the following error, which is seems related to the fact that the shard_to_cpu parameter was removed a while ago. After removing the referred line in g2p_trainer_utils.py it works fine.

test_decode (tests.g2p_unittest.TestG2P) ... ERROR
test_evaluate (tests.g2p_unittest.TestG2P) ... ERROR
test_train (tests.g2p_unittest.TestG2P) ... ERROR

======================================================================
ERROR: test_decode (tests.g2p_unittest.TestG2P)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/william/speech/sphinx/g2p-seq2seq/tests/g2p_unittest.py", line 34, in test_decode
    g2p_model = G2PModel(params, test_path=decode_file_path)
  File "/home/william/speech/sphinx/g2p-seq2seq/g2p_seq2seq/g2p.py", line 89, in __init__
    self.__prepare_model()
  File "/home/william/speech/sphinx/g2p-seq2seq/g2p_seq2seq/g2p.py", line 102, in __prepare_model
    self.params)
  File "/home/william/speech/sphinx/g2p-seq2seq/g2p_seq2seq/g2p_trainer_utils.py", line 230, in create_run_config
    use_tpu=params.use_tpu)
TypeError: create_run_config() got an unexpected keyword argument 'shard_to_cpu'

======================================================================
ERROR: test_evaluate (tests.g2p_unittest.TestG2P)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/william/speech/sphinx/g2p-seq2seq/tests/g2p_unittest.py", line 47, in test_evaluate
    g2p_model = G2PModel(params, test_path=gt_path)
  File "/home/william/speech/sphinx/g2p-seq2seq/g2p_seq2seq/g2p.py", line 89, in __init__
    self.__prepare_model()
  File "/home/william/speech/sphinx/g2p-seq2seq/g2p_seq2seq/g2p.py", line 102, in __prepare_model
    self.params)
  File "/home/william/speech/sphinx/g2p-seq2seq/g2p_seq2seq/g2p_trainer_utils.py", line 230, in create_run_config
    use_tpu=params.use_tpu)
TypeError: create_run_config() got an unexpected keyword argument 'shard_to_cpu'

======================================================================
ERROR: test_train (tests.g2p_unittest.TestG2P)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/william/speech/sphinx/g2p-seq2seq/tests/g2p_unittest.py", line 23, in test_train
    test_path=dev_path)
  File "/home/william/speech/sphinx/g2p-seq2seq/g2p_seq2seq/g2p.py", line 77, in __init__
    self.__prepare_model(train_mode=True)
  File "/home/william/speech/sphinx/g2p-seq2seq/g2p_seq2seq/g2p.py", line 102, in __prepare_model
    self.params)
  File "/home/william/speech/sphinx/g2p-seq2seq/g2p_seq2seq/g2p_trainer_utils.py", line 230, in create_run_config
    use_tpu=params.use_tpu)
TypeError: create_run_config() got an unexpected keyword argument 'shard_to_cpu'

----------------------------------------------------------------------
Ran 3 tests in 0.002s

FAILED (errors=3)
Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0>
@nshmyrev
Copy link
Contributor

Thank you for reporting this issue. Please submit a pull request to update the t2t version and remove unused parameter.

@william-vw
Copy link
Author

Ok, done

@renan-cunha
Copy link

renan-cunha commented Jan 24, 2019

I run into the same problem and now is appearing:

create_run_config() missing 1 required positional argument: 'model_name'

Is there a stable version?

@william-vw
Copy link
Author

I don't think that the pull request has been merged yet - but in the meantime you can simply remove the referred line from g2p_trainer_utils.py.

@agadooPineapple
Copy link

agadooPineapple commented Jan 30, 2019

I am running in a python 3.5 virtual environment and have the same error as @renan-cunha . After removing line 217 (cpu shard) as suggested and running the test again I have the following output:

test_decode (tests.g2p_unittest.TestG2P) ... ERROR
test_evaluate (tests.g2p_unittest.TestG2P) ... ERROR
test_train (tests.g2p_unittest.TestG2P) ... ERROR

======================================================================
ERROR: test_decode (tests.g2p_unittest.TestG2P)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/tests/g2p_unittest.py", line 34, in test_decode
    g2p_model = G2PModel(params, test_path=decode_file_path)
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/g2p_seq2seq/g2p.py", line 89, in __init__
    self.__prepare_model()
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/g2p_seq2seq/g2p.py", line 102, in __prepare_model
    self.params)
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/g2p_seq2seq/g2p_trainer_utils.py", line 229, in create_run_config
    use_tpu=params.use_tpu)
TypeError: create_run_config() missing 1 required positional argument: 'model_name'

======================================================================
ERROR: test_evaluate (tests.g2p_unittest.TestG2P)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/tests/g2p_unittest.py", line 47, in test_evaluate
    g2p_model = G2PModel(params, test_path=gt_path)
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/g2p_seq2seq/g2p.py", line 89, in __init__
    self.__prepare_model()
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/g2p_seq2seq/g2p.py", line 102, in __prepare_model
    self.params)
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/g2p_seq2seq/g2p_trainer_utils.py", line 229, in create_run_config
    use_tpu=params.use_tpu)
TypeError: create_run_config() missing 1 required positional argument: 'model_name'

======================================================================
ERROR: test_train (tests.g2p_unittest.TestG2P)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/tests/g2p_unittest.py", line 23, in test_train
    test_path=dev_path)
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/g2p_seq2seq/g2p.py", line 77, in __init__
    self.__prepare_model(train_mode=True)
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/g2p_seq2seq/g2p.py", line 102, in __prepare_model
    self.params)
  File "/home/ash/Downloaded_programs/p3_5s2s/g2p-seq2seq/g2p_seq2seq/g2p_trainer_utils.py", line 229, in create_run_configstuff 
    use_tpu=params.use_tpu)
TypeError: create_run_config() missing 1 required positional argument: 'model_name'

----------------------------------------------------------------------
Ran 3 tests in 0.005s

FAILED (errors=3)
Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=3 errors=3 failures=0>

@william-vw did you need to change anything else to get it to work?

I also have a python 2.7 virtual environment and it gives a different error for each test:
TypeError: create_run_config() takes at least 1 argument (23 given)

Thinking that somewhere where this function is called it is still putting something in for CPU shard and getting too many arguments. Python 3.5 thinks you deleted model_name and that is what is missing, python 2.7 thinks you are missing 1 argument. (Before shard CPU line was deleted there were 24)

@agadooPineapple
Copy link

I was using the latest tensorflow and tensor2tensor version 1.12.0 I found downgrading to 1.9.0 for both I don't even have to remove line 217, I still get errors/warnings but 2/3 tests are passing now.

@william-vw
Copy link
Author

No, I didn't have to do anything else to get it to work ..

My setup:

  • g2p-seq2seq version = 6.2.2a0
  • tensorflow version = 1.12.0rc2
  • tensor2tensor version = 1.6.6

@mondhs
Copy link

mondhs commented Feb 5, 2019

Just to add some details. Hope it helps, I also received errors with 'shard_to_cpu'. After I applied fix manually I got error with 'model_name', when running test.
When I check versions:

tensor2tensor            1.12.0                           
tensorflow               1.12.0             
g2p-seq2seq              6.2.2a0  

So I downgraded tensor2tensor to 1.6.6 and now tests are passing.

Update 1: Running G2P is working, but training with custom dictionary not. It is showing errors:

File "/usr/local/lib/python3.6/dist-packages/g2p_seq2seq-6.2.2a0-py3.6.egg/g2p_seq2seq/g2p_problem.py", line 449, in create_data_files
    save_dic(train_dic, train_path)
  File "/usr/local/lib/python3.6/dist-packages/g2p_seq2seq-6.2.2a0-py3.6.egg/g2p_seq2seq/g2p_problem.py", line 520, in save_dic
    save_file.write(word + " " + pron + "\n")
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Update 2: My bad... My dictionary had the last line empty. I could fix the source, but changed code instead:

diff --git a/g2p_seq2seq/g2p_problem.py b/g2p_seq2seq/g2p_problem.py
index 7943bdb..2bb14bc 100644
--- a/g2p_seq2seq/g2p_problem.py
+++ b/g2p_seq2seq/g2p_problem.py
@@ -516,5 +516,7 @@ def split_graphemes_phonemes(input_line, cleanup=False, p2g_mode=False):
 def save_dic(dic, save_path):
   with tf.gfile.GFile(save_path, mode="w") as save_file:
     for word, pronunciations in dic.items():
+      if(not word):
+          continue
       for pron in pronunciations:
         save_file.write(word + " " + pron + "\n")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants