I have difficulties in finding the bug in exercise 7. Can you please help and give me a hint? @Mubsi?
exercise 6 (next_symbol) passes without error
LabID = arlaqnqg
The grader says: There was a problem grading your submission. Check stderr for more details.
The tests fail without comment and the example fails with:
ende_32k.subword
data/
TypeError Traceback (most recent call last)
in
3 print (VOCAB_FILE)
4 print(VOCAB_DIR)
----> 5 sampling_decode(“I love languages.”, NMTAttn=model, temperature=0.1, vocab_file=VOCAB_FILE, vocab_dir=VOCAB_DIR)
in sampling_decode(input_sentence, NMTAttn, temperature, vocab_file, vocab_dir, next_symbol, tokenize, detokenize)
47 #print(cur_output_tokens)
48 #print(log_prob)
—> 49 sentence = detokenize(cur_output_tokens)
50
51
in detokenize(integers, vocab_file, vocab_dir)
52 integers = integers[:integers.index(EOS)]
53
—> 54 return trax.data.detokenize(integers, vocab_file=vocab_file, vocab_dir=vocab_dir)
/opt/conda/lib/python3.7/site-packages/trax/data/tf_inputs.py in detokenize(x, vocab_type, vocab_file, vocab_dir, n_reserved_ids)
485 A string corresponding to the de-tokenized version of x.
486 “”"
→ 487 vocab = _get_vocab(vocab_type, vocab_file, vocab_dir)
488 x_unreserved = np.array(x) - n_reserved_ids
489 return str(vocab.decode(x_unreserved.tolist()))
/opt/conda/lib/python3.7/site-packages/trax/data/tf_inputs.py in _get_vocab(vocab_type, vocab_file, vocab_dir, extra_ids)
578
579 vocab_dir = vocab_dir or ‘gs://trax-ml/vocabs/’
→ 580 path = os.path.join(vocab_dir, vocab_file)
581
582 if vocab_type == ‘subword’:
/opt/conda/lib/python3.7/posixpath.py in join(a, *p)
92 path += sep + b
93 except (TypeError, AttributeError, BytesWarning):
—> 94 genericpath._check_arg_types(‘join’, a, *p)
95 raise
96 return path
/opt/conda/lib/python3.7/genericpath.py in _check_arg_types(funcname, *args)
151 else:
152 raise TypeError(’%s() argument must be str or bytes, not r'
→ 153 (funcname, s.class.name)) from None
154 if hasstr and hasbytes:
155 raise TypeError(“Can’t mix strings and bytes in path components”) from None
TypeError: join() argument must be str or bytes, not ‘NoneType’