8000 Improve MLXModel call by albertvillanova · Pull Request #1067 · huggingface/smolagents · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve MLXModel call #1067

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

Merged

Conversation

albertvillanova
Copy link
Member
@albertvillanova albertvillanova commented Mar 24, 2025

Improve MLXModel call.

This PR simplifies the code by removing unnecessary variable and improving readability.

Follow-up to:

break
if found_stop_sequence:
text += response.text
if any((stop_index := text.rfind(stop)) != -1 for stop in stops):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this logic could be unified with other models like TransformersModel?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm having a look at that...

Copy link
Member Author

Choose a reason for hiding this comment

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

Transformers uses StoppingCriteria and StoppingCriteriaList classes, so it is not straightforward. But I could have a look how to adapt the logic for this case.

@albertvillanova albertvillanova merged commit 8833d90 into huggingface:main Mar 25, 2025
3 checks passed
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
0