guidance icon indicating copy to clipboard operation
guidance copied to clipboard

Handle invalid utf-8 bytes in engine class instead of model class

Open JC1DA opened this issue 10 months ago • 4 comments
trafficstars

This PR removes unnecessary invalid utf-8 bytes handling code in Model class as we can better handle it in Engine class.

JC1DA avatar Jan 09 '25 03:01 JC1DA

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

:x: Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 60.27%. Comparing base (aaa5f00) to head (190b3aa). :warning: Report is 200 commits behind head on main.

Files with missing lines Patch % Lines
guidance/models/_model.py 84.61% 2 Missing :warning:
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1094       +/-   ##
===========================================
+ Coverage   49.79%   60.27%   +10.47%     
===========================================
  Files          71       71               
  Lines        5880     5875        -5     
===========================================
+ Hits         2928     3541      +613     
+ Misses       2952     2334      -618     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar Jan 09 '25 03:01 codecov-commenter

@hudson-ai can you help check this PR?

JC1DA avatar Jan 15 '25 22:01 JC1DA

Seems reasonable to me, but I'm not sure I have a strong opinion on whether this should be done in the engine vs in the model. Can you help me understand why you like this approach more?

hudson-ai avatar Jan 16 '25 02:01 hudson-ai

Seems reasonable to me, but I'm not sure I have a strong opinion on whether this should be done in the engine vs in the model. Can you help me understand why you like this approach more?

First, I think it does not make sense for the engine to generate bytes that the model could not even use, and have to do post-processing on the result. Second, we need to process delayed_bytes in the engine right now anyway, so why not keeping it there :)

JC1DA avatar Jan 16 '25 06:01 JC1DA