Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add argument for extra EOS token to llm-tool #217

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DePasqualeOrg
Copy link
Contributor

I added an argument for the extra EOS token to match the Python implementation and also improved the console output during loading.

Maybe we should rethink how llm-tool is implemented, since this solution is a bit unwieldy.

if let extraToken = extraEosToken {
// Create a new configuration with the extra EOS token
var extraTokens = context.configuration.extraEOSTokens
extraTokens.insert(extraToken)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if we just made the properties on ModelConfiguration var? There isn't a particular need for them to be let (I just tend to make things let unless I know of a need to mutate). Then we can let the owner of the structure decide if it is immutable or not:

    /// Additional tokens to use for end of string
    public let extraEOSTokens: Set<String>

This code would just be a couple of lines then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Intuitively I feel like a model configuration shouldn't need to be changed. It should be static for each model. Maybe we need to rethink how the configurations are generated? Unfortunately I don't have time to delve into this at the moment, but I wanted to mention it, since my solution here isn't very elegant.

Copy link
Collaborator

@davidkoski davidkoski Feb 27, 2025

Choose a reason for hiding this comment

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

This isn't changing the registry (it can't change it since they are value types), it is simply overlaying the local extra tokens on the "copy" we are going to use.

By making the properties var (ModelConfiguration and ModelContext) it would turn this code into roughly:

var context = context
if let extraEosToken {
    context.configuration.extraEOSTokens.insert(extraEosToken)
}

I think that would be very clean at expressing what we are trying to do (and is a good use of value types).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, your call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@davidkoski, you can go ahead and change ModelConfiguration in this PR or in a separate PR, whichever you prefer.

Copy link
Collaborator

Choose a reason for hiding this comment

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

pushed commit -- I think that captures what you were doing and is a bit simpler in implementation now that it is mutable

look good?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's definitely more concise. Thank you!

- update context/configuration with extra EOS tokens
Copy link
Collaborator

@davidkoski davidkoski left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the addition!

@davidkoski
Copy link
Collaborator

I think we are ready to merge unless you want to add anything.

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