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 local agent #23438

Merged
merged 2 commits into from May 18, 2023
Merged

Add local agent #23438

merged 2 commits into from May 18, 2023

Conversation

sgugger
Copy link
Collaborator

@sgugger sgugger commented May 17, 2023

What does this PR do?

This PR adds support for a local agent running the model to generate code on the user's machine.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented May 17, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Looks great to me! cc @gante for the criteria :)

Comment on lines +561 to +562
model = AutoModelForCausalLM.from_pretrained(pretrained_model_name_or_path, **kwargs)
tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

Nice shortcut!

return result


class StopSequenceCriteria(StoppingCriteria):
Copy link
Member

Choose a reason for hiding this comment

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

Can we:

  1. move it to the stopping criteria file? (I've seen a user asking for this)
  2. generalize it for the batched input case? (or add a todo, I'd be happy to expand it :D )

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe you can move it as you add support for the batched case? I don't need it for the agents and it's not an obvious thing to do (that's the reason I didn't put this in the stopping criteria file by the way).

Copy link
Member

Choose a reason for hiding this comment

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

Sure, I can take care of it afterwards 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks!

@sgugger sgugger merged commit cf43200 into main May 18, 2023
15 of 22 checks passed
@sgugger sgugger deleted the local_agent branch May 18, 2023 15:09
sheonhan pushed a commit to sheonhan/transformers that referenced this pull request Jun 1, 2023
* Add local agent

* Document LocalAgent
gojiteji pushed a commit to gojiteji/transformers that referenced this pull request Jun 5, 2023
* Add local agent

* Document LocalAgent
novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
* Add local agent

* Document LocalAgent
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.

None yet

4 participants