-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
- Loading branch information
1 parent
8500e7f
commit 04f5ef6
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
intel_extension_for_transformers/neural_chat/tests/nightly/models/test_phi2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (c) 2023 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from intel_extension_for_transformers.neural_chat import build_chatbot, PipelineConfig | ||
import unittest | ||
|
||
class TestPhi2Model(unittest.TestCase): | ||
def setUp(self): | ||
return super().setUp() | ||
|
||
def tearDown(self) -> None: | ||
return super().tearDown() | ||
|
||
def test_code_gen(self): | ||
config = PipelineConfig( | ||
model_name_or_path="microsoft/phi-2") | ||
chatbot = build_chatbot(config=config) | ||
result = chatbot.predict("Calculate 99+22=") | ||
print(result) | ||
self.assertIn("The answer is 121", str(result)) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |