Skip to content

Commit

Permalink
fix modular for logger
Browse files Browse the repository at this point in the history
  • Loading branch information
zucchini-nlp committed Oct 29, 2024
1 parent b53833b commit a8dac97
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions utils/modular_model_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
# value from the dependency is used, then mapped to current name convention, resulting in wrong value.
# The corresponding mapped value is used to define the file target for the assignment
ASSIGNMENTS_TO_KEEP = {
"_CHECKPOINT_FOR_DOC": "modeling",
"logger": ["configuration", "modeling"],
"_CHECKPOINT_FOR_DOC": ["modeling"],
}

AUTO_GENERATED_MESSAGE = """# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
Expand Down Expand Up @@ -842,11 +843,12 @@ def leave_SimpleStatementLine(self, original_node, updated_node):
return updated_node
elif m.matches(original_node, m.SimpleStatementLine(body=[m.Assign()])):
if original_node.body[0].targets[0].target.value in ASSIGNMENTS_TO_KEEP.keys():
file_ = ASSIGNMENTS_TO_KEEP[original_node.body[0].targets[0].target.value]
self.files[file_][original_node.body[0].targets[0].target.value] = {
"node": original_node,
"insert_idx": self.global_scope_index,
}
files = ASSIGNMENTS_TO_KEEP[original_node.body[0].targets[0].target.value]
for file_ in files:
self.files[file_][original_node.body[0].targets[0].target.value] = {
"node": original_node,
"insert_idx": self.global_scope_index,
}
self.global_scope_index += 100
return updated_node

Expand Down

0 comments on commit a8dac97

Please sign in to comment.