Skip to content

evaluate_with_lexicon #11

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

Open
DYF-AI opened this issue Aug 25, 2020 · 2 comments
Open

evaluate_with_lexicon #11

DYF-AI opened this issue Aug 25, 2020 · 2 comments

Comments

@DYF-AI
Copy link

DYF-AI commented Aug 25, 2020

I changed evaluate_with_lexicon:False to True from config.py, the following question “UnboundLocalError: local variable 'embeds_' referenced before assignment" appeared,
evaluators.py
`class Evaluator(BaseEvaluator):
def parse_data(self, inputs):
input_dict = {}
if global_args.evaluate_with_lexicon:
imgs, label_encs, lengths, file_name = inputs
else:
# imgs, label_encs, lengths = inputs
imgs, label_encs, lengths, embeds
= inputs

    with torch.no_grad():
        images = imgs.to(self.device)
        if label_encs is not None:
            labels = label_encs.to(self.device)
        if embeds_ is not None:
            embeds = embeds_.to(self.device)
    input_dict['images'] = images
    input_dict['rec_targets'] = labels
    input_dict['rec_lengths'] = lengths
    input_dict['rec_embeds'] = embeds
    if global_args.evaluate_with_lexicon:
        input_dict['file_name'] = file_name
    return input_dict`

Obviously, file_name and embeds_ cannot exist at the same time, how to solve this problem? Thank you![](url)

@Pay20Y
Copy link
Owner

Pay20Y commented Aug 31, 2020

I'm sorry, I haven't implemented this part of code yet. I just use another post-processing script to replace the predicted results with the words in the lexicons.

@DYF-AI
Copy link
Author

DYF-AI commented Aug 31, 2020

okay, thank you for your outstanding work

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

No branches or pull requests

2 participants