'Attribute error while loading vocabulary wrapper

While trying to work with text to image based on this model,I get the following attribute error in train.py:

 17 
 18     # Load Vocabulary Wrapper
---> 19     vocab = deserialize_vocab(os.path.join(opt.vocab_path, '%s_vocab.json' % opt.data_name))
     20     opt.vocab_size = len(vocab)
     21 

AttributeError: 'Namespace' object has no attribute 'vocab_path'

The deserialization function in vocab.py:

def deserialize_vocab(src):
    with open(src) as f:
        d = json.load(f)
    vocab = Vocabulary()
    vocab.word2idx = d['word2idx']
    vocab.idx2word = d['idx2word']
    vocab.idx = d['idx']
    return vocab


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source