Skip to content

Sparknlp 1189 Introducing Phi4 #14606

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

prabod
Copy link
Contributor

@prabod prabod commented Jun 17, 2025

Description

This PR introduces Phi4 model into SparkNLP

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Code improvements with no or little impact
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING page.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

prabod added 4 commits June 13, 2025 02:47
- Introduced `Phi4` class for the state-of-the-art Phi-4 model by Microsoft Research, including methods for encoding, decoding, and tagging.
- Added `Phi4Transformer` for integration with Spark NLP, enabling pretrained model loading and configuration.
- Implemented `Phi4Tokenizer` for byte pair encoding specific to the Phi-4 model.
- Updated `BpeTokenizer` to support the new Phi-4 tokenizer.
- Added tests for `Phi4Transformer` to ensure functionality and performance.
- Updated resource downloader to include `Phi4Transformer` for pretrained model access.
- Expanded the model description to include detailed information on parameters, intended use, benchmarks, safety, limitations, and usage instructions.
- Improved formatting for better readability and clarity.
- Added references for further information on the Phi-4 model.
- Introduced `Phi4Transformer` class for the state-of-the-art Phi-4 model by Microsoft Research, enabling advanced reasoning and NLP tasks.
- Added support for loading pretrained models and configuration parameters.
- Implemented a loader for the Phi-4 model in the internal module.
- Created unit tests to validate the functionality of the `Phi4Transformer`.
- Updated the main `__init__.py` to include the new transformer in the module exports.
- Created a detailed markdown file for the `Phi4Transformer`, outlining its features, usage, and pretrained model loading instructions.
- Added a Jupyter notebook demonstrating the integration of the Phi-4 model with Spark NLP and Intel OpenVINO, including installation steps and example code.
- Enhanced the Scala implementation comments for better clarity and formatting.
- Updated the test specifications to reflect changes in the handling of temperature settings during predictions.
@prabod prabod self-assigned this Jun 17, 2025
@DevinTDHa DevinTDHa marked this pull request as draft June 23, 2025 10:01
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.

1 participant