Skip to content

Phi3Model support phi4 and phi4-mini #7441

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

Open
williamlzw opened this issue Apr 9, 2025 · 6 comments
Open

Phi3Model support phi4 and phi4-mini #7441

williamlzw opened this issue Apr 9, 2025 · 6 comments
Assignees
Labels
enhancement New feature or request untriaged New issue has not been triaged

Comments

@williamlzw
Copy link

Phi3Model support phi4 and phi4-mini
https://github.com/dotnet/machinelearning/blob/main/src/Microsoft.ML.GenAI.Phi/Module/Phi3Model.cs

@williamlzw williamlzw added the enhancement New feature or request label Apr 9, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged label Apr 9, 2025
@LittleLittleCloud
Copy link
Contributor

@williamlzw Looks like there is no model architecture change from phi3 to phi4, maybe you can just swap the phi4 model weight into Phi3Model?

@williamlzw
Copy link
Author

difference:
1.Phi3Attention
2.Tokenizer : gpt-4o
3.RotaryEmbedding

I ported the phi4 model, but the decoding error and the cause was not found.

Image

@williamlzw
Copy link
Author

Image

@williamlzw
Copy link
Author

Image

@LittleLittleCloud
Copy link
Contributor

@williamlzw If you can publish phi4 codebase somewhere I can take a look

@williamlzw
Copy link
Author

The above Tokenizer is the same as python, and the other differences are in the forward method of the model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

2 participants