Megatron-LM icon indicating copy to clipboard operation
Megatron-LM copied to clipboard

[BUG]preprocess_data.py Partition.process_json_file() use undefined var `key` in last line

Open forrestjgq opened this issue 3 years ago • 3 comments

Describe the bug

    def process_json_file(self, file_name):
       ...
        for key in self.args.json_keys:
                 ....

        for i, (doc, sentence_lens, bytes_processed) in enumerate(encoded_docs, start=1):
            for key in doc.keys():
                builders[key].add_doc(doc[key], sentence_lens[key])

        # key in this line is not defined
        builders[key].finalize(output_idx_files[key])

To Reproduce code logical issue

Expected behavior has clear definition of key

Stack trace/logs no need

Environment (please complete the following information): no need

Proposed fix should this line be:

for key in self.args.json_keys:
    builders[key].finalize(output_idx_files[key])

?

Additional context nothing

forrestjgq avatar Sep 15 '23 01:09 forrestjgq

Marking as stale. No activity in 60 days.

github-actions[bot] avatar Nov 14 '23 18:11 github-actions[bot]

@forrestjgq I have same issue.Did you find the solution?

980202006 avatar May 21 '24 10:05 980202006

Marking as stale. No activity in 60 days.

github-actions[bot] avatar Jul 20 '24 18:07 github-actions[bot]