Skip to content

Conversation

@jbedichekTT
Copy link
Contributor

Problem description

When running pytest tests/models/bert/test_bert.py --export_code profliling
And then tracy python -m tracy -r -v -p -o BERT tests/export_code/profiling/BERT_code.py

The formatting of the generated code has an issue with function arguments which are strings. In the BERT case, this translates to passing ttnn.linear(. . . , activation = gelu) when the correct syntax is: ttnn.linear(. . . , activation = "gelu"), with the argument being expressed as a string.

This throws an error when tracy is called on the generated code.

What's changed

Added explicit string handling in the formatting function _format_dict(obj), checking if the attribute is a string, and making sure quotes are written to the file if it is.

@jbedichekTT jbedichekTT requested a review from kevinwuTT May 30, 2025 20:36
@jbedichekTT jbedichekTT changed the title String formatting fix in export code String formatting fix in export code profiling generation May 30, 2025
@jbedichekTT jbedichekTT changed the title String formatting fix in export code profiling generation String formatting fix in export code profiling code generation May 30, 2025
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

Successfully merging this pull request may close these issues.

2 participants