Skip to content

General MTMD Improvements & Cleanup#1351

Merged
martindevans merged 2 commits intoSciSharp:masterfrom
martindevans:cleanup_mtmd
Mar 8, 2026
Merged

General MTMD Improvements & Cleanup#1351
martindevans merged 2 commits intoSciSharp:masterfrom
martindevans:cleanup_mtmd

Conversation

@martindevans
Copy link
Member

  • Moved CountPositions/CountTokens to be instance methods on SafeMtmdInputChunks
  • Better exceptions in LoadFromFile/LoadFromFileAsync (checking for file readability etc)
  • Using safe handles instead of raw pointers in many places. In turn removed lots of uses of DangerousGetHandle()
  • Accepting spans instead of arrays in FromRgbBytes/FromAudioSamples
  • Added more doc comments on mtmd methods

 - Moved `CountPositions`/`CountTokens` to be instance methods on `SafeMtmdInputChunks`
 - Better exceptions in `LoadFromFile`/`LoadFromFileAsync` (checking for file readability etc)
 - Using safe handles instead of raw pointers in many places. In turn removed lots of uses of `DangerousGetHandle()`
 - Accepting spans instead of arrays in `FromRgbBytes`/`FromAudioSamples`
 - Added more doc comments on mtmd methods
@martindevans martindevans requested a review from SignalRT March 4, 2026 21:48
@aropb
Copy link

aropb commented Mar 6, 2026

Please consider these suggestions. Currently, the architecture of working with embeds is not done correctly.

Embed - It has nothing to do with the model, but just a resource for executor's.

#1337

@martindevans
Copy link
Member Author

I did notice the way embeds is handled is a bit weird, but changing that is too much for a cleanup/refactoring PR like this. I'll probably come back to look at that in the future, but I'll have to coordinate with @SignalRT about that.

Copy link
Collaborator

@SignalRT SignalRT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my main doubt about this set of changes

@martindevans
Copy link
Member Author

@SignalRT Anything else you wanted to address, or is this ready to merge?

@SignalRT
Copy link
Collaborator

SignalRT commented Mar 8, 2026

@SignalRT Anything else you wanted to address, or is this ready to merge?

From my point of view is ready to merge.

@martindevans martindevans merged commit bcc4bc1 into SciSharp:master Mar 8, 2026
10 checks passed
@martindevans martindevans deleted the cleanup_mtmd branch March 8, 2026 23:34
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.

3 participants