tiny-llm icon indicating copy to clipboard operation
tiny-llm copied to clipboard

fix: f-string syntax fix for old python env

Open chasingegg opened this issue 2 months ago • 0 comments

When I run pdm run test-refsol -- -- -k week_1

src/tiny_llm_ref/__init__.py:7: in <module>
    from .generate import *
E     File "/Users/gao/develop/tiny-llm/src/tiny_llm_ref/generate.py", line 134
E       print(f"+{progress} {text.replace('\n', ' ')[-80:]}")
E                                                           ^
E   SyntaxError: f-string expression part cannot include a backslash

For python3.11, python f-strings cannot contain backslashes inside the expression part (the {} section). This PR fixes the issue in src/tiny_llm_ref/generate.py:134 by extracting '\n' to a variable first.

chasingegg avatar Nov 09 '25 14:11 chasingegg