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 Mistral support 💨 #54

Merged
merged 9 commits into from
Jun 17, 2024
Merged

Add Mistral support 💨 #54

merged 9 commits into from
Jun 17, 2024

Conversation

tengomucho
Copy link
Collaborator

@tengomucho tengomucho commented Jun 13, 2024

What does this PR do?

Added support for inference on Mistral 7B models. Tested withMistral-7B-v0.3.

Before submitting

  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Imported from transformers sha1: a2ede6667 (current main branch).
This allows to use recent static cache support.
The only changes are:

- fixed the import paths,
- added a workaround to avoid having to import SlidingWindowCache or
having to modify the file too much.
This will allow using the same example for other models, such as mistralai/Mistral-7B-v0.3
There is no point in using code to sync multiple TPUs when using only
one.
This will prevent downloading consolidated weights uselessly, as for
the Mistral repo.
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@tengomucho tengomucho merged commit 3900bd7 into main Jun 17, 2024
3 checks passed
@tengomucho tengomucho deleted the mistral branch June 17, 2024 08:23
@Bihan
Copy link

Bihan commented Jul 11, 2024

@tengomucho I successfully ran TGI server with Mistral-7B-Instruct-v0.2 on TPU v5litepod-8. Does optimum-tpu utilize all the 8 Cores?
In the below DEBUG log it only prints for Rank 0.
2024-07-11T12:48:00.752321Z DEBUG text_generation_launcher: Rank 0 on xla:0 real device ['TPU:0'] ordinal 0 world size 8

@tengomucho
Copy link
Collaborator Author

@Bihan yes it does. I filtered only the debug messages from rank 0 to avoid spamming 😄 See here:

def debug(message: str):
if xm.get_ordinal() == 0:
logger.opt(depth=1).debug(message)

@Bihan
Copy link

Bihan commented Jul 14, 2024

@tengomucho Does this mean models with pickle files may cause issues?

@Bihan
Copy link

Bihan commented Jul 15, 2024

@tengomucho I have a question regarding the --trust-remote-code flag in the text-generation-launcher command. If this flag is ignored, does it mean that optimum-tpu TGI assumes all remote code is safe to execute? Specifically, I'm concerned about potential security implications, such as the risks associated with using pickle for deserialization.

Here is the command for reference
text-generation-launcher --port 8000 --trust-remote-code

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