Skip to content

NameError: name 'torchtext' is not defined #4

Description

@vamsi8106

Title: NameError: name 'torchtext' is not defined when using BowVAEInferencer

Description:
When trying to encode texts using BowVAEInferencer and saving/reloading the inferencer, the code throws a NameError related to torchtext. It seems that torchtext is used internally but is not imported or listed as a dependency.

Reproduction Steps:

from tmnt.inference import BowVAEInferencer

# Initialize inferencer
inferencer = BowVAEInferencer(estimator, pre_vectorizer=tf_vectorizer)

# Encode some texts
encodings = inferencer.encode_texts([
    'Greater Armenia would stretch from Karabakh, to the Black Sea, to the Mediterranean, so if you use the term Greater Armenia use it with care.',
    'I have two pairs of headphones I\'d like to sell. These are excellent, and both in great condition'
])

# Save the inferencer
inferencer.save(model_dir='_model_dir')

# Reload the inferencer
reloaded_inferencer = BowVAEInferencer.from_saved(model_dir='_model_dir')

Error Traceback:

NameError: name 'torchtext' is not defined

Environment:

  • Python version: 3.10
  • TMNT version: 0.7.62b20251015

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions