Skip to content

Commit

Permalink
Merge pull request #74 from skytin1004/main
Browse files Browse the repository at this point in the history
Fixed all invalid URLs, Add GitHub Actions workflow to validate documentation links
  • Loading branch information
leestott authored Jul 3, 2024
2 parents 67e4e5a + e0a4e66 commit 1063f6d
Show file tree
Hide file tree
Showing 42 changed files with 664 additions and 572 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/validate-documentation-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Validate Documentation Links

on:
pull_request_target:
branches:
- main
paths:
- '**.md'
- '**.ipynb'
push:
branches:
- main

permissions:
contents: read
pull-requests: write

jobs:
check-broken-paths:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check broken Paths
uses: john0isaac/[email protected]
with:
command: check_broken_paths
directory: ./
guide-url: 'https://github.com/Phi-3-CookBook/Phi-3-CookBook/blob/main/CONTRIBUTING.md'
github-token: ${{ secrets.GITHUB_TOKEN }}

check-urls-locale:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check URLs Country Locale
uses: john0isaac/[email protected]
with:
command: check_urls_locale
directory: ./
guide-url: 'https://github.com/Phi-3-CookBook/Phi-3-CookBook/blob/main/CONTRIBUTING.md'
github-token: ${{ secrets.GITHUB_TOKEN }}

check-broken-urls:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check broken URLs
uses: john0isaac/[email protected]
with:
command: check_broken_urls
directory: ./
guide-url: 'https://github.com/Phi-3-CookBook/Phi-3-CookBook/blob/main/CONTRIBUTING.md'
github-token: ${{ secrets.GITHUB_TOKEN }}
107 changes: 107 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit [https://cla.opensource.microsoft.com](https://cla.opensource.microsoft.com)

When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

## Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information read the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## Cautions for creating issues

Please do not open GitHub issues for general support questions as the GitHub list should be used for feature requests and bug reports. This way we can more easily track actual issues or bugs from the code and keep the general discussion separate from the actual code.

## How to Contribute

### Pull Requests Guidelines

When submitting a pull request (PR) to the Phi-3 CookBook repository, please use the following guidelines:

- **Fork the Repository**: Always fork the repository to your own account before making your modifications.

- **Separate pull requests (PR)**:
- Submit each type of change in its own pull request. For example, bug fixes and documentation updates should be submitted in separate PRs.
- Typo fixes and minor documentation updates can be combined into a single PR where appropriate.

- **Handle merge conflicts**: If your pull request shows merge conflicts, update your local `main` branch to mirror the main repository before making your modifications.

- **Translation submissions**: When submitting a translation PR, ensure that the translation folder includes translations for all files in the original folder.

### Translation Guidelines

> **Important**
>
> When translating text in this repository, do not use machine translation. Only volunteer for translations in languages where you are proficient.
If you are proficient in a non-English language, you can help translate the content. Follow these steps to ensure your translation contributions are properly integrated, please use the following guidelines:

- **Create translation folder**: Navigate to the appropriate section folder and create a translation folder for the language you are contributing to. For example:
- For the introduction section: `Phi-3CookBook/md/01.Introduce/translations/<language_code>/`
- For the quick start section: `Phi-3CookBook/md/02.QuickStart/translations/<language_code>/`
- Continue this pattern for other sections (03.Inference, 04.Finetuning, etc.)

- **Update relative paths**: When translating, adjust the folder structure by adding `../../` to the beginning of relative paths within the markdown files to ensure links work correctly. For example, change as following:
- Change `(../../imgs/01/phi3aisafety.png)` to `(../../../../imgs/01/phi3aisafety.png)`

- **Organize your translations**: Each translated file should be placed in the corresponding section's translation folder. For example, if you are translating the introduction section into Spanish, you would create as following:
- `Phi-3CookBook/md/01.Introduce/translations/es/`

- **Submit a complete PR**: Ensure all translated files for a section are included in one PR. We do not accept partial translations for a section. When submitting a translation PR, make sure that the translation folder includes translations for all files in the original folder.

### Writing Guidelines

To ensure consistency across all documents, please use the following guidelines:

- **URL formatting**: Wrap all URLs in square brackets followed by parentheses, without any extra spaces around or inside them. For example: `[example](https://example.com)`.

- **Relative links**: Use `./` for relative links pointing to files or folders in the current directory, and `../` for those in a parent directory. For example: `[example](./path/to/file)` or `[example](../path/to/file)`.

- **Not Country-Specific locales**: Ensure that your links do not include country-specific locales. For example, avoid `/en-us/` or `/en/`.

- **Image storage**: Store all images in the `./imgs` folder.

- **Descriptive image names**: Name images descriptively using English characters, numbers, and dashes. For example: `example-image.jpg`.

## GitHub Workflows

When you submit a pull request, the following workflows will be triggered to validate the changes. Follow the instructions below to ensure your pull request passes the workflow checks:

- [Check Broken Relative Paths](#check-broken-relative-paths)
- [Check URLs Don't Have Locale](#check-urls-dont-have-locale)

### Check Broken Relative Paths

This workflow ensures that all relative paths in your files are correct.

1. To make sure your links are working properly, perform the following tasks using VS Code:
- Hover over any link in your files.
- Press **Ctrl + Click** to navigate to the link.
- If you click on a link and it doesn't work locally, it will trigger the workflow and not work on GitHub.

1. To fix this issue, perform the following tasks using the path suggestions provided by VS Code:
- Type `./` or `../`.
- VS Code will prompt you to choose from the available options based on what you typed.
- Follow the path by clicking on the desired file or folder to ensure your path is correct.

Once you have added the correct relative path, save and push your changes.

### Check URLs Don't Have Locale

This workflow ensures that any web URL doesn't include a country-specific locale. As this repository is accessible globally, it is important to ensure that URLs do not contain your country's locale.

1. To verify that your URLs don't have country locales, perform the following tasks:

- Check for text like `/en-us/`, `/en/`, or any other language locale in the URLs.
- If these are not present in your URLs, then you will pass this check.

1. To fix this issue, perform the following tasks:
- Open the file path highlighted by the workflow.
- Remove the country locale from the URLs.

Once you remove the country locale, save and push your changes.
28 changes: 6 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ This cookbook includes:

- [Fine-tuning Phi-3]()
- [Downloading & Creating Sample Data Set](./md/04.Fine-tuning/CreatingSampleData.md)(✅)
- [Fine-tuning Scenarios](./md/04.Fine-tuning/FineTuning%20Scenarios.md)(✅)
- [Fine-tuning vs RAG](./md/04.Fine-tuning/FineTuning%20vs%20RAG.md)(✅)
- [Fine-tuning Scenarios](./md/04.Fine-tuning/FineTuning_Scenarios.md)(✅)
- [Fine-tuning vs RAG](./md/04.Fine-tuning/FineTuning_vs_RAG.md)(✅)
- [Fine-tuning Let Phi-3 become an industry expert](./md/04.Fine-tuning/LetPhi3gotoIndustriy.md)(✅)
- [Fine-tuning Phi-3 with AI Toolkit for VS Code](./md/04.Fine-tuning/Finetuning_VSCodeaitoolkit.md)(✅)
- [Fine-tuning Phi-3 with Azure Machine Learning Service](./md/04.Fine-tuning/Introduce_AzureML.md)(✅)
Expand All @@ -124,7 +124,7 @@ This cookbook includes:
- [Prepare your industry data](./md/06.E2ESamples/E2E_Datasets.md)(✅)
- [Use Microsoft Olive to architect your projects](./md/06.E2ESamples/E2E_LoRA&QLoRA_Config_With_Olive.md)(✅)
- [Inference Your Fine-tuning ONNX Runtime Model](./md/06.E2ESamples/E2E_Inference_ORT.md)(✅)
- [Multi Model - Interactive Phi-3-mini and OpenAI Whisper](./md/06.E2ESamples/E2E_Phi-3-mini%20with%20whisper.md)(✅)
- [Multi Model - Interactive Phi-3-mini and OpenAI Whisper](./md/06.E2ESamples/E2E_Phi-3-mini_with_whisper.md)(✅)
- [MLFlow - Building a wrapper and using Phi-3 with MLFlow](./md/06.E2ESamples/E2E_Phi-3-MLflow.md)(✅)
- [WinUI3 App with Phi-3 mini-4k-instruct-onnx](https://github.com/microsoft/Phi3-Chat-WinUI3-Sample/)(✅)
- [WinUI3 Multi Model AI Powered Notes App Sample](https://github.com/microsoft/ai-powered-notes-winui3-sample)(✅)
Expand All @@ -133,7 +133,7 @@ This cookbook includes:
- [E2E Samples for Phi-3-vision]()
- [Phi-3-vision-Image text to text](./md/06.E2ESamples/E2E_Phi-3-vision-image-text-to-text-online-endpoint.ipynb)(✅)
- [Phi-3-vision-ONNX](https://onnxruntime.ai/docs/genai/tutorials/phi3-v.html)(✅)
- [Phi-3-vision CLIP Embedding](./md/06.E2ESamples/E2E_Phi-3-%20Embedding%20Images%20with%20CLIPVision.md)(✅)
- [Phi-3-vision CLIP Embedding](./md/06.E2ESamples/E2E_Phi-3-Embedding_Images_with_CLIPVision.md)(✅)

- [Labs and workshops samples Phi-3]()
- [C# .NET Labs](./md/07.Labs/Csharp/csharplabs.md)(✅)
Expand All @@ -145,26 +145,10 @@ This cookbook includes:
- [C# Hello Phi-3 ONNX example Phi-3](https://github.com/microsoft/onnxruntime-genai/tree/main/examples/csharp/HelloPhi)(✅)
- [C# API Phi-3 ONNX example to support Phi3-Vision](https://github.com/microsoft/onnxruntime-genai/tree/main/examples/csharp/HelloPhi3V)(✅)
- [Run C# Phi-3 samples in a CodeSpace](./md/07.Labs/CsharpOllamaCodeSpaces/CsharpOllamaCodeSpaces.md)(✅)
- [Using Phi-3 with Promptflow and Azure AI Search](./code/07.Lab/RAG%20with%20PromptFlow%20and%20AISearch/README.md)(✅)

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
- [Using Phi-3 with Promptflow and Azure AI Search](./code/07.Lab/RAG_with_PromptFlow_and_AISearch/README.md)(✅)

## Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.
25 changes: 0 additions & 25 deletions SUPPORT.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Before you begin, ensure you have met the following requirements:
## Installation

1. Create a new flow on your Azure AI Studio Project using the flow.yaml file.
2. Deploy a Phi3 Model from your Azure AI model catalog and create the connection to your project. [Deploy Phi-3 as a Model as a Service](https://learn.microsoft.com/en-us/azure/machine-learning/how-to-deploy-models-phi-3?view=azureml-api-2&tabs=phi-3-mini)
3. Create the vector index on Azure AI Search using any document of your choice [Create a vector index on Azure AI Search](https://learn.microsoft.com/en-us/azure/search/search-how-to-create-search-index?tabs=portal)
4. Deploy the flow on a managed enpoint and use it in the prompt-flow-frontend.py file. [Deploy a flow on an online endpoint](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/flow-deploy)
2. Deploy a Phi3 Model from your Azure AI model catalog and create the connection to your project. [Deploy Phi-3 as a Model as a Service](https://learn.microsoft.com/azure/machine-learning/how-to-deploy-models-phi-3?view=azureml-api-2&tabs=phi-3-mini)
3. Create the vector index on Azure AI Search using any document of your choice [Create a vector index on Azure AI Search](https://learn.microsoft.com/azure/search/search-how-to-create-search-index?tabs=portal)
4. Deploy the flow on a managed enpoint and use it in the prompt-flow-frontend.py file. [Deploy a flow on an online endpoint](https://learn.microsoft.com/azure/ai-studio/how-to/flow-deploy)
5. Clone the repository:

```sh
Expand Down
2 changes: 1 addition & 1 deletion md/03.Inference/translations/zh-tw/AIPC_Inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pip install .\onnxruntime_genai_directml-0.3.0.dev0-cp310-cp310-win_amd64.whl

![DML](../../../../imgs/03/AIPC/aipc_DML.png)

***範例*** : [AIPC_DirectML_DEMO.ipynb](../../code/03.Inference/AIPC/AIPC_DirectML_DEMO.ipynb)
***範例*** : [AIPC_DirectML_DEMO.ipynb](../../../../code/03.Inference/AIPC/AIPC_DirectML_DEMO.ipynb)

## **3. 使用 Intel OpenVino 執行 Phi-3 模型**

Expand Down
2 changes: 1 addition & 1 deletion md/04.Fine-tuning/FineTuning_MLSDK.md
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ endpoint = ManagedOnlineEndpoint(
# Then wait for the creation operation to complete by calling the wait method
workspace_ml_client.begin_create_or_update(endpoint).wait()
```
You can find here the list of SKU's supported for deployment - [Managed online endpoints SKU list](https://learn.microsoft.com/en-us/azure/machine-learning/reference-managed-online-endpoints-vm-sku-list)
You can find here the list of SKU's supported for deployment - [Managed online endpoints SKU list](https://learn.microsoft.com/azure/machine-learning/reference-managed-online-endpoints-vm-sku-list)

### Deploying ML Model

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
## Fine Tuning Scenarios

| | | | | | | |
|-|-|-|-|-|-|-|
|Scenario|LoRA|QLoRA|PEFT|DeepSpeed|ZeRO|DORA|
|Adapting pre-trained LLMs to specific tasks or domains|Yes|Yes|Yes|Yes|Yes|Yes|
|Fine-tuning for NLP tasks such as text classification, named entity recognition, and machine translation|Yes|Yes|Yes|Yes|Yes|Yes|
|Fine-tuning for QA tasks|Yes|Yes|Yes|Yes|Yes|Yes|
|Fine-tuning for generating human-like responses in chatbots|Yes|Yes|Yes|Yes|Yes|Yes|
|Fine-tuning for generating music, art, or other forms of creativity|Yes|Yes|Yes|Yes|Yes|Yes|
|Reducing computational and financial costs|Yes|Yes|No|Yes|Yes|No|
|Reducing memory usage|No|Yes|No|Yes|Yes|Yes|
|Using fewer parameters for efficient finetuning|No|Yes|Yes|No|No|Yes|
|Memory-efficient form of data parallelism that gives access to the aggregate GPU memory of all the GPU devices available|No|No|No|Yes|Yes|Yes|

## Fine Tuning Performance Examples

## Fine Tuning Scenarios

| | | | | | | |
|-|-|-|-|-|-|-|
|Scenario|LoRA|QLoRA|PEFT|DeepSpeed|ZeRO|DORA|
|Adapting pre-trained LLMs to specific tasks or domains|Yes|Yes|Yes|Yes|Yes|Yes|
|Fine-tuning for NLP tasks such as text classification, named entity recognition, and machine translation|Yes|Yes|Yes|Yes|Yes|Yes|
|Fine-tuning for QA tasks|Yes|Yes|Yes|Yes|Yes|Yes|
|Fine-tuning for generating human-like responses in chatbots|Yes|Yes|Yes|Yes|Yes|Yes|
|Fine-tuning for generating music, art, or other forms of creativity|Yes|Yes|Yes|Yes|Yes|Yes|
|Reducing computational and financial costs|Yes|Yes|No|Yes|Yes|No|
|Reducing memory usage|No|Yes|No|Yes|Yes|Yes|
|Using fewer parameters for efficient finetuning|No|Yes|Yes|No|No|Yes|
|Memory-efficient form of data parallelism that gives access to the aggregate GPU memory of all the GPU devices available|No|No|No|Yes|Yes|Yes|

## Fine Tuning Performance Examples

![Finetuning Performance](../../imgs/04/00/Finetuningexamples.png)
Loading

0 comments on commit 1063f6d

Please sign in to comment.