Home
Softono
M

Microsoft

Professional software vendor delivering innovative solutions on the Softono platform. Specialized in both open-source and proprietary software development.

Total Products
55

Software by Microsoft

markitdown
Open Source

markitdown

# MarkItDown [![PyPI](https://img.shields.io/pypi/v/markitdown.svg)](https://pypi.org/project/markitdown/) ![PyPI - Downloads](https://img.shields.io/pypi/dd/markitdown) [![Built by AutoGen Team](https://img.shields.io/badge/Built%20by-AutoGen%20Team-blue)](https://github.com/microsoft/autogen) > [!IMPORTANT] > MarkItDown performs I/O with the privileges of the current process. Like open() or requests.get(), it will access resources that the process itself can access. Sanitize your inputs in untrusted environments, and call the narrowest `convert_*` function needed for your use case (e.g., `convert_stream()`, or `convert_local()`). See the [Security Considerations](#security-considerations) section of the documentation for more information. MarkItDown is a lightweight Python utility for converting various files to Markdown for use with LLMs and related text analysis pipelines. To this end, it is most comparable to [textract](https://github.com/deanmalmgren/textract), but with a focus on preserving important document structure and content as Markdown (including: headings, lists, tables, links, etc.) While the output is often reasonably presentable and human-friendly, it is meant to be consumed by text analysis tools -- and may not be the best option for high-fidelity document conversions for human consumption. MarkItDown currently supports the conversion from: - PDF - PowerPoint - Word - Excel - Images (EXIF metadata and OCR) - Audio (EXIF metadata and speech transcription) - HTML - Text-based formats (CSV, JSON, XML) - ZIP files (iterates over contents) - Youtube URLs - EPubs - ... and more! ## Why Markdown? Markdown is extremely close to plain text, with minimal markup or formatting, but still provides a way to represent important document structure. Mainstream LLMs, such as OpenAI's GPT-4o, natively "_speak_" Markdown, and often incorporate Markdown into their responses unprompted. This suggests that they have been trained on vast amounts of Markdown-formatted text, and understand it well. As a side benefit, Markdown conventions are also highly token-efficient. ## Prerequisites MarkItDown requires Python 3.10 or higher. It is recommended to use a virtual environment to avoid dependency conflicts. With the standard Python installation, you can create and activate a virtual environment using the following commands: ```bash python -m venv .venv source .venv/bin/activate ``` If using `uv`, you can create a virtual environment with: ```bash uv venv --python=3.12 .venv source .venv/bin/activate # NOTE: Be sure to use 'uv pip install' rather than just 'pip install' to install packages in this virtual environment ``` If you are using Anaconda, you can create a virtual environment with: ```bash conda create -n markitdown python=3.12 conda activate markitdown ``` ## Installation To install MarkItDown, use pip: `pip install 'markitdown[all]'`. Alternatively, you can install it from the source: ```bash git clone [email protected]:microsoft/markitdown.git cd markitdown pip install -e 'packages/markitdown[all]' ``` ## Usage ### Command-Line ```bash markitdown path-to-file.pdf > document.md ``` Or use `-o` to specify the output file: ```bash markitdown path-to-file.pdf -o document.md ``` You can also pipe content: ```bash cat path-to-file.pdf | markitdown ``` ### Optional Dependencies MarkItDown has optional dependencies for activating various file formats. Earlier in this document, we installed all optional dependencies with the `[all]` option. However, you can also install them individually for more control. For example: ```bash pip install 'markitdown[pdf, docx, pptx]' ``` will install only the dependencies for PDF, DOCX, and PPTX files. At the moment, the following optional dependencies are available: * `[all]` Installs all optional dependencies * `[pptx]` Installs dependencies for PowerPoint files * `[docx]` Installs dependencies for Word files * `[xlsx]` Installs dependencies for Excel files * `[xls]` Installs dependencies for older Excel files * `[pdf]` Installs dependencies for PDF files * `[outlook]` Installs dependencies for Outlook messages * `[az-doc-intel]` Installs dependencies for Azure Document Intelligence * `[az-content-understanding]` Installs dependencies for Azure Content Understanding * `[audio-transcription]` Installs dependencies for audio transcription of wav and mp3 files * `[youtube-transcription]` Installs dependencies for fetching YouTube video transcription ### Plugins MarkItDown also supports 3rd-party plugins. Plugins are disabled by default. To list installed plugins: ```bash markitdown --list-plugins ``` To enable plugins use: ```bash markitdown --use-plugins path-to-file.pdf ``` To find available plugins, search GitHub for the hashtag `#markitdown-plugin`. To develop a plugin, see `packages/markitdown-sample-plugin`. #### markitdown-ocr Plugin The `markitdown-ocr` plugin adds OCR support to PDF, DOCX, PPTX, and XLSX converters, extracting text from embedded images using LLM Vision — the same `llm_client` / `llm_model` pattern that MarkItDown already uses for image descriptions. No new ML libraries or binary dependencies required. **Installation:** ```bash pip install markitdown-ocr pip install openai # or any OpenAI-compatible client ``` **Usage:** Pass the same `llm_client` and `llm_model` you would use for image descriptions: ```python from markitdown import MarkItDown from openai import OpenAI md = MarkItDown( enable_plugins=True, llm_client=OpenAI(), llm_model="gpt-4o", ) result = md.convert("document_with_images.pdf") print(result.text_content) ``` If no `llm_client` is provided the plugin still loads, but OCR is silently skipped and the standard built-in converter is used instead. See [`packages/markitdown-ocr/README.md`](packages/markitdown-ocr/README.md) for detailed documentation. ### Azure Content Understanding [Azure Content Understanding](https://learn.microsoft.com/azure/ai-services/content-understanding/) provides higher-quality conversion with structured field extraction (YAML front matter), multi-modal support (documents, images, audio, video), and configurable analyzers. Install: `pip install 'markitdown[az-content-understanding]'` #### When to use Content Understanding Content Understanding is ideal when you need capabilities beyond what built-in or Document Intelligence converters provide: - **Audio and video files** — CU is the only option for video, and the higher-quality cloud option for audio. Built-in converters have no video support and only basic audio transcription. - **Structured field extraction** — [Prebuilt](https://learn.microsoft.com/azure/ai-services/content-understanding/concepts/prebuilt-analyzers) or [custom-built](https://learn.microsoft.com/azure/ai-services/content-understanding/how-to/customize-analyzer-content-understanding-studio?tabs=portal) analyzers extract domain-specific fields (invoice amounts, receipt dates, contract clauses) serialized as YAML front matter. Neither built-in nor Doc Intel integration exposes fields. - **Higher-quality document extraction** — Cloud-based layout analysis and OCR for scanned PDFs, complex tables, and multi-page documents. - **Single API for all modalities** — One `cu_endpoint` handles documents, images, audio, and video with automatic analyzer routing. | Capability | Built-in converters | Azure Document Intelligence | Azure Content Understanding | |------------|---------------------|-----------------------------|-----------------------------| | Document conversion | Offline, format-specific extraction | Cloud layout extraction | Cloud multimodal extraction | | Structured fields | Not available | Not exposed by this integration | YAML front matter from analyzer fields | | Custom analyzers | Not available | Not configurable in this integration | Supported with `cu_analyzer_id` | | Audio and video | Basic audio, no video | Not supported | Audio and video analyzers | | Cost | Local compute only | Billable Azure API calls | Billable Azure API calls | **CLI:** ```bash markitdown path-to-file.pdf --use-cu --cu-endpoint "<content_understanding_endpoint>" ``` **Python API:** ```python from markitdown import MarkItDown # Zero-config — auto-selects analyzer per file type md = MarkItDown(cu_endpoint="<content_understanding_endpoint>") result = md.convert("report.pdf") # documents → prebuilt-documentSearch result = md.convert("meeting.mp4") # video → prebuilt-videoSearch result = md.convert("call.wav") # audio → prebuilt-audioSearch print(result.markdown) ``` **With a custom analyzer** (for domain-specific field extraction): ```python md = MarkItDown( cu_endpoint="<content_understanding_endpoint>", cu_analyzer_id="my-invoice-analyzer", ) result = md.convert("invoice.pdf") print(result.markdown) # Output includes YAML front matter with extracted fields: # --- # contentType: document # fields: # VendorName: CONTOSO LTD. # InvoiceDate: '2019-11-15' # --- # <!-- page 1 --> # ... ``` When `cu_analyzer_id` is set, the converter automatically scopes it to compatible file types based on the analyzer's modality. Incompatible types (e.g., audio files with a document analyzer) auto-route to default prebuilt analyzers. **Cost note:** Each `convert()` call for a CU-routed format is a billable Azure API call. Use `cu_file_types` to restrict which formats route to CU: ```python from markitdown.converters import ContentUnderstandingFileType md = MarkItDown( cu_endpoint="<content_understanding_endpoint>", cu_file_types=[ContentUnderstandingFileType.PDF], # only PDFs use CU ) ``` More information about Azure Content Understanding can be found [here](https://learn.microsoft.com/azure/ai-services/content-understanding/). ### Azure Document Intelligence To use Microsoft Document Intelligence for conversion: ```bash markitdown path-to-file.pdf -o document.md -d -e "<document_intelligence_endpoint>" ``` More information about how to set up an Azure Document Intelligence Resource can be found [here](https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/how-to-guides/create-document-intelligence-resource?view=doc-intel-4.0.0) ### Python API Basic usage in Python: ```python from markitdown import MarkItDown md = MarkItDown(enable_plugins=False) # Set to True to enable plugins result = md.convert("test.xlsx") print(result.text_content) ``` Document Intelligence conversion in Python: ```python from markitdown import MarkItDown md = MarkItDown(docintel_endpoint="<document_intelligence_endpoint>") result = md.convert("test.pdf") print(result.text_content) ``` To use Large Language Models for image descriptions (currently only for pptx and image files), provide `llm_client` and `llm_model`: ```python from markitdown import MarkItDown from openai import OpenAI client = OpenAI() md = MarkItDown(llm_client=client, llm_model="gpt-4o", llm_prompt="optional custom prompt") result = md.convert("example.jpg") print(result.text_content) ``` ### Docker ```sh docker build -t markitdown:latest . docker run --rm -i markitdown:latest < ~/your-file.pdf > output.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. ### How to Contribute You can help by looking at issues or helping review PRs. Any issue or PR is welcome, but we have also marked some as 'open for contribution' and 'open for reviewing' to help facilitate community contributions. These are of course just suggestions and you are welcome to contribute in any way you like. <div align="center"> | | All | Especially Needs Help from Community | | ---------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | | **Issues** | [All Issues](https://github.com/microsoft/markitdown/issues) | [Issues open for contribution](https://github.com/microsoft/markitdown/issues?q=is%3Aissue+is%3Aopen+label%3A%22open+for+contribution%22) | | **PRs** | [All PRs](https://github.com/microsoft/markitdown/pulls) | [PRs open for reviewing](https://github.com/microsoft/markitdown/pulls?q=is%3Apr+is%3Aopen+label%3A%22open+for+reviewing%22) | </div> ### Running Tests and Checks - Navigate to the MarkItDown package: ```sh cd packages/markitdown ``` - Install `hatch` in your environment and run tests: ```sh pip install hatch # Other ways of installing hatch: https://hatch.pypa.io/dev/install/ hatch shell hatch test ``` (Alternative) Use the Devcontainer which has all the dependencies installed: ```sh # Reopen the project in Devcontainer and run: hatch test ``` - Run pre-commit checks before submitting a PR: `pre-commit run --all-files` ### Security Considerations MarkItDown performs I/O with the privileges of the current process. Like `open()` or `requests.get()`, it will access resources that the process itself can access. **Sanitize your inputs:** Do not pass untrusted input directly to MarkItDown. If any part of the input may be controlled by an untrusted user or system, such as in hosted or server-side applications, it must be validated and restricted before calling MarkItDown. Depending on your environment, this may include restricting file paths, limiting URI schemes and network destinations, and blocking access to private, loopback, link-local, or metadata-service addresses. **Call only the conversion method you need:** Prefer the narrowest conversion API that fits your use case. MarkItDown's `convert()` method is intentionally permissive and can handle local files, remote URIs, and byte streams. If your application only needs to read local files, call `convert_local()` instead. If you need more control over URI fetching, call `requests.get()` yourself and pass the response object to `convert_response()`. For maximum control, open a stream to the input you want converted and call `convert_stream()`. ### Contributing 3rd-party Plugins You can also contribute by creating and sharing 3rd party plugins. See `packages/markitdown-sample-plugin` for more details. ## 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). 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.

Developer Tools Utilities & System AI Tools
148.9K Github Stars
atlas-design
Open Source

atlas-design

# Atlas Design System Welcome to the Atlas Design project! This repository holds the source code backing the Atlas Design System. ## Our mission Atlas strives to empower designers, PMs, and developers to build accessible, high quality, and consistent experiences at scale. Atlas powers [Microsoft Learn](https://learn.microsoft.com) 🤓! We are a CSS-first framework, adding JavaScript only where required for accessibility and behavior. Looking for information about the Atlas CSS framework? Start in `/css`! ## What we do - We care deeply about accessibility. Microsoft Learn is one of the very few large Grade B websites. - We are a low-level design system that focuses on CSS and only uses zero-dependency JS when required for good interactions or accessibility. - We are compatible with right-to-left reading direction thanks to our use of logical properties. - We are themeable, with three themes right out of the box (Light, Dark, and High Contrast), and we support an unlimited number of themes. - We provide example markup. Our website is spartan compared to many design system websites. Its main purpose is for atomic/component documentation and to provide accessible code snippets. - We have atomics for flexibility and components for consistency. - We have a VSCode extension that provides helpful IntelliSense and class completion in the IDE. - We publish to NPM. ## Version and status | Name | Status | | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **@microsoft/atlas-css** | [![@microsoft/atlas-css npm version](https://badge.fury.io/js/%40microsoft%2Fatlas-css.svg)](https://badge.fury.io/js/%40microsoft%2Fatlas-css) | | **@microsoft/atlas-js** | [![@microsoft/atlas-js npm version](https://badge.fury.io/js/%40microsoft%2Fatlas-js.svg)](https://badge.fury.io/js/%40microsoft%2Fatlas-js) | | **Release Pipeline** | [![Release](https://github.com/microsoft/atlas-design/actions/workflows/release.yml/badge.svg)](https://github.com/microsoft/atlas-design/actions/workflows/release.yml) | | **PR Builds** | [![CI](https://github.com/microsoft/atlas-design/actions/workflows/main.yml/badge.svg?event=push)](https://github.com/microsoft/atlas-design/actions/workflows/main.yml) | | **Atlas-css package size (gzip)** | ![Atlas-css package size (gzip)](https://img.badgesize.io/https:/unpkg.com/@microsoft/atlas-css/dist/index.css?label=css%20gzip%20size&compression=gzip) | | **Atlas-css package size (uncompressed)** | ![Atlas-css package size (uncompressed)](<https://img.badgesize.io/https:/unpkg.com/@microsoft/atlas-css/dist/index.css?label=css%20size%20(uncompressed)>) | ## Development - Ensure [git](https://git-scm.com/) is installed. - Ensure that have downloaded and installed a version of [NodeJS](https://nodejs.org/en/download/releases/) that supports monorepos. It's currently recommended you download NodeJS version 18.12.1 and use with NPM at a greater version than 8.19.2. - Alternatively, you can install NPM with NVM: [mac](https://github.com/nvm-sh/nvm) | [windows](https://github.com/coreybutler/nvm-windows). - If contributing code, please read about using [changesets](https://github.com/atlassian/changesets) and [semantic versioning bump types](https://semver.org/). - Clone the repostory. - From the root directory, run `npm install`. ## Using Atlas CSS The styles backing the Atlas Design system are discussed in greater detail in `/css`. ### Install Atlas CSS in your project Use NPM to add `@microsoft/atlas-css` to your project. ```sh # install with NPM npm install --save @microsoft/atlas-css ``` You may access any file within the `/css` folder using the following UNPKG url. Just add the path to the file, relative to the `@` sign or version the end. ```sh https://unpkg.com/browse/@microsoft/atlas-css/ # Will redirect to latest version https://unpkg.com/browse/@microsoft/atlas-css@<version>/ # Use this pattern on your page ``` ### Install Atlas JS in your project Behaviors and elements beyond the scope of CSS are found in the `/js` folder. ```sh # install with NPM npm install --save @microsoft/atlas-js ``` ## Contributing While this project is open source, its primary purpose is to serve Microsoft web properties through a CSS-first implementation of a design system. We do appreciate contributions to our documentation (`/site` folder), our framework (`/css`), and its companion scripts (`/js`). 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. ## 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). 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. ## Updating dependencies The following commands can be used to update broadly update dependencies. (Note: we omit major updates to husky because of major api changes and a general preference for version 4.x) ```sh npm exec --package npm-check-updates --workspaces --include-workspace-root -- npm-check-updates --upgrade --reject husky npm exec --package npm-check-updates --workspaces --include-workspace-root -- npm-check-updates --upgrade --target minor rm package-lock.json npm i ```

CSS Frameworks & UI Kits
72 Github Stars
fluentui-token-pipeline
Open Source

fluentui-token-pipeline

# Fluent UI token pipeline The Fluent UI token pipeline transforms JSON files describing design tokens into source code for eventual use in the Fluent UI libraries. This tool was originally designed to process files in Microsoft's proprietary design token format. Our design token files are now in the [W3C Design Token Community Group](https://design-tokens.github.io/community-group/format/) draft standard format, so this tool is no longer required to work with them. Do not add new dependencies on this tool. Over time, it is expected that Fluent UI teams will transition from using this tool to using standard open source solutions for consuming design tokens. But while this tool is deprecated, it is still fully functional and will remain so for the foreseeable future. And since this tool can also read DTCG format JSON, existing code written when continues to work even though we no longer use this proprietary format. * **[Documentation site](https://microsoft.github.io/fluentui-token-pipeline/)** * [Source code on GitHub](https://github.com/microsoft/fluentui-token-pipeline) * [`@fluentui/token-pipeline` on NPM](https://www.npmjs.com/package/@fluentui/token-pipeline) * [Fluent UI design tokens on GitHub](https://github.com/microsoft/fluentui-design-tokens) 🔒 with links to packages of transformed tokens --- # The legal stuff The actual token values in the `src/demo` folder are just examples, and they do not represent an evolution of Microsoft's design systems. ## 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. ## 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). 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.

JavaScript Libraries & Components Design Systems & Tokens
44 Github Stars
fluentui-system-icons
Open Source

fluentui-system-icons

Fluent System Icons are a collection of familiar, friendly and modern icons from Microsoft.

Mobile Development Icon Libraries
10.6K Github Stars
react-native-windows
Open Source

react-native-windows

![Hero Image with Logo](https://github.com/microsoft/react-native-windows/raw/main/.github/hero3.png) <h1 align="center"> React Native for Windows </h1> <p align="center"> <a href="https://twitter.com/intent/follow?&screen_name=ReactNativeMSFT"> <img src="https://img.shields.io/twitter/follow/ReactNativeMSFT?style=for-the-badge&logo=X&labelColor=black&color=white" alt="Follow @ReactNativeMSFT" /> </a> </p> <h3 align="center"> <a href="https://microsoft.github.io/react-native-windows">Website</a> <span> · </span> <a href="https://microsoft.github.io/react-native-windows/docs/getting-started">Documentation</a> <span> · </span> <a href="https://github.com/microsoft/react-native-windows/releases">Release notes</a> </h3> > See the official [React Native website](https://reactnative.dev/) for an introduction to React Native. [React Native](https://reactnative.dev) is a framework developed by Meta that enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and [React](https://reactjs.org/). The focus of React Native is on developer efficiency across all the platforms you care about - learn once, write anywhere. This repository adds support for the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads), which allows you to build apps for [all devices supported by Windows 10](https://developer.microsoft.com/en-us/windows/get-started-windows-10) including PCs, tablets, 2-in-1s, Xbox, Mixed reality devices etc. Visit the official [React Native for Windows + macOS website](https://microsoft.github.io/react-native-windows) to learn more. ## 🛣️ Roadmap [Check out our blog](https://microsoft.github.io/react-native-windows/blog/) if you'd like to stay up to date on the status of React Native for Windows and check out current and past roadmaps. ### New Architecture [Fabric](https://reactnative.dev/architecture/fabric-renderer) is the new rendering system for React Native, designed to share more rendering logic cross-platform. RNW's existing Paper renderer is built on UWP XAML, dropping down into native Composition as need be; the new RNW Fabric renderer targets Composition from the start but has the ability to host islands of XAML for advanced native controls. Apps on the new architecture will be [WinAppSDK](https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/) Win32 by default. For more details on our roadmap to Fabric, check out [this pinned issue](https://github.com/microsoft/react-native-windows/issues/12042). ## 🖼️ React Native Gallery Make sure to also check out the [React Native Gallery](https://github.com/microsoft/react-native-gallery), our interactive sample experience showing everything you can do with React Native for Windows. <p align="center"> <img src="docs/img/rn-gallery.png" alt="WinUI 3 Gallery" width="400"/> </p> <p align="center"> <a href="https://www.microsoft.com/en-us/p/react-native-gallery/9npg0b292h4r?launch=true &mode=mini"> <img src="docs/img/storeBadge.png" width="200"/> </a> </p> </br> ## 📋 Getting Started See the [Getting Started Guide](https://microsoft.github.io/react-native-windows/docs/getting-started) on our React Native for Windows + macOS website to build your first React Native for Windows app. ### Requirements You can run React Native Windows apps only on devices supported by the [Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads). For a full and detailed list of the system requirements and how to set up your development platform, see our [System Requirements](https://microsoft.github.io/react-native-windows/docs/rnw-dependencies) documentation on our website. ### Logging Issues Search the [existing issues](https://github.com/microsoft/react-native-windows/issues) and try to make sure your problem doesn’t already exist before opening a new issue. If your issue doesn't exist yet, provide as much information as possible so we can better help you. Include the information requested by the [appropriate issue template](https://github.com/microsoft/react-native-windows/issues/new/choose). ## Documentation React Native has [great documentation](https://reactnative.dev/docs/getting-started). React Native for Windows adds its own separate [Windows and macOS documentation](https://microsoft.github.io/react-native-windows/) for desktop platform information like API docs and blog updates. ### Examples - Using the CLI in the [Getting Started](https://microsoft.github.io/react-native-windows/docs/getting-started) guide will set you up with a sample React Native for Windows app that you can begin editing right away. - Check the [samples repo](https://github.com/microsoft/react-native-windows-samples) for more standalone samples. - The [React Native Gallery](https://github.com/microsoft/react-native-gallery) app demonstrates various components in an interactive way. - Check out the [React Native Developer Blog](https://devblogs.microsoft.com/react-native/) to see examples from past conference talks, blog posts, and more. - For more sample code browse the [RNTester folder](https://github.com/microsoft/react-native-windows/tree/main/packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric) in the GitHub web UI. ## 📢 Contributing See [Contributing guidelines](https://github.com/microsoft/react-native-windows/blob/main/CONTRIBUTING.md) for how to setup your fork of the repo and start a PR to contribute to React Native for Windows. Not sure where to start? The [good first issue](https://github.com/microsoft/react-native-windows/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22good%20first%20issue%22) and [help wanted](https://github.com/microsoft/react-native-windows/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22help%20wanted%22) labels are the best starting points. ## Code of Conduct 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.

JavaScript Libraries & Components Mobile Development
17.3K Github Stars
vscode-react-native
Open Source

vscode-react-native

# React Native Tools [![Build Status](https://dev.azure.com/vscode-webdiag-extensions/VS%20Code%20WebDiag%20extensions/_apis/build/status/%5BUnit%20tests%5D%20vscode-react-native%20%5Bmaster%5D?branchName=master)](https://dev.azure.com/vscode-webdiag-extensions/VS%20Code%20WebDiag%20extensions/_build/latest?definitionId=60&branchName=master) Stable: ![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/msjsdiag.vscode-react-native?color=deep%20green&label=Version) ![Visual Studio Marketplace Rating (Stars)](https://img.shields.io/visual-studio-marketplace/stars/msjsdiag.vscode-react-native?label=Rating) Preview: ![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/msjsdiag.vscode-react-native-preview?color=deep%20green&label=Version) ![Visual Studio Marketplace Rating (Stars)](https://img.shields.io/visual-studio-marketplace/stars/msjsdiag.vscode-react-native-preview?label=Rating) ## React Native Tools Preview The extension has a [nightly version](https://marketplace.visualstudio.com/items?itemName=msjsdiag.vscode-react-native-preview) which is released on a daily basis at 9 PM PST on each day that changes occur. To avoid conflicts, if both extensions are installed - only stable version will be activated. So to use the preview version it is needed to disable or remove the stable version and reload VS Code. ## Package extension locally You can not only download React Native Tools in the marketplace, but can also package your extension `.vsix` installation file by yourself locally. Following [this documentation](https://github.com/microsoft/vscode-react-native/blob/master/CONTRIBUTING.md#build-the-project) to package and install your React Native Tools to get the latest updates. ## About the extension This VS Code extension provides a development environment for React Native and Expo projects. Using this extension, you can **debug your code and quickly run `react-native` or `expo` commands** from the command palette. ![React Native features](resources/images/react-features.gif) <!-- TABLE OF CONTENTS --> # Table of Contents - [React Native Tools Preview](#react-native-tools-preview) - [Package extension locally](#package-extension-locally) - [About the extension](#about-the-extension) - [Getting started](#getting-started) - [React Native commands in the Command Palette](#react-native-commands-in-the-command-palette) - [Customize metro configuration](#customize-metro-configuration) - [Debugging React Native applications](#debugging-react-native-applications) - [Hermes engine and direct debugging (Recommended)](#hermes-engine-and-direct-debugging-recommended) - [Attach to Hermes application](#attach-to-hermes-application) - [Android applications](#android-applications) - [Android Hermes Debugging](#android-hermes-debugging) - [Custom build for android apps](#custom-build-for-android-apps) - [iOS applications](#ios-applications) - [iOS Hermes debugging](#ios-hermes-debugging) - [iOS devices](#ios-devices) - [Custom scheme for iOS apps](#custom-scheme-for-ios-apps) - [iOS direct debugging](#iOS-direct-debugging) - [Expo applications](#expo-applications) - [Debug on Expo Go](#debug-on-expo-go) - [Debug on expo-dev-client](#debug-on-expo-dev-client) - [Debug on Expo Web](#debug-on-expo-web) - [Configuring Expo](#configuring-expo) - [Expo Hermes](#expo-hermes) - [EAS Build initialization](#eas-build-initialization) - [Windows applications](#react-native-for-windows) - [Windows Hermes debugging](#windows-hermes-debugging) - [MacOS applications](#react-native-for-macos) - [MacOS Hermes debugging](#macos-hermes-debugging) - [Monorepo: debug out of React Native project directory](#monorepo-debug-out-of-react-native-project-directory) - [Debugger configuration properties](#debugger-configuration-properties) - [Re.Pack and Haul debugging](#repack-and-haul-debugging) - [Remote JavaScript Debugging (Deprecated)](#remote-javascript-debugging-deprecated) - [Customization](#customization) - [Sourcemaps](#sourcemaps) - [Debug in vscode workspace](#debug-in-vscode-workspace) - [Logging](#logging) - [Build APK and generate bundle](#build-apk-and-generate-bundle) - [Specifying custom arguments for `react-native run-*` command](#specifying-custom-arguments-for-react-native-run--command) - [Setting up the React Native packager](#setting-up-the-react-native-packager) - [Change project root](#change-project-root) - [Configure an Android LogCat Monitor](#configure-an-android-logcat-monitor) - [Configure dependencies versions for debugging Expo projects](#configure-dependencies-versions-for-debugging-expo-projects) - [Security dependency overrides](#security-dependency-overrides) - [Configure custom key bindings for extension commands](#configure-custom-key-bindings-for-extension-commands) - [Configure custom colors for extension output logs](#configure-custom-colors-for-extension-output-logs) - [Set pnpm as package manager](#set-pnpm-as-package-manager) - [Network Inspector](#network-inspector) - [Developing inside a Docker Container](#developing-inside-a-docker-container) - [Contributing](#contributing) - [Known Issues](#known-issues) # Getting started Before going any further make sure that you: - [have a working React Native environment](https://reactnative.dev/docs/environment-setup). - have the Android emulator available in your `PATH` or install iOS simulator in MacOS - are using [VS Code](https://code.visualstudio.com) and have [installed this extension from the Marketplace](https://marketplace.visualstudio.com/items?itemName=msjsdiag.vscode-react-native). - have your React Native project root folder open in VS Code. - have executed `React Native: Check development environment configuration` or `React Native: Run expo doctor`command to make sure that all necessary softwares are installed correctly. Please notice that the extension uses `.vscode/.react` directory at the project root to store intermediate files required for debugging. Although these files usually get removed after debug session ends, you may want to add this directory to your project's `.gitignore` file. # React Native commands in the Command Palette In the Command Palette, type `React Native` and choose a command. ![React Native commands](resources/images/command-palette.png) The **Run Android** or **Run iOS** command triggers `react-native run-android` or `react-native run-ios` to starts your app for Android emulator or iOS simulator. The **Run Expo** command triggers `expo start` and starts your expo application. The **Packager** commands allow you to start/stop the [**Metro Bundler**](https://github.com/facebook/metro-bundler) (formerly React Packager). The full list of commands is: | Name | Command ID | Description | | -------------------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Launch Android Emulator | `reactNative.launchAndroidSimulator` | Prompts you to select the name of the available Android emulator and launch it. If only one emulator is installed in the system, it will be selected automatically | | Launch iOS Simulator | `reactNative.launchIOSSimulator` | Prompts you to select the available system version of the iOS simulator, then select the simulator name for the selected system and launch it. If only one simulator is installed in the system, it will be selected automatically | | Launch ExpoWeb | `reactNative.launchExpoWeb` | Check if the current project is an Expo project. If so, launch ExpoWeb. | | Run Android on Emulator | `reactNative.runAndroidSimulator` | Run an Android application on Emulator. Launch order: check target platform support, load run arguments, start Packager, run app on the selected emulator. Make sure the `emulator` utility is added to `PATH` | | Run Android on Device | `reactNative.runAndroidDevice` | Run an Android application on Device. Launch order: check target platform support, load run arguments, start Packager, run app in all connected devices | | Run iOS on Simulator | `reactNative.runIosSimulator` | Run an iOS application on Simulator. Launch order: load run arguments, check target platform support, start Packager, run app in only one connected emulator | | Run iOS on Device | `reactNative.runIosDevice` | Run an iOS application on Device. Launch order: load run arguments, check target platform support, start Packager, run app in only one connected device | | Run Expo | `reactNative.runExponent` | Run an Exponent application. Launch order: login to exponent, load run arguments, start Packager, run app | | Run Windows | `reactNative.runWindows` | Run a RNW application. Launch order: check target platform support, load run arguments, start Packager, run app | | Run MacOS | `reactNative.runMacOS` | Run a RNmacOS application. Launch order: check target platform support, load run arguments, start Packager, run app | | Start Packager | `reactNative.startPackager` | Start Packager in context project workspace folder | | Stop Packager | `reactNative.stopPackager` | Stop Packager | | Restart Packager | `reactNative.restartPackager` | Restart Packager | | Clean & Restart Packager (Metro) | `reactNative.cleanRestartPackager` | Restart Packager and clear the Packager's cache | | Publish To Expo | `reactNative.publishToExpHost` | Publish to Exponent Host. Launch order: login to exponent, execute `Run Expo` command, then publish app to host | | Expo - Create EAS config file | `reactNative.createExpoEASBuildConfigFile` | Create EAS build config file for Expo projects | | Show Dev Menu | `reactNative.showDevMenu` | Show development menu for running application on iOS or Android device or emulator | | ReloadApp | `reactNative.reloadApp` | Reload an application | | Run React Native LogCat Monitor | `reactNative.startLogCatMonitor` | Creates a LogCat Monitor for the chosen online Android device to see the device LogCat logs. Default filtering arguments: ["*:S", "ReactNative:V", "ReactNativeJS:V"]. [How to configure filtering.](#configure-an-Android-LogCat-Monitor) | | Stop React Native LogCat Monitor | `reactNative.stopLogCatMonitor` | Stops an existing LogCat Monitor and removes its output channel | | Run Network Inspector | `reactNative.startNetworkInspector` | Run [Network inspector](#network-inspector) | | Stop Network Inspector | `reactNative.stopNetworkInspector` | Stop [Network inspector](#network-inspector) | | Check development environment configuration | `reactNative.testDevEnvironment` | Checks your development environment for common problems | | Open the eas project in a web page | `reactNative.openEASProjectInWebPage` | Open EAS build in your EAS project portal | | Open react native upgrade helper in web page | `reactNative.openRNUpgradeHelper` | Open an official project upgrade tools in browser, support RN, RN for Windows, RN for MacOS | | Expo - Download and install ExpoGo | `reactNative.installExpoGoApplication` | Download and install Expo Go application | | Revert extension input in open package module | `reactNative.revertOpenModule` | Quickly revert some codes in Open Module which are changed by react-native-tools | | Run doctor | `reactNative.doctor` | Execute react-native doctor to check basic environment for react-native development | | Run expo doctor | `reactNative.expoDoctor` | Execute expo doctor to check basic environment for Expo development | | Expo prebuild | `reactNative.expoPrebuild` | Create the android and ios directories for running your React code | | Expo prebuild cleanup | `reactNative.expoPrebuildClean` | Clean directories generated by prebuild | | Reopen QR Code in Expo | `reactNative.reopenQRCode` | Reopen expo generated QR code in webview | | Enable Hermes | `reactNative.hermesEnable` | Use hermes as JavaScript engine for RN project | | Enable & Disable Expo Hermes | `reactNative.expoHermesEnable` | Use hermes or jsc as JavaScript engine for expo project | | Open expo upgrade helper in web page | `reactNative.openExpoUpgradeHelper` | Open expo upgrade helper in web browser | | Install CocoaPods dependencies | `reactNative.installPods` | Install CocoaPods dependencies for iOS projects | | Kill Port | `reactNative.killPort` | Kill the process running on a specific port | | Run EAS Build | `reactNative.runEasBuild` | Initialize EAS Build configuration by creating `eas.json` and `.eas/workflows/create-production-builds.yml` files if they don't exist | | Set React Native New Architecture | `reactNative.setNewArch` | Enable or disable the new architecture settings in RN projects | | Toggle Network View | `reactNative.toggleNetworkView` | Enable or disable vscode network view feature for web debugging | ## Using commands in VS Code tasks To run React Native Tools commands via VS Code tasks, you can create a `.vscode/tasks.json` file in your project and add tasks configurations the following way: ```json { "version": "2.0.0", "tasks": [ { "label": "Run Android on Emulator", "command": "${command:reactNative.runAndroidSimulator}", "problemMatcher": [] } ] } ``` # Customize metro configuration Metro is a JavaScript bundler for React Native and included in React Native package. Metro configuration can be customized in `metro.config.js`. # Debugging React Native applications To debug react-native application: 1. Create `launch.json` file in `.vscode` folder. 2. Click on `Add Configuration` button and choose `React Native` option. 3. Select any scenario needed in dropdown list. ![Add React Native debug configuration](resources/images/add-debug-configuration.gif) 4. Choose the appropriate configuration in the Configuration dropdown, and then press F5 (or click _Green Arrow_ ![Configure-gear](resources/images/debug-icon.png) button) to start debugging your app in VS Code. ![React Native launch targets](resources/images/debug-targets.png) Optional: The extension also allows to start debugging without creating the `launch.json` file in one of the following ways: - Using dynamic debugging configurations To use dynamic debugging configurations you can click on the `Show all automatic debug configurations` string in the `Run and Debug` panel, then select `React Native` in the list of extensions and choose the appropriate configuration in the Configuration list to start debugging. ![Run dynamic debugging configuration](resources/images/dynamic-debugging-configuration.gif) - Using `Debug` button in the Editor Title area menu To start debugging you can click the Debug button in the Editor Title area in the upper right corner. You can also select the appropriate debugging scenario by clicking the dropdown button beside the Debug button and choosing the scenario. ![Select and run debugging command](resources/images/debug-commands-button.png) The extension allows you to debug multiple devices and configurations, please read the following sections for more information for your particular use case. ## Hermes engine and direct debugging (Recommended) React-native set Hermes as default engine. Please see [official documentation](https://reactnative.dev/blog/2022/07/08/hermes-as-the-default) to get details. The Hermes engine is an open source JavaScript engine created by Facebook to optimize building and running React Native applications. It improves app performance and decreases app size. Click [here](https://reactnative.dev/docs/hermes) to learn more about Hermes and how to enable it for your application. ## Attach to Hermes application To attach to a running Hermes application use `Attach to Hermes application` launch configuration: ```json { "name": "Attach to Hermes application", "cwd": "${workspaceFolder}", "type": "reactnativedirect", "request": "attach" } ``` ## Android applications ### Android Hermes debugging To debug while using Hermes engine use `Debug Android Hermes` launch configuration: ```json { "name": "Debug Android Hermes", "cwd": "${workspaceFolder}", "type": "reactnativedirect", "request": "launch", "platform": "android" } ``` ### Custom build for Android apps If you want to use a custom `applicationIdSuffix` for your application to launch specific build, you can either pass it as part of the `runArguments` parameter arguments as shown below: ```js "runArguments": ["--appIdSuffix", "customAppIdSuffix", ...] // or "runArguments": ["--appIdSuffix=customAppIdSuffix", ...] ``` ## iOS applications ### iOS Hermes debugging To debug your iOS Hermes application, you can use `Debug iOS Hermes` launch configuration to debug an iOS Hermes application: ```json { "name": "Debug iOS Hermes", "cwd": "${workspaceFolder}", "type": "reactnativedirect", "request": "launch", "platform": "ios" } ``` ### iOS devices Debugging on an iOS device requires following manual steps: - Install [ios-deploy](https://github.com/ios-control/ios-deploy) `brew install ios-deploy`. - Install a valid iOS development certificate. - In your project's `launch.json` file set `target` to `device`. If you need to specify the exact device to run, you can set `target` to `<iOS device name/udid>`, or you can also use `runArguments` property to specify a particular device to run on in case multiple devices are connected (e.g. `"runArguments": [ "--device", "My iPhone" ]`) - Choose the **Debug iOS Hermes** option from the "Configuration" dropdown and press F5. ### Custom scheme for iOS apps If you want to use a custom scheme for your application you can either pass it as part of the `runArguments` parameter arguments as shown below: ```js "runArguments": ["--scheme", "customScheme", ...] // or "runArguments": ["--scheme=customScheme", ...] ``` Please be aware, specifying the scheme value as a part of the `runArguments` parameter arguments will override the `scheme` configuration parameter value, if it set. ### iOS direct debugging The extension provides experimental support of iOS direct debugging. See more info here: [react-native-community/discussions-and-proposals#40](https://github.com/react-native-community/discussions-and-proposals/issues/40), [react-native-community/discussions-and-proposals#206](https://github.com/react-native-community/discussions-and-proposals/issues/206) For now the extension supports iOS direct debugging only on real iOS devices. Since this scenarios are using some 3rd party tools for the debugging process. Sometimes it may have limitation from upstream. We still recommend using **Hermes direct debugging** as a first choice. To be able to debug an iOS app directly, you need to install [ios-webkit-debug-proxy](https://github.com/google/ios-webkit-debug-proxy): - Install [HomeBrew](https://brew.sh) on your Mac. - Open a Terminal and run `brew install ideviceinstaller ios-webkit-debug-proxy` You can use the following debug scenarios to debug iOS apps directly: - React Native Direct: Debug Direct iOS - Experimental ```json "name": "Debug Direct iOS - Experimental", "cwd": "${workspaceFolder}", "type": "reactnativedirect", "request": "launch", "platform": "ios", "port": 9221, "target": "device" ``` - React Native Direct: Attach to the React Native iOS - Experimental ```json "name": "Attach to the React Native iOS - Experimental", "cwd": "${workspaceFolder}", "type": "reactnativedirect", "request": "attach", "platform": "ios", "port": 9221 ``` ## Expo applications Extension also support [Expo](https://expo.dev/) application debugging scenarios. To create Expo application, please prepare your environment by following the [Expo CLI Quickstart instruction](https://reactnative.dev/docs/environment-setup). You can verify if the environment is ready to use by `React Native: Run Expo Doctor` in command palette. ### Debug on Expo Go If you're using [Expo Go](https://expo.dev/expo-go), follow below steps to start debugging Expo application: 1. Open your project in VS Code with this extension installed. 2. Add below configure in `launch.json`. ```json { "name": "Debug Exponent Hermes", "request": "launch", "type": "reactnativedirect", "cwd": "${workspaceFolder}", "platform": "exponent", "expoHostType": "local" } ``` 3. Wait while some dependencies are configured - the extension will install [`Expo Development Library(xdl)`](https://www.npmjs.com/package/xdl) when this feature is used for the first time. 4. Once the packager starts, the extension will open a separate tab with QR code and app link. You can open app in Expo Go and start debugging. ![Expo QRCode](/resources/images/expo-qrcode.png) ### Debug on expo-dev-client If you want to debug Expo app using [expo-dev-client](https://docs.expo.dev/development/getting-started/), follow below steps to start debugging Expo application: 1. Open your project in VS Code with this extension installed. 2. In project folder, install expo-dev-client for your app using `npx expo install expo-dev-client`. 3. Create your app in development mode `eas build --profile development --platform all`, replace `--platform all` to `android` or `iOS` to build specific platform application(need development account for `iOS` platform). 4. After build success, download your build and install application to your device or simulator. 5. In project, using `npx expo start --dev-client` to start Metro and load application in device or simulator. 6. Add `Attach to application` command `launch.json`, and start debugging. ```json { "name": "Attach to Hermes application", "request": "attach", "type": "reactnativedirect", "cwd": "${workspaceFolder}" } ``` ### Debug on Expo Web Expo support open application in browser, the expo web application is generated by [react-native-web](https://necolas.github.io/react-native-web/). It can help user open application without any Android emulator, iOS simulator or device. React-native-tools supports debugging Expo Web application in Chrome and Edge. Follow below steps to start Expo Web debugging: 1. Open your project in VS Code with this extension installed. 2. Check and install related package: `react-dom`, `react-native-web` and `@expo/webpack-config` (this package is deprecated from Expo 49) by `npx expo install` command. 3. Add Expo Web debugging configure in `launch.json` and start debugging. ```json { "name": "Debug Expo Web", "request": "launch", "type": "reactnativedirect", "cwd": "${workspaceFolder}", "platform": "expoweb", "browserTarget": "chrome", "url": "http://localhost:8081" } ``` ### Configuring Expo The extension supports running through Exponent not just the applications created with Expo but even pure React Native applications (in that case you need to add `expo` package to `node_modules` in order to make it work with Expo: `npm install expo --save-dev`. In either cases it uses `app.json` configuration file in the root of the project.) If you are running `Debug Exponent Hermes` configuration or any of palette commands like `Run in Exponent`, `Publish to Exponent` then this file will be created automatically if absent or updated with the following basic configuration section: ```json { "expo": { "slug": "MyApp", // Project slug "name": "MyApp", // Project name "sdkVersion": "31.0.0", // Expo SDK version "entryPoint": ".vscode\\exponentIndex.js" // Entrypoint for the project }, "name": "MyApp" // Project name } ``` Full list of configuration parameters for `expo` section in `app.json` may be found on [official Expo documentation page](https://docs.expo.io/versions/latest/workflow/configuration). For running **pure React Native app**, the extension, creates and uses `.vscode/exponentIndex.js` which points to the app entrypoint (`index.js` or `index.android.js` or `index.ios.js`) file. If you want to change your app entrypoint (for example, from `index.js` to `index.android.js`), delete `.vscode/exponentIndex.js` and then restart your debugging session. **NOTE**: The extension caches the version of the exponent SDK used by your project. This is helpful since we don't want to install the SDK each time you run exponent. If you want the extension to update the SDK version based on your React Native version, just restart VS Code and if it is supported it should work. If it does not please open an issue. ### Expo Hermes Expo using Hermes as default engine, you can switch engine on a specific platform using below configure. ```json { "expo": { "jsEngine": "hermes", "ios": { "jsEngine": "jsc" } } } ``` **Note**: You maybe need to create developer account to run `eas build`. Any other issue or limitation, please see [expo hermes documentation](https://docs.expo.dev/guides/using-hermes/). ### EAS Build initialization The **Run EAS Build** command (`reactNative.runEasBuild`) helps you quickly set up [Expo Application Services (EAS) Build](https://docs.expo.dev/build/introduction/) configuration in your Expo project. #### What it does When you run this command from the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`), it will: 1. Check if your project root directory is accessible 2. Create an `eas.json` file (if it doesn't exist) with an empty configuration `{}` 3. Create the `.eas/workflows/` directory structure 4. Generate a `create-production-builds.yml` workflow file with the following content: ```yaml name: Create Production Builds jobs: build_android: type: build # This job type creates a production build for Android params: platform: android build_ios: type: build # This job type creates a production build for iOS params: platform: ios ``` #### How to use 1. Open your Expo project in VS Code 2. Press `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (macOS) to open the Command Palette 3. Type "Run EAS Build" and select **React Native: Run EAS Build** 4. The command will create the necessary files if they don't exist **Note**: The command is idempotent - it will not overwrite existing files. If the files already exist, the command will skip creation and display an appropriate message. #### Next steps after initialization After running this command, you should: 1. **Configure `eas.json`**: Add your build profiles (e.g., `development`, `preview`, `production`). See [EAS Build Configuration](https://docs.expo.dev/build/eas-json/) for details. 2. **Set up credentials**: Configure your iOS and Android signing credentials. Use `eas credentials` command or configure them in your EAS project. 3. **Run your first build**: ```bash # For Android npx eas build --platform android # For iOS npx eas build --platform ios # For both platforms npx eas build --platform all ``` 4. **Customize workflows**: Edit `.eas/workflows/create-production-builds.yml` to add more complex build configurations, such as different build profiles, environment variables, or custom scripts. 5. **Monitor builds**: Use `React Native: Open the eas project in a web page` command to view your build status in the EAS dashboard. #### Troubleshooting - **Permission errors**: Ensure VS Code has write permissions to your project directory - **Files already exist**: The command will skip file creation if they already exist - this is normal behavior - **Project not found**: Make sure you have opened a React Native/Expo project folder in VS Code For more information about EAS Build, visit the [official Expo documentation](https://docs.expo.dev/build/introduction/). ## React Native for Windows Please make sure that your development environment is configured properly in accordance with [the official system requirements](https://microsoft.github.io/react-native-windows/docs/rnw-dependencies). And follow [the official guide](https://microsoft.github.io/react-native-windows/docs/hermes#hermes-on-windows) to enable Hermes engine for a Windows application. ### Windows Hermes debugging To debug React Native for Windows applications, you can use below configure in `launch.json`: ```json { "name": "Debug Windows Hermes", "cwd": "${workspaceFolder}", "type": "reactnativedirect", "request": "launch", "platform": "windows" } ``` Also you can attach running application using `Attach to Hermes application` configuration to `.vscode/launch.json` in your project. ## React Native for MacOS Please make sure that your development environment is configured properly in accordance with [the official system requirements](https://microsoft.github.io/react-native-windows/docs/rnm-dependencies). And follow [the official guide](https://microsoft.github.io/react-native-windows/docs/hermes#available-on-macos) to enable Hermes engine for a macOS application. ### MacOS Hermes debugging To debug a macOS Hermes application you can use `Debug macOS Hermes` debugging scenario: ```json { "name": "Debug macOS Hermes", "request": "launch", "type": "reactnativedirect", "cwd": "${workspaceFolder}", "platform": "macos" } ``` Also you can attach running application using `Attach to Hermes application` configuration to `.vscode/launch.json` in your project. ## Monorepo: debug out of React Native project directory If you're using monorepo like: ``` monorepo/ ├── apps/ │ ├── app1/ │ │ └── src/ │ └── app2/ │ └── src/ ├── packages/ │ ├── ui/ │ │ └── src/ │ └── common/ │ └── src/ │ └── utils.ts └── package.json ``` When you import `utils.ts` in your project. Using ```js import { commonFunction } from "../../packages/common/src/utils"; ``` Will get error when start Metro: ``` error: bundling failed: Error: Unable to resolve module `../../packages/common/src/utils` from `src/App.js` ``` To debug your code in monorepo, please follow below steps: 1. In `metro.config.js`, add extra module and watch folder. ```js const extraNodeModules = { common: path.resolve(__dirname + "/../packages/common/src"), }; const watchFolders = [path.resolve(__dirname + "/../packages/common/src")]; const config = { resolver: { extraNodeModules, }, watchFolders, }; ``` 2. Import function in application. ```js import { functionInUtils } from "common/utils"; ``` or ```js import { functionInUtils } from "../../packages/common/src/utils"; ``` 3. Set source map override config in `launch.json`. Example: ```json /* Get source map url from vscode debug diagnostics tab */ "sourceMapPathOverrides": { "/[metro-watchFolders]/1/*": "/Monorepo-Project-Full-Path/*", } ``` 4. Launch app and attach debugger ## Debugger configuration properties The following is a list of all the configuration properties the debugger accepts in `launch.json`: | Name | Description | Type | Defaults | | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | --------------------------------------------- | | `cwd` | The path to the project root folder | `string` | `${workspaceFolder}` | | `sourceMaps` | Whether to use JavaScript source maps to map the generated bundled code back to its original sources | `boolean` | `true` | | `sourceMapPathOverrides` | A set of mappings for rewriting the locations of source files from what the source map says, to their locations on disk. See [Sourcemaps](#sourcemaps) for details | `object` | n/a | | `sourceMapRenames` | Whether to use the "names" mapping in sourcemaps. This requires requesting source content, which could slow debugging | `boolean` | `false` | | `enableDebug` | Whether to enable debug mode. If set to "false", an application will be launched without debugging | `boolean` | `true` | | `webkitRangeMin`, `webkitRangeMax` | Combines to specify the port range that you want the [ios-webkit-debug-proxy](https://github.com/google/ios-webkit-debug-proxy) to use to find the specific device described in the Direct iOS debug configuration | 9223, 9322 | | `trace` | Logging level in debugger process. May be useful for diagnostics. If set to "Trace" all debugger process logs will be available in `Debug Console` output window | `string` | `log` | | `address` | TCP/IP address of packager to attach to for debugging | `string` | `localhost` | | `port` | Port of packager to attach to for debugging | `string` | `8081` | | `remoteRoot` | The source root of the remote host | `string` | `null` | | `localRoot` | The local source root that corresponds to the 'remoteRoot' | `string` | `${workspaceFolder}` | | `skipFiles` | An array of file or folder names, or glob patterns, to skip when debugging | `array` | `[]` | | `debuggerWorkerUrlPath` | Path to the app debugger worker to override. For example, if debugger tries to attach to http://localhost:8081/debugger-ui/debuggerWorker.js and you get 404 error from packager output then you may want to change debuggerWorkerUrlPath to another value suitable for your packager (\"debugger-ui\" will be replaced with the value you provide) | `string` | `debugger-ui/` | | `platform` | The platform to target. Possible values: `android`, `ios`, `exponent`, `windows` | `string` | n/a | | `target` | Target to run on. Possible values: `simulator`, `device`, `<iOS target name/udid>`, [`<Android target id>`](https://github.com/react-native-community/cli/blob/master/docs/commands.md#--deviceid-string), `<Android emulator AVD name>`. If the value is `simulator` or `device` then the quick pick window will be expanded with the names of the available virtual or physical targets, then, in case there are more than one available target with specified type, the target value in `launch.json` will be changed to the name or id of the selected target. If you have only one target with specified type available, it will be selected automatically. If you're using Android emulator targets, please, make sure the `emulator` utility is added to `PATH` | `string` | `simulator` | | `logCatArguments` | Arguments to be used for LogCat (The LogCat output will appear on an Output Channel). It can be an array such as: `[":S", "ReactNative:V", "ReactNativeJS:V"]` | `array` | `["*:S", "ReactNative:V", "ReactNativeJS:V"]` | | `runArguments` | Run arguments to be passed to `react-native run-<platform>` command (override all other configuration params) | `array` | n/a | | `launchActivity` | The Android activity to be launched for debugging, e.g. it specifies [`--main-activity`](https://github.com/react-native-community/cli/blob/master/docs/commands.md#--main-activity-string) parameter in `react-native` run arguments | `string` | `MainActivity` | | `expoHostType` | The connection type to be used on Expo debugging to communicate with a device or an emulator. Possible values: <ul><li>`tunnel` - allows to deploy and debug an application by means of Expo cloud services</li><li>`lan` - allows to deploy and install an application via your LAN</li><li>`local` - allows to debug an application on an emulator or an Android device without network connection</li></ul> | `string` | `lan` | | `env` | Environment variables passed to the debugger and `react-native run-<platform>` command | `object` | `{}` | | `envFile` | Absolute path to a file containing environment variable definitions | `string` | `${workspaceFolder}/.env` | | `variant` | A variant to be passed to `react-native run-android`, e.g. use `devDebug` to specify `--variant=devDebug` | `string` | n/a | | `scheme` | A scheme name to be passed to `react-native run-ios`, e.g. `devDebug` to specify `--scheme=devDebug` | `string` | n/a | | `productName` | iOS bundle display name e.g. `AwesomeProject` value means that the extension will search for `AwesomeProject.app` bundle | `string` | n/a | | `jsDebugTrace` | Enable trace collection for depended extension `vscode-js-debug` | `boolean` | n/a | ## Re.Pack and Haul debugging [Re.Pack](https://github.com/callstack/repack): A modern bundler for React Native applications, powered by Rspack and Webpack. [Haul](https://github.com/callstack/haul): A command line tool for developing React Native apps. Legacy tools, recommend using Re.Pack. Both Re.Pack and Haul can use `Attach` request to attach to a react-native based app and debug it. Add config in `launch.json` file as below, make sure adding `sourceMapPathOverrides` argument to update source map for your application webpack. For example: ```json { "name": "Attach to Hermes application", "request": "attach", "type": "reactnativedirect", "cwd": "${workspaceFolder}", "sourceMapPathOverrides": { "webpack:///./~/*": "${workspaceRoot}/node_modules/*", "webpack:///./*": "${workspaceRoot}/*", "webpack:///*": "*" } } ``` ## Remote JavaScript Debugging (Deprecated) Remote JavaScript debugging is deprecated by react-native team from [0.73](https://reactnative.dev/docs/0.75/other-debugging-methods#remote-javascript-debugging-deprecated) and may be removed officially at any time. **We strongly recommend to use [Hermes engine and direct debugging](#hermes-engine-and-direct-debugging-recommended) in your application.** Below config showed classic debug mode in extension. With the version update of react-native, some features of Remote JavaScript Debugging may become unavailable, we will remove it from extension in the future if it's totally removed officially. ```json { "name": "Debug Android", "request": "launch", "type": "reactnative", "cwd": "${workspaceFolder}", "platform": "android" } ``` # Customization The extension can be further customized for other React Native scenarios. These are the most common: ## Sourcemaps The debugger uses sourcemaps to let you debug with your original sources, but sometimes the sourcemaps aren't generated properly and overrides are needed. In the config we support `sourceMapPathOverrides`, a mapping of source paths from the sourcemap, to the locations of these sources on disk. Useful when the sourcemap isn't accurate or can't be fixed in the build process. The left hand side of the mapping is a pattern that can contain a wildcard, and will be tested against the `sourceRoot` + `sources` entry in the source map. If it matches, the source file will be resolved to the path on the right hand side, which should be an absolute path to the source file on disk. Below there are some examples of how sourcemaps could be resolved in different scenarios: ```json // webRoot = /Users/me/project "sourceMapPathOverrides": { "webpack:///./~/*": "${webRoot}/node_modules/*", // Example: "webpack:///./~/querystring/index.js" -> "/Users/me/project/node_modules/querystring/index.js" "webpack:///./*": "${webRoot}/*", // Example: "webpack:///./src/app.js" -> "/Users/me/project/src/app.js", "webpack:///*": "*", // Example: "webpack:///project/app.ts" -> "/project/app.ts" "webpack:///src/*": "${webRoot}/*" // Example: "webpack:///src/app.js" -> "/Users/me/project/app.js" } ``` ## Debug in vscode workspace Extension supports vscode multiple root workspace for development. If you have several react-native project in workspace, extension will show project selection list when react-native packager is starting. Also you can add settings in workspace to ignore specific project in selection list. - Open vscode command palette, select `Preferences: Open Workspace Settings (JSON)` to open workspace settings file. - Add below settings in the file: ```json "settings": { "react-native.workspace.exclude": [ "ProjectFolderName1", "ProjectFolderName2" ] } ``` - Since the folder selection list is handled by vscode rather than extension, we must set exclude folder when extension is not activated. If you add exclude folder after extension activating, you must re-activate you extension or reopen your vscode. ## Logging The extension logging is divided by several output channels: - React Native - the main extension channel which collects outputs from React Native Packager and shows critical errors in the extension - These channels are spawned only when the specific launch scenario is executed: - React Native: Run Android - LogCat monitor(to get LogCat output from Android device, can be filtered by debug configuration settings) - React Native: Run iOS - React Native: Run macOS - React Native: Run Windows - React Native: Run exponent - Debug Console which is used to receive application logs and logs generated by the debug adapter (`console.log` and other `std` outputs from the app) - Extension debugger verbose logs (these logs are shown up only if the `trace: "verbose"` option is enabled in debug scenarios) - React Native Chrome Proxy - shows what runs in and out to the debugger and application - Debug Console becomes more informative and contains some debugging information from the debug adapter - Global extension errors are controlled by VS Code and printed in VS Code Developer Tools There are also some global extension technical logs that might be exposed to the output. To see them set the following properties in your VS Code Settings: ```json { "react-native-tools": { "logLevel": "Trace" } } ``` `logLevel` can be `None` (no logs), `Error`, `Warning`, `Info`, `Debug`, `Trace` (all logs). Default is `Info`. ## Build APK and generate bundle You can add VSCode tasks to build an `.apk` file and generate iOS/Android bundles. The following is an example of a `tasks.json` for `react-native init` projects. Place it in the `.vscode` folder in your project to use it: ```json { "version": "2.0.0", "presentation": { "reveal": "always", "panel": "new" }, "tasks": [ { "label": "Build APK Debug", "group": "build", "type": "shell", "windows": { "command": "cd android; if($?) {./gradlew assembleDebug}" }, "linux": { "command": "cd android && ./gradlew assembleDebug" } }, { "label": "Build APK Release", "group": "build", "type": "shell", "windows": { "command": "cd android; if($?) {./gradlew assembleRelease}" }, "linux": { "command": "cd android && ./gradlew assembleRelease" } }, { "label": "Generate Android Bundle", "group": "build", "type": "shell", "command": "npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/main.jsbundle" }, { "label": "Generate iOS Bundle", "group": "build", "type": "shell", "command": "npx react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/main.jsbundle" } ] } ``` To learn more about `tasks` in VSCode read [the official documentation](https://code.visualstudio.com/docs/editor/tasks). Visit [generating Signed APK](https://reactnative.dev/docs/signed-apk-android) to learn more about this subject. ## Specifying custom arguments for `react-native run-*` command Using custom run arguments for `react-native run-<platform>`: **NOTE:** This overrides all other configuration parameters. ```json { "react-native.android.runArguments.simulator": [ "--appFolder", "/Users/test/AwesomeProject/android/app", "--deviceId", "emulator-5555" ], "react-native.ios.runArguments.device": [ "--project-path", "ios", "--device", "Max's iPhone" ] } ``` **NOTE:** You can get the list of installed simulator devices by: iOS devices (macOS only): ``` xcrun simctl list --json devices ``` Android devices: ``` adb devices ``` **NOTE:** If you want to run the application on an iOS device, make sure you have `ios-deploy` installed globally. `brew install ios-deploy` ## Setting up the React Native packager To use a custom port for the `react-native` packager: ```json { "react-native": { "packager": { "port": portNumber } } } ``` If you change this port, then for iOS device and simulator scenarios you will have to modify the native code files. [Instructions here](https://childofcode.com/react-native-0-63-running-on-device-by-other-port-solution/). If you use Android, you need to change the debug server by: 1. `CTRL+M`(`CMD+M`) in the emulator 2. Go to `Dev Settings` 3. Debug server host for device => enter `localhost:<yourPortNumber>`. 4. Reload application (press `R` twice) 5. (Hermes only) Hermes engine listens port 8081 for debugging by default, to change it you might need to modify your [`metro.config.js` file adding `"port": portNumber` argument in there to the server settings](https://facebook.github.io/metro/docs/configuration/#port). ```js // Example of metro.config.js (<= 0.72.0) module.exports = { server: { port: 9091, }, }; ``` OR ```js // Example of metro.config.js (0.72.0) const config = { server: { port: 9091, }, }; ``` <details> <summary>Port setup instruction</summary> ![image](resources/images/select-dev-menu.png) ![image](resources/images/dev-menu-setup-custom-host.png) ![image](resources/images/custom-host-and-port.png) </details> **NOTE:** Some aspects of React Native hard-code the port to the default as specified in [this issue](https://github.com/facebook/react-native/issues/9145). ### Custom environment variables Extension supports passing custom environment variables to the React Native Packager process context. To add custom variables you can create `.env` file in the root folder of your project and add needed environment variables in the following format: ``` Variable1_name=Variable1_value Variable2_name=Variable2_value ``` Variables that are declared in this `.env` file can override the original environment variables from `process.env` of the Packager process. It is possible to transfer environment variables (via `env` and `envFile` arguments in `launch.json`) from the `launch` or `attach` debug scenarios to the Packager. If these variables are defined, then they will be used, otherwise the `.env` file is used. ## Change project root To specify a subfolder in which the react-native project is located, set `react-native-tools.projectRoot`. You can use either an absolute or relative path in your VS Code Settings: ```json { "react-native-tools": { "projectRoot": "./your/react-native/project" } } ``` ## Configure an Android LogCat Monitor There are two ways to filter your LogCat Monitor output depending on how LogCat Monitor was launched: 1. Since LogCat Monitor is launched for all Android launch scenarios by default, you can add `logCatArguments` to your debug scenario in `launch.json` file like in the following example: ```json { "name": "Debug Android Hermes", "cwd": "${workspaceFolder}", "type": "reactnativedirect", "request": "launch", "platform": "android", "logCatArguments": ["ReactNativeJS:V"] } ``` 2. If you want to launch LogCat Monitor from the Command Palette command `React Native: Run React Native LogCat Monitor` with filtering options set `react-native.android.logCatArguments` settings in your `settings.json`: ```json { "react-native.android.logCatArguments": [ "*:S", "ReactNative:V", "ReactNativeJS:V" ] } ``` To have better understanding on how LogCat filtering works take into account that the extension launches LogCat with flag `-s` and then adds user-provided filters as arguments. Please see the [official instruction on how does LogCat filtering works](https://developer.android.com/studio/command-line/logcat#filteringOutput). ## Configure dependencies versions for debugging Expo projects To debug Expo applications the extension requires additional dependencies, such as `xdl` and `@expo/metro-config`. These packages are installed automatically on the first start of the Expo debugging scenario. You can configure the dependencies versions by adding the `react-native.expo.dependencies` parameter, which contains packages names and appropriate versions, to the `settings.json` file: ```json { "react-native.expo.dependencies": { "xdl": "59.2.0", "@expo/metro-config": "0.2.0", "@expo/ngrok": "^4.1.0" } } ``` To enable new versions of the dependencies, it's required to restart VS Code editor. After that the extension will download the new versions of the packages on the next Expo debugging starting. ## Security dependency overrides Recent repository updates include a security pin for `serialize-javascript` via npm `overrides`. If you maintain a fork or run local dependency audits, align your `package.json` with the following: ```json { "overrides": { "js-yaml": "4.1.1", "serialize-javascript": "7.0.5" } } ``` After updating `package.json`, run your package manager install command to refresh the lock file. ## Configure custom key bindings for extension commands The extension provides context variables for the following features: |Context variable|Feature| |---|---| |`isRNPackagerRunning` - true if the packager is running|Metro packager| |`isRNTNetworkInspectorRunning` - true if the Network inspector is running|Network inspector| Using these context variables you can assign the same keyboard combination for some pair commands for more convenient use. For example, you can configure the same key bindings for `Start Packager` and `Stop Packager` commands using `when` clauses, as shown below: ![image](resources/images/custom-keybindings.png) ## Configure custom colors for extension output logs The extension provides custom TextMate tokens, with the help of which it is now possible to customize the colors of the logs in output channels: |Scope|Description| |---|---| |`rnt.output.string`|Single and double quoted strings| |`rnt.output.url`|Links, email and ip address, filepaths| |`rnt.output.timestamp`|Date and time| |`rnt.output.numeric`|Constant decimal numbers| |`rnt.output.process`|Logs of processes such as npm, bundle, and other build tasks| |`rnt.output.error`|Errors, exceptions, fails and stack for them| |`rnt.output.warn`|Warning logs| |`rnt.output.info`|Info logs| |`rnt.output.debug`|Debug logs| |`rnt.output.verbose`|Verbose logs| |`rnt.output.constant`|Such values as `true`, `false`, `null`, `undefined`, `NaN`| |`rnt.output.success`|Logs indicating successful completion of the process, such as `BUILD SUCCESSFUL` and others| Now you can customize React Native Tools output logs with `editor.tokenColorCustomizations` parameter in `settings.json` this way: ```json "editor.tokenColorCustomizations": { "textMateRules": [ { "settings": { "foreground": "#c57ca0", "fontStyle": "bold", }, "scope": "rnt.output.string" } ] } ``` ## Set pnpm as package manager If you want to use pnpm as your package manager, please set `react-native-tools.setPackageManager` settings in your `settings.json`: ```json { "react-native-tools.setPackageManager": "pnpm" } ``` # Network Inspector The extension provides `Network inspector` feature to inspect outgoing network traffic in your apps. You can browse all requests being made and their responses in VS Code DevTools console. ![image](resources/images/network-inspector.png) ### Network inspector requirements Before using the Network inspector, please make sure that your system meets the following requirements: - `OpenSSL` utility is installed and added to PATH. You can install `OpenSSL` the following way: - Windows: `choco install openssl` - macOS: `brew install openssl` - Linux: `sudo apt-get install openssl` - (macOS only) [`idb`](https://fbidb.io/docs/installation/) utility is installed. It's required to interact with iOS physical devices The Network inspector uses functional of the Flipper plugin integrated to React Native apps. Please make sure that it's enabled in your application. You can use [this guide](https://fbflipper.com/docs/getting-started/react-native/) to integrate Flipper into your projects. ### Network inspector usage - To run the Network inspector you can use `Run Network Inspector` Command Palette command</br> When the Network inspector detects a React Native application and connects to it, VS Code DevTools window will be opened automatically. But you can also open it manually, by opening `Help` menu and clicking `Toggle Developer Tools` option. After that you just need to open `Console` tab in DevTools, where network requests will be printed. - To stop the Network inspector you can use `Stop Network Inspector` Command Palette command For now the Network inspector doesn't support Expo applications. ### Network inspector logs theme The extension provides “Dark” and “Light” color themes for Network Inspector logs. You can configure the theme in the extension configuration in your VS Code Settings. ```json { "react-native-tools.networkInspector.consoleLogsColorTheme": "Dark" } ``` # Developing inside a Docker Container The extension supports [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview) features on Linux. Please follow the [VS Code official documentation](https://code.visualstudio.com/docs/devcontainers/containers) to setup your environment and install related extensions([Remote Development](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) is recommended) to use a remote development approach. You can use [official React Native Docker image](https://hub.docker.com/r/reactnativecommunity/react-native-android) provided by the [react-native-community](https://github.com/react-native-community/docker-android). Here are the steps to run React Native debugging inside a Docker Container on a real Android device: 1. In the local react-native project, add `Dev Container` configure folder and files: ``` .devcontainer -devcontainer.json -Dockerfile ``` 2. Create Dockerfile extending [reactnativecommunity/react-native-android image](https://hub.docker.com/r/reactnativecommunity/react-native-android). For example you can use the following Dockerfile: ``` FROM reactnativecommunity/react-native-android:latest RUN npm install -g expo-cli react-native-cli ``` 3. Configure your `devcontainer.json` file as needed. Below is a sample configuration: ```json { "name": "React Native Android Container", // Sets the run context to one level up instead of the .devcontainer folder. "context": "..", // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. "dockerFile": "Dockerfile", // The optional 'runArgs' property can be used to specify additional runtime arguments. "runArgs": [ "--privileged", // give all capabilities to a container, in other words, the container can then do almost everything that the host can do "--net", "host", // forwarding all host machine ports "-v", "/dev/bus/usb:/dev/bus/usb" // mount connected USB devices to a container ], "customizations": { "vscode": { "settings": { // This will ignore your local shell user setting for Linux since shells like zsh are typically // not in base container images. You can also update this to an specific shell to ensure VS Code // uses the right one for terminals and tasks. For example, /bin/bash (or /bin/ash for Alpine). "terminal.integrated.shell.linux": null }, // Add the IDs of extensions you want installed when the container is created in the array below. "extensions": ["msjsdiag.vscode-react-native"] } } } ``` 4. Open Command Palette and run the following command `Dev Containers: Open Folder in Container` to reopen your project in a container 5. Connect your device via USB and start debugging the same way as on local machine. Currently the above scenario doesn't work on macOS and Windows. Docker Container implementation on these OS uses Virtual Machine tools which may have problems with USB forwarding for mobile devices. # Contributing Please see our [contributing guide](CONTRIBUTING.md) for more information. # Known Issues Here is the list of common known issues you may experience while using the extension: | Issue | Description | | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Debugger doesn't stop at breakpoints | Breakpoints require sourcemaps to be correctly configured. If you are using TypeScript, then make sure to follow the `Getting started` section for how to ensure sourcemaps are correctly set up. Also, similar issues may occur on React Native version `0.58.*` in some special cases (see [#928](https://github.com/microsoft/vscode-react-native/issues/928), [#907](https://github.com/microsoft/vscode-react-native/issues/907)), bumping dependencies versions of `react` and `react-native` package to the more recent ones should resolve these. If you are on Linux, make sure that the project folder which is opened is not a symbolic link to the real folder, that might cause problems with sourcemaps (see [#1456](https://github.com/microsoft/vscode-react-native/issues/1456)) | | 'adb: command not found' | If you receive an error `adb: command not found`, you need to update your system Path to include the location of your _ADB_ executable.The _ADB_ executable file is located in a subdirectory along with your other Android SDK files. | | Can't communicate with socket pipe | (Linux only) If you have two workspaces open that only differ in casing, the extension will fail to communicate effectively. | | "Add configuration" button doesn't work when trying to add debug configuration to `launch.json` | You have to add some json configuration to `launch.json` manually. Please, see ([#985](https://github.com/microsoft/vscode-react-native/issues/985)). | | Error `None of these files exist: * .vscode/exponentIndex` appears when running React Native apps via Expo | On some project configurations (mostly on macOS) there could be problems with running RN app via Expo for the first time. You can resolve this by explicitly adding `module.exports.watchFolders = ['.vscode'];` to your Metro config. This will help Metro bundler to find the custom entry point generated by the extension needed to work with Expo. For details you can see the issue ([#1327](https://github.com/microsoft/vscode-react-native/issues/1327)). | | High CPU load notification while starting debugging Expo app | When you start debugging the Expo application you may receive the notification `"The extension 'React Native Tools' took a very long time to complete its last operation and it has prevented other extensions from running"`. The issue occurs because of importing the `xdl` package, which extension uses for debugging Expo applications. The `xdl` package has the large size and some peculiarities of its structure, so it may cause high CPU load. | [Known-Issues](https://github.com/microsoft/vscode-react-native/issues?q=is%3Aissue+label%3Aknown-issues) provides a complete list of active and resolved issues. # Telemetry reporting VS Code React Native extension collects usage data and sends it to Microsoft to help improve our products and services. Read our [privacy statement](https://www.visualstudio.com/en-us/dn948229) to learn more. If you don’t wish to send usage data to Microsoft: create and add `VSCodeTelemetrySettings.json` file at `~/.vscode-react-native` and add `optIn:false`. Or add `react-native-tools.telemetry.optIn: false` in `~/.vscode/settings.json` file. # Code of conduct 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.

Mobile Development Code Editors & IDEs
2.7K Github Stars
rnx-kit
Open Source

rnx-kit

# `rnx-kit` - React Native tooling by and for developers [![Open in Visual Studio Code](https://img.shields.io/static/v1?logo=visualstudiocode&label=&message=Open%20in%20Visual%20Studio%20Code&color=007acc&labelColor=444444&logoColor=007acc)](https://vscode.dev/github/microsoft/rnx-kit) [![Build](https://github.com/microsoft/rnx-kit/actions/workflows/build.yml/badge.svg)](https://github.com/microsoft/rnx-kit/actions/workflows/build.yml) `rnx-kit` is a collection of battle-tested tools created by Microsoft engineers to optimize the React Native developer experience. It helps fill gaps in the React Native ecosystem and streamlines the developer workflow. These tools are actively used every day to ship React Native apps at scale across Microsoft; now they're open source and available for any React Native project. ## What's included `rnx-kit` includes tools for: - Dependency management - Ensure consistent dependency versions across large projects with `align-deps`. - Native builds (experimental) - Build Android and iOS apps in the cloud with `build`. Avoid installing heavy native toolchains. - Better bundling - `metro-serializer` allows the enhancement of Metro to add features such as TypeScript validation with Metro, tree shaking, duplicate and cyclic dependencies detection. - Microsoft-tailored defaults - you can find Babel preset for Metro opinionated for Microsoft usage. And many more! ## Get started Please follow [Introduction guide](https://microsoft.github.io/rnx-kit/docs/introduction) on the documentation website to learn about how you can quickly add the "all in one" CLI to your project and get most of the tools set out of the box. Or follow the [Getting started guide](https://microsoft.github.io/rnx-kit/docs/guides/getting-started) for an easy introduction to our dependency management tool. If you want to use only a specific tool, you can refer to its `README` for details; they are all easily readable in the [Tools section](https://microsoft.github.io/rnx-kit/docs/tools/overview) of the documentation. ## Contributing `rnx-kit` is built for the community, by the community - and maintained by Microsoft engineers. Your contributions are welcome! Take a look at [CONTRIBUTING](https://github.com/microsoft/rnx-kit/tree/main/CONTRIBUTING.md) for details. If you are interested in proposing "substantial" changes, please refer to our [RFC process](https://github.com/microsoft/rnx-kit/tree/rfcs). ## License [MIT License](LICENSE) ## Code of Conduct 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.

Developer Tools Mobile Development
1.7K Github Stars
fast
Open Source

fast

# FAST [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](https://www.typescriptlang.org/) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-f8bc45.svg)](https://github.com/prettier/prettier) [![Validate PRs](https://github.com/microsoft/fast/actions/workflows/ci-validate-pr.yml/badge.svg)](https://github.com/microsoft/fast/actions/workflows/ci-validate-pr.yml) [![Validate Platforms/Browsers](https://github.com/microsoft/fast/actions/workflows/ci-validate-platforms.yml/badge.svg)](https://github.com/microsoft/fast/actions/workflows/ci-validate-platforms.yml) [![Discord](https://img.shields.io/badge/chat%20on-discord-7289da.svg)](https://discord.gg/FcSNfg4) [![Twitter](https://img.shields.io/twitter/follow/fast_ui.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=fast_ui) :star: We appreciate your star, it helps! ## Introduction FAST is dedicated to providing support for native Web Components and modern Web Standards, and it's designed to help you efficiently tackle some of the most common challenges in website and application design and development. **TL;DR** * Create reusable UI components with `@microsoft/fast-element`, all based on W3C Web Component standards. * Integrate FAST Web Components with any library, framework, or build system. You can adopt incrementally without re-writing your existing systems. For an in-depth explanation of FAST [see our docs introduction](https://fast.design/docs/2.x/introduction/). ## Packages ### `@microsoft/fast-element` [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/%40microsoft%2Ffast-element.svg)](https://badge.fury.io/js/%40microsoft%2Ffast-element) The `@microsoft/fast-element` library is a lightweight means to easily build performant, memory-efficient, standards-compliant Web Components. FAST Elements work in every major browser and can be used in combination with any front-end framework or even without a framework. To get up and running with `@microsoft/fast-element` see [the Getting Started guide](https://fast.design/docs/2.x/getting-started/quick-start/). ### `@fluentui/web-components` [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/%40fluentui%2Fweb-components.svg)](https://badge.fury.io/js/%40fluentui%2Fweb-components) `@fluentui/web-components` is a library of Web Components based on the Fluent design language, built with `@microsoft/fast-element`. The source for `@fluentui/web-components` is hosted in [the Fluent UI monorepo](https://github.com/microsoft/fluentui/tree/master/packages/web-components). ## Getting Started We hope you're excited by the possibilities that FAST presents. But, you may be wondering where to start. Here are a few statements that describe various members of our community. We recommend that you pick the statement you most identify with and follow the links where they lead. You can always come back and explore another topic at any time. * "I just want ready-made components!" * [Check out the FluentUI Web Components.](https://learn.microsoft.com/en-us/fluent-ui/web-components/) * "I want to build my own components." * [Jump to the fast-element docs.](https://fast.design/docs/2.x/getting-started/quick-start/) * "I need to integrate FAST with another framework or build system." * [Jump to the integration docs.](https://fast.design/docs/2.x/integrations/) * "I want to look at a quick reference." * [Jump to the Cheat Sheet](https://fast.design/docs/1.x/resources/cheat-sheet) *(only available in 1.x)* ## Roadmap Major features for the FAST project can be found in the [roadmap](https://github.com/orgs/microsoft/projects/240/views/1). ## Joining the Community Looking to get answers to questions or engage with us in realtime? Our community is most active [on Discord](https://discord.gg/FcSNfg4). Submit requests and issues on [GitHub](https://github.com/Microsoft/fast/issues/new/choose), or join us by contributing on [some good first issues via GitHub](https://github.com/Microsoft/fast/labels/community:good-first-issue). Get started here with the [Contributor Guide](https://www.fast.design/docs/community/contributor-guide). We look forward to building an amazing open source community with you! ## Contact * Join the community and chat with us in real-time on [Discord](https://discord.gg/FcSNfg4). * Submit requests and issues on [GitHub](https://github.com/Microsoft/fast/issues/new/choose). * Contribute by helping out on some of our recommended first issues on [GitHub](https://github.com/Microsoft/fast/labels/community:good-first-issue).

CSS Frameworks & UI Kits
9.7K Github Stars
fluentui-blazor
Open Source

fluentui-blazor

# Microsoft Fluent UI Blazor library [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![.NET C#](https://img.shields.io/badge/.NET-C%23-blue)](https://docs.microsoft.com/en-us/dotnet/csharp/) [![NuGet](https://img.shields.io/nuget/v/Microsoft.FluentUI.AspNetCore.Components?label=NuGet%20Component%20Library)](https://www.nuget.org/packages/Microsoft.FluentUI.AspNetCore.Components) [![NuGet](https://img.shields.io/nuget/v/Microsoft.FluentUI.AspNetCore.Templates?label=NuGet%20Templates)](https://www.nuget.org/packages/Microsoft.FluentUI.AspNetCore.Templates) [![Discord](https://img.shields.io/badge/chat%20on-discord-7289da.svg)](https://discord.gg/M5cBTfp6J2) <!-- [![Validate Security](https://github.com/microsoft/fluentui-blazor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/microsoft/fluentui-blazor/actions/workflows/codeql-analysis.yml) --> > ## Reporting an issue? > Please supply us with **ready-to-run** reproduction code in the form of something we can copy/paste, a (zipped) project structure or a GitHub repository. > > We do not have capacity to craft or compose a reproduction for every issue that gets raised. > > If no code or repository is provided, the issues will be closed after 3 days. > > Help us to help you. Thanks. > > With 💖, the Fluent UI crew. ## Demo Explore the Demo: visit https://www.fluentui-blazor.net to kickstart your first project, browse the documentation, and test all components live. If you encounter any problems, you can use the [backup site](https://fluentui-blazor.azurewebsites.net). --- :star: We appreciate your star, it helps! This package is for use in .NET 8 and 9 Blazor projects. If you are using **now unsupported** .NET 6 or 7, please use the v3 version of the packages (names starting with `Microsoft.Fast.Components.FluentUI`) ## Introduction The `Microsoft.FluentUI.AspNetCore.*` family of packages provides a set of Razor components for building [Blazor](https://blazor.net) applications that leverage the Fluent Design System (i.e. have the look and feel of modern Microsoft applications). Some of the components in the library are wrappers around Microsoft's official Fluent UI Web Components. Others are components that leverage the Fluent Design System or make it easier to work with Fluent. To get up and running with the library, see the **Getting Started** section below. The source for the library is hosted in the [fluentui-blazor](https://github.com/microsoft/fluentui-blazor) repository at GitHub. Documentation on the components is available at the [demo site](https://www.fluentui-blazor.net). ## Upgrading from an earlier version If you are upgrading from an earlier version of the library, please see the [what's new](https://www.fluentui-blazor.net/whatsnew) for information on (breaking) changes. ## Getting Started ### Using our dotnet templates The easiest way to get started is by using our [Templates](https://www.nuget.org/packages/Microsoft.FluentUI.AspNetCore.Templates). These mimic the regular Blazor templates and come with the design and components pre-configured. You install them with this command: ```shell dotnet new install Microsoft.FluentUI.AspNetCore.Templates ``` Navigate to a folder where you want to create your new project and run the following command to create a new project. ```shell dotnet new fluentblazor --name MyApplication ``` If you want to create a new standalone WebAssembly project, you can use the following command: ```shell dotnet new fluentblazorwasm --name MyApplication ``` Other available templates are: - Fluent .NET Aspire Starter App (fluentaspire-starter) - Fluent .NET MAUI Blazor Hybrid and Web App (fluentmaui-blazor-web) When using Visual Studio, you can also use the **New Project** dialog to create a new project. The templates can be found by typine **Fluent** in the search field. ### Manual Install To start using the Fluent UI Blazor library from scratch, you first need to install the main [NuGet package](https://www.nuget.org/packages/Microsoft.FluentUI.AspNetCore.Components/) in the project you want to use the library and its components. You can use the NuGet package manager in your IDE or use the following command when using a CLI: ```shell dotnet add package Microsoft.FluentUI.AspNetCore.Components ``` If you want to extend the functionality of the library with [icons](https://www.nuget.org/packages/Microsoft.FluentUI.AspNetCore.Components.Icons) or [emoji](https://www.nuget.org/packages/Microsoft.FluentUI.AspNetCore.Components.Emoji), you can install additional packages for that: ```shell dotnet add package Microsoft.FluentUI.AspNetCore.Components.Icons dotnet add package Microsoft.FluentUI.AspNetCore.Components.Emoji ``` ### Script As mentioned, we wrap the **Fluent UI Web Components** which are implemented in a script file. This **file is included in the library** itself and does not have to be downloaded or pulled from a CDN. > By including the script in the library we can safeguard that you are always using the best matching script version. Even when using **SSR (Static Server Rendering)**, the script will be included and loaded automatically. If you want the script to be loaded before Blazor starts, add it to your `App.razor` file like this: ```html <script src="_content/Microsoft.FluentUI.AspNetCore.Components/Microsoft.FluentUI.AspNetCore.Components.lib.module.js" type="module" async></script> ``` If you add interactivity later, the Blazor script will kick in and try to load the web component script again but JavaScript will handle that gracefully by design. ### Reboot (optional) **Reboot** is a collection of element-specific CSS changes in a single file to help kick-start building a site with the **Fluent UI Blazor** components. It provides an elegant, consistent, and simple baseline to build upon. If you want to use **Reboot**, you'll need to add to your `app.razor`, `index.html` or `_Layout.cshtml` file a line that includes the stylesheet (`.css` file). This can be done by adding the following line to the `<head>` section: ```html <link href="/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css" rel="stylesheet" /> ``` When using the templates to create your application, **Reboot** is already set-up for you. _When creating a site that is hosted in a different base path,it might be necessary to remove the leading '/' from the stylesheet link._ ### Register Services Add the following in `Program.cs` ```csharp builder.Services.AddFluentUIComponents(); ``` If you're running your application on **Blazor Server**, make sure a default `HttpClient` is registered before the `AddFluentUIComponents` method. ```csharp builder.Services.AddHttpClient(); ``` ### Add Component Providers Add the following components at the end of your `MainLayout.razor` file. These providers are used by associated services to display Toasts, Dialog boxes, Tooltips or Message Bars correctly. ```xml <FluentToastProvider /> <FluentDialogProvider /> <FluentTooltipProvider /> <FluentMessageBarProvider /> <FluentMenuProvider /> ``` > **note:** You can remove providers which you are not using in your application. ## Working with Icons and Emoji We have additional packages available that include the complete Fluent UI System icons and Fluent UI Emoji collections. Please refer to the [Icons and Emoji](https://www.fluentui-blazor.net/IconsAndEmoji) page for more information. ## Usage With the package installed, you can begin using the Fluent UI Blazor library components in the same way as any other Razor component. ### Add Imports After the package is added, you need to add the following in your `_Imports.razor` ```razor @using Microsoft.FluentUI.AspNetCore.Components ``` ### Quick Start This is literally all you need in your views to use Fluent UI Blazor library in your application. ```xml <FluentCard> <h2>Hello World!</h2> <FluentButton Appearance="@Appearance.Accent">Click Me</FluentButton> </FluentCard> ``` ## Configuring the Design System The Fluent UI Razor components are built on FAST's (Adaptive UI) technology, which enables design customization and personalization, while automatically maintaining accessibility. This is accomplished through setting various "design tokens". The library exposes all design tokens, which you can use both from code as in a declarative way in your `.razor` pages. The different ways of working with design tokens are described in the [design tokens](https://www.fluentui-blazor.net/DesignTokens) page. ## Blazor Hybrid You can use this library in **Blazor Hybrid** (MAUI/WPF/Windows Forms) projects. Setup is almost the same as described in the "Getting started" section above, but to get everything to work you'll need to take one extra steps (for now) described below. ### Temporary workaround for MAUI/WPF/Windows Forms issues > [!NOTE] > The workaround below only applies to .NET 8. As of .NET 9 this workaround is no longer needed. If you have this workaround in place for .NET 9 your Blazor Hybrid project **will not load**. Currently when using the WebView to run Blazor (so all Hybrid variants) the web-components script is not imported automatically (see [#404](https://github.com/microsoft/fluentui-blazor/issues/404)). There is also an issue with loading the custom event handlers that are being configured by the web-components script. Until these are fixed on the WebView side, there is a workaround available, namely to intercept `'_framework/blazor.modules.json'` and provide proper JS initializers file (created by build). The needed `initializersLoader.webview.js` has been added to the library and needs to be included with a script tag **before** the `_framework/blazor.webview.js` script tag: ```xml <script app-name="{NAME OF YOUR APP}" src="./_content/Microsoft.FluentUI.AspNetCore.Components/js/initializersLoader.webview.js"></script> <script src="_framework/blazor.webview.js"></script> ``` The `app-name` attribute needs to match your app's assembly name - initializersLoader uses 'app-name' to resolve name of the file with initializers. initializersLoader replaces standard `fetch` function with one which provides the correct file in place of the empty `blazor.modules.json`. `fetch` is restored to its original state once `_framework/blazor.modules.json` request is intercepted. For more information regarding the bug, see issue [15234](https://github.com/dotnet/maui/issues/15234) in the MAUI repo. ## Use the DataGrid component with EF Core or OData Client If you want to use the `<FluentDataGrid>` with data provided through EF Core or an OData Client, you need to install an additional package so the grid knows how to resolve queries asynchronously for efficiency. Please see the [DataGrid](https://www.fluentui-blazor.net/DataGrid) page for more information. ## Additional resources * The Microsoft Fluent UI Blazor library [documentation and demo site](https://www.fluentui-blazor.net) ## Support The Microsoft Fluent UI Blazor library is an open source project and is **not** an official part of ASP.NET Core, which means it’s **not** officially supported and isn’t committed to ship updates as part of any official .NET updates. It is built and maintained by Microsoft employees (**and** other contributors) and offers support, like most other open source projects, on a best effort base through the GitHub repository **only**. ## Contributing to the project We offer some guidelines on how you can get started [contributing to the project](https://github.com/microsoft/fluentui-blazor/blob/main/docs/contributing.md). We also have a document that explains and shows how to [write and develop unit tests](https://github.com/microsoft/fluentui-blazor/blob/main/docs/unit-tests.md) ### 🏆 Contributors <a href="https://github.com/microsoft/fluentui-blazor/graphs/contributors"> <img src="https://contrib.rocks/image?repo=microsoft/fluentui-blazor" /> </a> Made with [contrib.rocks](https://contrib.rocks). ## Joining the Community Looking to get answers to questions or engage with us in real-time? Our community is active on [Discord](https://discord.gg/FcSNfg4). Submit requests and issues on [GitHub](https://github.com/microsoft/fluentui-blazor/issues/new/choose), or join us by contributing on [some good first issues via GitHub](https://github.com/microsoft/fluentui-blazor/labels/community:good-first-issue). We look forward to building an amazing open source community with you! ## Contact * Join the DotNetEvolution server and chat with us in real-time on [Discord](https://discord.gg/M5cBTfp6J2). * Submit requests and issues (only) on [GitHub](https://github.com/microsoft/fluentui-blazor/issues/new/choose). * Contribute by helping out on some of our recommended first issues on [GitHub](https://github.com/microsoft/fluentui-blazor/labels/community:good-first-issue). .

CSS Frameworks & UI Kits
4.8K Github Stars
graphrag
Open Source

graphrag

# GraphRAG 👉 [Microsoft Research Blog Post](https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/)<br/> 👉 [Read the docs](https://microsoft.github.io/graphrag)<br/> 👉 [GraphRAG Arxiv](https://arxiv.org/pdf/2404.16130) <div align="left"> <a href="https://pypi.org/project/graphrag/"> <img alt="PyPI - Version" src="https://img.shields.io/pypi/v/graphrag"> </a> <a href="https://pypi.org/project/graphrag/"> <img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/graphrag"> </a> <a href="https://github.com/microsoft/graphrag/issues"> <img alt="GitHub Issues" src="https://img.shields.io/github/issues/microsoft/graphrag"> </a> <a href="https://github.com/microsoft/graphrag/discussions"> <img alt="GitHub Discussions" src="https://img.shields.io/github/discussions/microsoft/graphrag"> </a> </div> ## Overview The GraphRAG project is a data pipeline and transformation suite that is designed to extract meaningful, structured data from unstructured text using the power of LLMs. To learn more about GraphRAG and how it can be used to enhance your LLM's ability to reason about your private data, please visit the <a href="https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/" target="_blank">Microsoft Research Blog Post.</a> ## Quickstart To get started with the GraphRAG system we recommend trying the [command line quickstart](https://microsoft.github.io/graphrag/get_started/). ## Repository Guidance This repository presents a methodology for using knowledge graph memory structures to enhance LLM outputs. Please note that the provided code serves as a demonstration and is not an officially supported Microsoft offering. ⚠️ *Warning: GraphRAG indexing can be an expensive operation, please read all of the documentation to understand the process and costs involved, and start small.* ## Diving Deeper - To learn about our contribution guidelines, see [CONTRIBUTING.md](./CONTRIBUTING.md) - To start developing _GraphRAG_, see [DEVELOPING.md](./DEVELOPING.md) - Join the conversation and provide feedback in the [GitHub Discussions tab!](https://github.com/microsoft/graphrag/discussions) ## Prompt Tuning Using _GraphRAG_ with your data out of the box may not yield the best possible results. We strongly recommend to fine-tune your prompts following the [Prompt Tuning Guide](https://microsoft.github.io/graphrag/prompt_tuning/overview/) in our documentation. ## Versioning Please see the [breaking changes](./breaking-changes.md) document for notes on our approach to versioning the project. *Always run `graphrag init --root [path] --force` between minor version bumps to ensure you have the latest config format. Run the provided migration notebook between major version bumps if you want to avoid re-indexing prior datasets. Note that this will overwrite your configuration and prompts, so backup if necessary.* ## Responsible AI FAQ See [RAI_TRANSPARENCY.md](./RAI_TRANSPARENCY.md) - [What is GraphRAG?](./RAI_TRANSPARENCY.md#what-is-graphrag) - [What can GraphRAG do?](./RAI_TRANSPARENCY.md#what-can-graphrag-do) - [What are GraphRAG’s intended use(s)?](./RAI_TRANSPARENCY.md#what-are-graphrags-intended-uses) - [How was GraphRAG evaluated? What metrics are used to measure performance?](./RAI_TRANSPARENCY.md#how-was-graphrag-evaluated-what-metrics-are-used-to-measure-performance) - [What are the limitations of GraphRAG? How can users minimize the impact of GraphRAG’s limitations when using the system?](./RAI_TRANSPARENCY.md#what-are-the-limitations-of-graphrag-how-can-users-minimize-the-impact-of-graphrags-limitations-when-using-the-system) - [What operational factors and settings allow for effective and responsible use of GraphRAG?](./RAI_TRANSPARENCY.md#what-operational-factors-and-settings-allow-for-effective-and-responsible-use-of-graphrag) ## 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). 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. ## Privacy [Microsoft Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement)

ML Frameworks Knowledge Bases & RAG
33.6K Github Stars
semantic-kernel
Open Source

semantic-kernel

# Semantic Kernel > [!IMPORTANT] > Semantic Kernel is now [Microsoft Agent Framework](https://github.com/microsoft/agent-framework)! Microsoft Agent Framework (MAF) is the enterprise‑ready successor to Semantic Kernel. Microsoft Agent Framework is now available at version 1.0 as a production-ready release: stable APIs, and a commitment to long-term support. Whether you're building a single assistant or orchestrating a fleet of specialized agents, Microsoft Agent Framework 1.0 gives you enterprise-grade multi-agent orchestration, multi-provider model support, and cross-runtime interoperability via A2A and MCP. > > Learn more about Semantic Kernel and Agent Framework here: [Semantic Kernel and Microsoft Agent Framework on the Agent Framework blog](https://devblogs.microsoft.com/agent-framework/semantic-kernel-and-microsoft-agent-framework/), and try out the [Semantic Kernel migration guide](https://learn.microsoft.com/en-us/agent-framework/migration-guide/from-semantic-kernel). **Build intelligent AI agents and multi-agent systems with this enterprise-ready orchestration framework** [![License: MIT](https://img.shields.io/github/license/microsoft/semantic-kernel)](https://github.com/microsoft/semantic-kernel/blob/main/LICENSE) [![Python package](https://img.shields.io/pypi/v/semantic-kernel)](https://pypi.org/project/semantic-kernel/) [![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.SemanticKernel)](https://www.nuget.org/packages/Microsoft.SemanticKernel/) [![Discord](https://img.shields.io/discord/1063152441819942922?label=Discord&logo=discord&logoColor=white&color=d82679)](https://aka.ms/SKDiscord) ## What is Semantic Kernel? Semantic Kernel is a model-agnostic SDK that empowers developers to build, orchestrate, and deploy AI agents and multi-agent systems. Whether you're building a simple chatbot or a complex multi-agent workflow, Semantic Kernel provides the tools you need with enterprise-grade reliability and flexibility. ## System Requirements - **Python**: 3.10+ - **.NET**: .NET 10.0+ - **Java**: JDK 17+ - **OS Support**: Windows, macOS, Linux ## Key Features - **Model Flexibility**: Connect to any LLM with built-in support for [OpenAI](https://platform.openai.com/docs/introduction), [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service), [Hugging Face](https://huggingface.co/), [NVidia](https://www.nvidia.com/en-us/ai-data-science/products/nim-microservices/) and more - **Agent Framework**: Build modular AI agents with access to tools/plugins, memory, and planning capabilities - **Multi-Agent Systems**: Orchestrate complex workflows with collaborating specialist agents - **Plugin Ecosystem**: Extend with native code functions, prompt templates, OpenAPI specs, or Model Context Protocol (MCP) - **Vector DB Support**: Seamless integration with [Azure AI Search](https://learn.microsoft.com/en-us/azure/search/search-what-is-azure-search), [Elasticsearch](https://www.elastic.co/), [Chroma](https://docs.trychroma.com/docs/overview/getting-started), and more - **Multimodal Support**: Process text, vision, and audio inputs - **Local Deployment**: Run with [Ollama](https://ollama.com/), [LMStudio](https://lmstudio.ai/), or [ONNX](https://onnx.ai/) - **Process Framework**: Model complex business processes with a structured workflow approach - **Enterprise Ready**: Built for observability, security, and stable APIs ## Installation First, set the environment variable for your AI Services: **Azure OpenAI:** ```bash export AZURE_OPENAI_API_KEY=AAA.... ``` **or OpenAI directly:** ```bash export OPENAI_API_KEY=sk-... ``` ### Python ```bash pip install semantic-kernel ``` ### .NET ```bash dotnet add package Microsoft.SemanticKernel dotnet add package Microsoft.SemanticKernel.Agents.Core ``` ### Java See [semantic-kernel-java build](https://github.com/microsoft/semantic-kernel-java/blob/main/BUILD.md) for instructions. ## Quickstart ### Basic Agent - Python Create a simple assistant that responds to user prompts: ```python import asyncio from semantic_kernel.agents import ChatCompletionAgent from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion async def main(): # Initialize a chat agent with basic instructions agent = ChatCompletionAgent( service=AzureChatCompletion(), name="SK-Assistant", instructions="You are a helpful assistant.", ) # Get a response to a user message response = await agent.get_response(messages="Write a haiku about Semantic Kernel.") print(response.content) asyncio.run(main()) # Output: # Language's essence, # Semantic threads intertwine, # Meaning's core revealed. ``` ### Basic Agent - .NET ```csharp using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.Agents; var builder = Kernel.CreateBuilder(); builder.AddAzureOpenAIChatCompletion( Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT"), Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"), Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY") ); var kernel = builder.Build(); ChatCompletionAgent agent = new() { Name = "SK-Agent", Instructions = "You are a helpful assistant.", Kernel = kernel, }; await foreach (AgentResponseItem<ChatMessageContent> response in agent.InvokeAsync("Write a haiku about Semantic Kernel.")) { Console.WriteLine(response.Message); } // Output: // Language's essence, // Semantic threads intertwine, // Meaning's core revealed. ``` ### Agent with Plugins - Python Enhance your agent with custom tools (plugins) and structured output: ```python import asyncio from typing import Annotated from pydantic import BaseModel from semantic_kernel.agents import ChatCompletionAgent from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion, OpenAIChatPromptExecutionSettings from semantic_kernel.functions import kernel_function, KernelArguments class MenuPlugin: @kernel_function(description="Provides a list of specials from the menu.") def get_specials(self) -> Annotated[str, "Returns the specials from the menu."]: return """ Special Soup: Clam Chowder Special Salad: Cobb Salad Special Drink: Chai Tea """ @kernel_function(description="Provides the price of the requested menu item.") def get_item_price( self, menu_item: Annotated[str, "The name of the menu item."] ) -> Annotated[str, "Returns the price of the menu item."]: return "$9.99" class MenuItem(BaseModel): price: float name: str async def main(): # Configure structured output format settings = OpenAIChatPromptExecutionSettings() settings.response_format = MenuItem # Create agent with plugin and settings agent = ChatCompletionAgent( service=AzureChatCompletion(), name="SK-Assistant", instructions="You are a helpful assistant.", plugins=[MenuPlugin()], arguments=KernelArguments(settings) ) response = await agent.get_response(messages="What is the price of the soup special?") print(response.content) # Output: # The price of the Clam Chowder, which is the soup special, is $9.99. asyncio.run(main()) ``` ### Agent with Plugin - .NET ```csharp using System.ComponentModel; using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.Agents; using Microsoft.SemanticKernel.ChatCompletion; var builder = Kernel.CreateBuilder(); builder.AddAzureOpenAIChatCompletion( Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT"), Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"), Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY") ); var kernel = builder.Build(); kernel.Plugins.Add(KernelPluginFactory.CreateFromType<MenuPlugin>()); ChatCompletionAgent agent = new() { Name = "SK-Assistant", Instructions = "You are a helpful assistant.", Kernel = kernel, Arguments = new KernelArguments(new PromptExecutionSettings() { FunctionChoiceBehavior = FunctionChoiceBehavior.Auto() }) }; await foreach (AgentResponseItem<ChatMessageContent> response in agent.InvokeAsync("What is the price of the soup special?")) { Console.WriteLine(response.Message); } sealed class MenuPlugin { [KernelFunction, Description("Provides a list of specials from the menu.")] public string GetSpecials() => """ Special Soup: Clam Chowder Special Salad: Cobb Salad Special Drink: Chai Tea """; [KernelFunction, Description("Provides the price of the requested menu item.")] public string GetItemPrice( [Description("The name of the menu item.")] string menuItem) => "$9.99"; } ``` ### Multi-Agent System - Python Build a system of specialized agents that can collaborate: ```python import asyncio from semantic_kernel.agents import ChatCompletionAgent, ChatHistoryAgentThread from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion, OpenAIChatCompletion billing_agent = ChatCompletionAgent( service=AzureChatCompletion(), name="BillingAgent", instructions="You handle billing issues like charges, payment methods, cycles, fees, discrepancies, and payment failures." ) refund_agent = ChatCompletionAgent( service=AzureChatCompletion(), name="RefundAgent", instructions="Assist users with refund inquiries, including eligibility, policies, processing, and status updates.", ) triage_agent = ChatCompletionAgent( service=OpenAIChatCompletion(), name="TriageAgent", instructions="Evaluate user requests and forward them to BillingAgent or RefundAgent for targeted assistance." " Provide the full answer to the user containing any information from the agents", plugins=[billing_agent, refund_agent], ) thread: ChatHistoryAgentThread = None async def main() -> None: print("Welcome to the chat bot!\n Type 'exit' to exit.\n Try to get some billing or refund help.") while True: user_input = input("User:> ") if user_input.lower().strip() == "exit": print("\n\nExiting chat...") return False response = await triage_agent.get_response( messages=user_input, thread=thread, ) if response: print(f"Agent :> {response}") # Agent :> I understand that you were charged twice for your subscription last month, and I'm here to assist you with resolving this issue. Here’s what we need to do next: # 1. **Billing Inquiry**: # - Please provide the email address or account number associated with your subscription, the date(s) of the charges, and the amount charged. This will allow the billing team to investigate the discrepancy in the charges. # 2. **Refund Process**: # - For the refund, please confirm your subscription type and the email address associated with your account. # - Provide the dates and transaction IDs for the charges you believe were duplicated. # Once we have these details, we will be able to: # - Check your billing history for any discrepancies. # - Confirm any duplicate charges. # - Initiate a refund for the duplicate payment if it qualifies. The refund process usually takes 5-10 business days after approval. # Please provide the necessary details so we can proceed with resolving this issue for you. if __name__ == "__main__": asyncio.run(main()) ``` ## Where to Go Next 1. 📖 Try our [Getting Started Guide](https://learn.microsoft.com/en-us/semantic-kernel/get-started/quick-start-guide) or learn about [Building Agents](https://learn.microsoft.com/en-us/semantic-kernel/frameworks/agent/) 2. 🔌 Explore over 100 [Detailed Samples](https://learn.microsoft.com/en-us/semantic-kernel/get-started/detailed-samples) 3. 💡 Learn about core Semantic Kernel [Concepts](https://learn.microsoft.com/en-us/semantic-kernel/concepts/kernel) ### API References - [C# API reference](https://learn.microsoft.com/en-us/dotnet/api/microsoft.semantickernel?view=semantic-kernel-dotnet) - [Python API reference](https://learn.microsoft.com/en-us/python/api/semantic-kernel/semantic_kernel?view=semantic-kernel-python) ## Troubleshooting ### Common Issues - **Authentication Errors**: Check that your API key environment variables are correctly set - **Model Availability**: Verify your Azure OpenAI deployment or OpenAI model access ### Getting Help - Check our [GitHub issues](https://github.com/microsoft/semantic-kernel/issues) for known problems - Search the [Discord community](https://aka.ms/SKDiscord) for solutions - Include your SDK version and full error messages when asking for help ## Join the community We welcome your contributions and suggestions to the SK community! One of the easiest ways to participate is to engage in discussions in the GitHub repository. Bug reports and fixes are welcome! For new features, components, or extensions, please open an issue and discuss with us before sending a PR. This is to avoid rejection as we might be taking the core in a different direction, but also to consider the impact on the larger ecosystem. To learn more and get started: - Read the [documentation](https://aka.ms/sk/learn) - Learn how to [contribute](https://learn.microsoft.com/en-us/semantic-kernel/support/contributing) to the project - Ask questions in the [GitHub discussions](https://github.com/microsoft/semantic-kernel/discussions) - Ask questions in the [Discord community](https://aka.ms/SKDiscord) - Attend [regular office hours and SK community events](COMMUNITY.md) - Follow the team on our [blog](https://aka.ms/sk/blog) ## Contributor Wall of Fame [![semantic-kernel contributors](https://contrib.rocks/image?repo=microsoft/semantic-kernel)](https://github.com/microsoft/semantic-kernel/graphs/contributors) ## Code of Conduct 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. ## License Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the [MIT](LICENSE) license.

ML Frameworks
28.1K Github Stars
unilm
Open Source

unilm

<!--# Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities--> ## [aka.ms/GeneralAI](https://aka.ms/GeneralAI) # Hiring We are hiring at all levels (including FTE researchers and interns)! If you are interested in working with us on Foundation Models (aka large-scale pre-trained models) and General AI, NLP, MT, Speech, Document AI and Multimodal AI, please send your resume to <a href="mailto:[email protected]" class="x-hidden-focus">[email protected]</a>. # Foundation Architecture ### TorchScale - A Library of Foundation Architectures ([repo](https://github.com/microsoft/torchscale)) Fundamental research to develop new architectures for foundation models and AI, focusing on modeling generality and capability, as well as training stability and efficiency. > Stability - [**DeepNet**](https://github.com/microsoft/unilm/tree/master/deepnet): scaling Transformers to 1,000 Layers and beyond > Generality - [**Foundation Transformers (Magneto)**](https://arxiv.org/abs/2210.06423): towards true general-purpose modeling across tasks and modalities (including language, vision, speech, and multimodal) > Capability - A [**Length-Extrapolatable**](https://arxiv.org/abs/2212.10554) Transformer > Efficiency & Transferability - [**X-MoE**](https://github.com/microsoft/unilm/tree/master/xmoe): scalable & finetunable sparse Mixture-of-Experts (MoE) ### The Revolution of Model Architecture > [**BitNet**](https://arxiv.org/abs/2310.11453): 1-bit Transformers for Large Language Models > [**RetNet**](https://arxiv.org/abs/2307.08621): Retentive Network: A Successor to Transformer for Large Language Models > [**LongNet**](https://arxiv.org/abs/2307.02486): Scaling Transformers to 1,000,000,000 Tokens # Foundation Models ### The Evolution of (M)LLM (Multimodal LLM) > [**Kosmos-2.5**](https://github.com/microsoft/unilm/tree/master/kosmos-2.5): **A Multimodal Literate Model** > [**Kosmos-2**](https://github.com/microsoft/unilm/tree/master/kosmos-2): **Grounding Multimodal Large Language Models to the World** > [**Kosmos-1**](https://arxiv.org/abs/2302.14045): **A Multimodal Large Language Model (MLLM)** > [**MetaLM**](https://github.com/microsoft/unilm/tree/master/metalm): **Language Models are General-Purpose Interfaces** **The Big Convergence** - Large-scale self-supervised pre-training across ```tasks``` (predictive and generative), ```languages``` (100+ languages), and ```modalities``` (language, image, audio, layout/format + language, vision + language, audio + language, etc.) <!--## Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities--> ### Language & Multilingual > [**UniLM**](https://github.com/microsoft/unilm/tree/master/unilm): unified pre-training for language understanding and generation > [**InfoXLM/XLM-E**](https://github.com/microsoft/unilm/tree/master/infoxlm): multilingual/cross-lingual pre-trained models for 100+ languages > [**DeltaLM/mT6**](https://github.com/microsoft/unilm/tree/master/deltalm): encoder-decoder pre-training for language generation and translation for 100+ languages > [**MiniLM**](https://github.com/microsoft/unilm/tree/master/minilm): small and fast pre-trained models for language understanding and generation > [**AdaLM**](https://github.com/microsoft/unilm/tree/master/adalm): domain, language, and task adaptation of pre-trained models > [**EdgeLM**](https://github.com/microsoft/unilm/tree/master/edgelm)(```NEW```): small pre-trained models on edge/client devices > [**SimLM**](https://github.com/microsoft/unilm/tree/master/simlm) (```NEW```): large-scale pre-training for similarity matching > [**E5**](https://github.com/microsoft/unilm/tree/master/e5) (```NEW```): text embeddings > [**MiniLLM**](https://arxiv.org/abs/2306.08543) (```NEW```): Knowledge Distillation of Large Language Models ### Vision > [**BEiT**](https://github.com/microsoft/unilm/tree/master/beit)/[**BEiT-2**](https://github.com/microsoft/unilm/tree/master/beit2): generative self-supervised pre-training for vision / BERT Pre-Training of Image Transformers > [**DiT**](https://github.com/microsoft/unilm/tree/master/dit): self-supervised pre-training for Document Image Transformers > [**TextDiffuser**](https://github.com/microsoft/unilm/tree/master/textdiffuser)/[**TextDiffuser-2**](https://github.com/microsoft/unilm/tree/master/textdiffuser-2) (```NEW```): Diffusion Models as Text Painters ### Speech > [**WavLM**](https://github.com/microsoft/unilm/tree/master/wavlm): speech pre-training for full stack tasks > [**VALL-E**](https://github.com/microsoft/unilm/tree/master/valle): a neural codec language model for TTS ### Multimodal (X + Language) > [**LayoutLM**](https://github.com/microsoft/unilm/tree/master/layoutlm)/[**LayoutLMv2**](https://github.com/microsoft/unilm/tree/master/layoutlmv2)/[**LayoutLMv3**](https://github.com/microsoft/unilm/tree/master/layoutlmv3): multimodal (text + layout/format + image) **Document Foundation Model** for [Document AI](https://www.microsoft.com/en-us/research/project/document-ai/) (e.g. scanned documents, PDF, etc.) > [**LayoutXLM**](https://github.com/microsoft/unilm/tree/master/layoutxlm): multimodal (text + layout/format + image) **Document Foundation Model** for multilingual Document AI > [**MarkupLM**](https://github.com/microsoft/unilm/tree/master/markuplm): markup language model pre-training for visually-rich document understanding > [**XDoc**](https://github.com/microsoft/unilm/tree/master/xdoc): unified pre-training for cross-format document understanding > [**UniSpeech**](https://arxiv.org/abs/2101.07597): unified pre-training for self-supervised learning and supervised learning for ASR > [**UniSpeech-SAT**](https://arxiv.org/pdf/2110.05752.pdf): universal speech representation learning with speaker-aware pre-training > [**SpeechT5**](https://arxiv.org/abs/2110.07205): encoder-decoder pre-training for spoken language processing > [**SpeechLM**](https://arxiv.org/abs/2209.15329): Enhanced Speech Pre-Training with Unpaired Textual Data > [**VLMo**](https://github.com/microsoft/unilm/tree/master/vlmo): Unified vision-language pre-training > [**VL-BEiT**](https://github.com/microsoft/unilm/tree/master/vl-beit) (```NEW```): Generative Vision-Language Pre-training - evolution of **BEiT** to multimodal > [**BEiT-3**](https://github.com/microsoft/unilm/tree/master/beit3) (```NEW```): a general-purpose multimodal foundation model, and a major milestone of **The Big Convergence** of Large-scale Pre-training Across Tasks, Languages, and Modalities. ### Toolkits > [**s2s-ft**](https://github.com/microsoft/unilm/tree/master/s2s-ft): sequence-to-sequence fine-tuning toolkit > [**Aggressive Decoding**](https://arxiv.org/pdf/2205.10350.pdf) (```NEW```): lossless and efficient sequence-to-sequence decoding algorithm ### Applications > [**TrOCR**](https://github.com/microsoft/unilm/tree/master/trocr): transformer-based OCR w/ pre-trained models > [**LayoutReader**](https://github.com/microsoft/unilm/tree/master/layoutreader): pre-training of text and layout for reading order detection > [**XLM-T**](https://github.com/microsoft/unilm/tree/master/xlmt): multilingual NMT w/ pretrained cross-lingual encoders ## Links ### LLMOps ([repo](https://github.com/microsoft/lmops)) General technology for enabling AI capabilities w/ LLMs and MLLMs. ### RedStone ([repo](https://github.com/microsoft/redstone)) Curating General, Code, Math, and QA Data for Large Language Models. ## News - December, 2024: [**RedStone**](https://github.com/microsoft/redstone) was released! - December, 2023: [**LongNet**](https://github.com/microsoft/unilm/tree/master/longnet) and [**LongViT**](https://github.com/microsoft/unilm/tree/master/longvit) released - [Model Release] Dec, 2023: [**TextDiffuser-2**](https://github.com/microsoft/unilm/tree/master/textdiffuser-2) models, code and [demo](https://huggingface.co/spaces/JingyeChen22/TextDiffuser-2). - Sep, 2023: [**Kosmos-2.5**](https://arxiv.org/abs/2309.11419) - a multimodal literate model for machine reading of text-intensive images. - [Model Release] May, 2023: [**TextDiffuser**](https://github.com/microsoft/unilm/tree/master/textdiffuser) models and code. - [Model Release] March, 2023: [**BEiT-3**](https://github.com/microsoft/unilm/tree/master/beit3) pretrained models and code. - March, 2023: [**Kosmos-1**](https://arxiv.org/abs/2302.14045) - a Multimodal Large Language Model (MLLM) that can perceive general modalities, learn in context (i.e., few-shot), and follow instructions (i.e., zero-shot). - January, 2023: [**VALL-E**](https://arxiv.org/abs/2301.02111) a language modeling approach for text to speech synthesis (TTS), which achieves state-of-the-art zero-shot TTS performance. See https://aka.ms/valle for demos of our work. - [Model Release] January, 2023: [**E5**](https://github.com/microsoft/unilm/tree/master/e5) - Text Embeddings by Weakly-Supervised Contrastive Pre-training. - November, 2022: [**TorchScale 0.1.1**](https://github.com/microsoft/torchscale) was released! - November, 2022: [**TrOCR**](https://arxiv.org/abs/2109.10282) was accepted by AAAI 2023. - [Model Release] November, 2022: [**XDoc**](https://github.com/microsoft/unilm/tree/master/xdoc) **BASE** models for cross-format document understanding. - [Model Release] September, 2022: [**TrOCR**](https://github.com/microsoft/unilm/tree/master/trocr) **BASE** and **LARGE** models for Scene Text Recognition (STR). - [Model Release] September, 2022: [**BEiT v2**](https://github.com/microsoft/unilm/tree/master/beit2) code and pretrained models. - August, 2022: [**BEiT-3**](https://arxiv.org/abs/2208.10442) - a general-purpose multimodal foundation model, which achieves state-of-the-art transfer performance on both vision and vision-language tasks - July, 2022: [**SimLM**](https://github.com/microsoft/unilm/tree/master/simlm) - Large-scale self-supervised pre-training for similarity matching - June, 2022: [**DiT**](https://arxiv.org/abs/2203.02378) and [**LayoutLMv3**](https://arxiv.org/abs/2204.08387) were accepted by ACM Multimedia 2022. - June, 2022: [**MetaLM**](https://github.com/microsoft/unilm/tree/master/metalm) - Language models are general-purpose interfaces to foundation models (language/multilingual, vision, speech, and multimodal) - June, 2022: [**VL-BEiT**](https://github.com/microsoft/unilm/tree/master/vl-beit) - bidirectional multimodal Transformer learned from scratch with one unified pretraining task, one shared backbone, and one-stage training, supporting both vision and vision-language tasks. - [Model Release] June, 2022: [**LayoutLMv3 Chinese**](https://github.com/microsoft/unilm/tree/master/layoutlmv3#form-understanding-on-xfund) - Chinese version of LayoutLMv3 - [Code Release] May, 2022: [**Aggressive Decoding**](https://github.com/microsoft/unilm/tree/master/decoding) - Lossless Speedup for Seq2seq Generation - April, 2022: **Transformers at Scale** = [DeepNet](https://arxiv.org/abs/2203.00555) + [X-MoE](https://arxiv.org/abs/2204.09179) - [Model Release] April, 2022: [**LayoutLMv3**](https://github.com/microsoft/unilm/tree/master/layoutlmv3) - Pre-training for Document AI with Unified Text and Image Masking - [Model Release] March, 2022: [**EdgeFormer**](https://github.com/microsoft/unilm/tree/master/edgelm) - Parameter-efficient Transformer for On-device Seq2seq Generation - [Model Release] March, 2022: [**DiT**](https://github.com/microsoft/unilm/tree/master/dit) - Self-supervised Document Image Transformer. Demos: [Document Layout Analysis](https://huggingface.co/spaces/nielsr/dit-document-layout-analysis), [Document Image Classification](https://huggingface.co/spaces/microsoft/document-image-transformer) - January, 2022: [**BEiT**](https://openreview.net/forum?id=p-BhZSz59o4) was accepted by **ICLR 2022 as Oral presentation** (54 out of 3391). - [Model Release] December 16th, 2021: [**TrOCR**](https://github.com/microsoft/unilm/tree/master/trocr) **small** models for handwritten and printed texts, with 3x inference speedup. - November 24th, 2021: [**VLMo**](https://github.com/microsoft/unilm/tree/master/vlmo) as the new SOTA on the [VQA Challenge](https://eval.ai/web/challenges/challenge-page/830/leaderboard/2278) - November, 2021: [Multilingual translation at scale: 10000 language pairs and beyond](https://www.microsoft.com/en-us/translator/blog/2021/11/22/multilingual-translation-at-scale-10000-language-pairs-and-beyond/) - [Model Release] November, 2021: [**MarkupLM**](https://github.com/microsoft/unilm/tree/master/markuplm) - Pre-training for text and markup language (e.g. HTML/XML) - [Model Release] November, 2021: [**VLMo**](https://github.com/microsoft/unilm/tree/master/vlmo) - Unified vision-language pre-training w/ [**BEiT**](https://github.com/microsoft/unilm/tree/master/beit) - October, 2021: [**WavLM**](https://github.com/microsoft/unilm/tree/master/wavlm) Large achieves state-of-the-art performance on the [SUPERB](https://superbbenchmark.org/leaderboard) benchmark - [Model Release] October, 2021: [**WavLM**](https://github.com/microsoft/unilm/tree/master/wavlm) - Large-scale self-supervised pre-trained models for speech. - [Model Release] October 2021: [**TrOCR**](https://huggingface.co/transformers/master/model_doc/trocr.html) is on [HuggingFace](https://github.com/huggingface/transformers) - September 28th, 2021: T-ULRv5 (aka <a href="https://arxiv.org/abs/2106.16138" target="_blank">XLM-E</a>/<a href="https://arxiv.org/abs/2007.07834" target="_blank">InfoXLM</a>) as the SOTA on the <a href="https://sites.research.google/xtreme" target="_blank">XTREME</a> leaderboard. // <a href="https://www.microsoft.com/en-us/research/blog/microsoft-turing-universal-language-representation-model-t-ulrv5-tops-xtreme-leaderboard-and-trains-100x-faster/" target="_blank">Blog</a> - [Model Release] September, 2021: [**LayoutLM-cased**](https://huggingface.co/microsoft/layoutlm-base-cased) are on [HuggingFace](https://github.com/huggingface/transformers) - [Model Release] September, 2021: [**TrOCR**](https://github.com/microsoft/unilm/tree/master/trocr) - Transformer-based OCR w/ pre-trained [**BEiT**](https://github.com/microsoft/unilm/tree/master/beit) and RoBERTa models. - August 2021: [**LayoutLMv2**](https://huggingface.co/transformers/master/model_doc/layoutlmv2.html) and [**LayoutXLM**](https://huggingface.co/transformers/master/model_doc/layoutxlm.html) are on [HuggingFace](https://github.com/huggingface/transformers) - [Model Release] August, 2021: [**LayoutReader**](https://github.com/microsoft/unilm/tree/master/layoutreader) - Built with LayoutLM to improve general reading order detection. - [Model Release] August, 2021: [**DeltaLM**](https://github.com/microsoft/unilm/tree/master/deltalm) - Encoder-decoder pre-training for language generation and translation. - August 2021: [**BEiT**](https://huggingface.co/transformers/master/model_doc/beit.html) is on [HuggingFace](https://github.com/huggingface/transformers) - [Model Release] July, 2021: [**BEiT**](https://github.com/microsoft/unilm/tree/master/beit) - Towards BERT moment for CV - [Model Release] June, 2021: [**LayoutLMv2**](https://github.com/microsoft/unilm/tree/master/layoutlmv2), [**LayoutXLM**](https://github.com/microsoft/unilm/tree/master/layoutxlm), [**MiniLMv2**](https://github.com/microsoft/unilm/tree/master/minilm), and [**AdaLM**](https://github.com/microsoft/unilm/tree/master/adalm). - May, 2021: [LayoutLMv2](https://github.com/microsoft/unilm/tree/master/layoutlmv2), InfoXLMv2, MiniLMv2, UniLMv3, and AdaLM were accepted by ACL 2021. - April, 2021: [LayoutXLM](https://github.com/microsoft/unilm/tree/master/layoutxlm) is coming by extending the LayoutLM into multilingual support! A multilingual form understanding benchmark [XFUND](https://github.com/doc-analysis/XFUND) is also introduced, which includes forms with human labeled key-value pairs in 7 languages (Chinese, Japanese, Spanish, French, Italian, German, Portuguese). - March, 2021: [InfoXLM](https://github.com/microsoft/unilm/tree/master/infoxlm) was accepted by NAACL 2021. - December 29th, 2020: [LayoutLMv2](https://arxiv.org/abs/2012.14740) is coming with the new SOTA on a wide variety of document AI tasks, including [DocVQA](https://rrc.cvc.uab.es/?ch=17&com=evaluation&task=1) and [SROIE](https://rrc.cvc.uab.es/?ch=13&com=evaluation&task=3) leaderboard. - October 8th, 2020: T-ULRv2 (aka [InfoXLM](https://arxiv.org/abs/2007.07834)) as the SOTA on the [XTREME](https://sites.research.google/xtreme) leaderboard. // [Blog](https://www.microsoft.com/en-us/research/blog/microsoft-turing-universal-language-representation-model-t-ulrv2-tops-xtreme-leaderboard/) - September, 2020: [MiniLM](https://github.com/microsoft/unilm/tree/master/minilm) was accepted by NeurIPS 2020. - July 16, 2020: [**InfoXLM** (Multilingual UniLM)](https://github.com/microsoft/unilm/tree/master/infoxlm) [arXiv](https://arxiv.org/pdf/2007.07834.pdf) - June, 2020: [UniLMv2](https://github.com/microsoft/unilm/tree/master/unilm) was accepted by ICML 2020; [LayoutLM](https://github.com/microsoft/unilm/tree/master/layoutlm) was accepted by KDD 2020. - April 5, 2020: [**Multilingual MiniLM**](https://github.com/microsoft/unilm/tree/master/minilm) released! - September, 2019: [UniLMv1](https://github.com/microsoft/unilm/tree/master/unilm-v1) was accepted by NeurIPS 2019. <!-- ## Release **\*\*\*\*\* ```New October, 2022```: [XDoc](https://github.com/microsoft/unilm/tree/master/xdoc) release \*\*\*\*\*** - [x] [**XDoc**](https://github.com/microsoft/unilm/tree/master/xdoc) (October 7, 2022): XDoc, a unified pre-trained model which deals with different document formats in a single model. For parameter efficiency, we share backbone parameters for different formats such as the word embedding layer and the Transformer layers. Meanwhile, we introduce adaptive layers with lightweight parameters to enhance the distinction across different formats. Experimental results have demonstrated that with only 36.7% parameters, XDoc achieves comparable or even better performance on a variety of downstream tasks compared with the individual pre-trained models, which is cost effective for real-world deployment. "[XDoc: Unified Pre-training for Cross-Format Document Understanding](https://arxiv.org/abs/2210.02849) ```EMNLP 2022```" **\*\*\*\*\* ```New May, 2022```: [Aggressive Decoding](https://github.com/microsoft/unilm/tree/master/decoding) release \*\*\*\*\*** - [x] [**Aggressive Decoding**](https://github.com/microsoft/unilm/tree/master/decoding) (May 20, 2022): Aggressive Decoding, a novel decoding paradigm for lossless speedup for seq2seq generation. Unlike the previous efforts (e.g., non-autoregressive decoding) speeding up seq2seq generation at the cost of quality loss, Aggressive Decoding aims to yield the identical (or better) generation compared with autoregressive decoding but in a significant speedup: For the seq2seq tasks characterized by highly similar inputs and outputs (e.g., Grammatical Error Correction and Text Simplification), the Input-guided Aggressive Decoding can introduce a 7x-9x speedup for the popular 6-layer Transformer on GPU with the identical results as greedy decoding; For other general seq2seq tasks (e.g., Machine Translation and Abstractive Summarization), the Generalized Aggressive Decoding can have a 3x-5x speedup with the identical or even better quality. "[Lossless Acceleration for Seq2seq Generation with Aggressive Decoding](https://arxiv.org/pdf/2205.10350.pdf)" **\*\*\*\*\* ```New April, 2022```: [LayoutLMv3](https://github.com/microsoft/unilm/tree/master/layoutlmv3) release \*\*\*\*\*** - [x] [**LayoutLM 3.0**](https://github.com/microsoft/unilm/tree/master/layoutlmv3) (April 19, 2022): LayoutLMv3, a multimodal pre-trained Transformer for Document AI with unified text and image masking. Additionally, it is also pre-trained with a word-patch alignment objective to learn cross-modal alignment by predicting whether the corresponding image patch of a text word is masked. The simple unified architecture and training objectives make LayoutLMv3 a general-purpose pre-trained model for both text-centric and image-centric Document AI tasks. Experimental results show that LayoutLMv3 achieves state-of-the-art performance not only in text-centric tasks, including form understanding, receipt understanding, and document visual question answering, but also in image-centric tasks such as document image classification and document layout analysis. "[LayoutLMv3: Pre-training for Document AI with Unified Text and Image Masking](https://arxiv.org/abs/2204.08387) ```ACM MM 2022```" **\*\*\*\*\* ```March, 2022```: [EdgeFormer](https://github.com/microsoft/unilm/tree/master/edgelm) release \*\*\*\*\*** - [x] [**EdgeFormer**](https://github.com/microsoft/unilm/tree/master/edgelm) (March 18, 2022): EdgeFormer, the first publicly available pretrained parameter-efficient Transformer for on-device seq2seq generation. EdgeFormer has only 11 million parameters, taking up less than 15MB disk size after int8 quantization and compression, which can process a sentence of the length of 20-30 tokens with acceptable latency on two middle-to-high end CPU cores and less than 50MB memory footprint. The pretrained EdgeFormer can be fine-tuned to English seq2seq tasks and achieve promising results -- significantly better than the strong paramter-efficient Transformer baseline (pretrained Universal Transformer) and full-parameterized Transformer-base model without pretraining, which we believe can largely facilitate on-device seq2seq generation in practice. "[EdgeFormer: A Parameter-Efficient Transformer for On-Device Seq2seq Generation](https://arxiv.org/abs/2202.07959)" **\*\*\*\*\* ```March, 2022```: [DiT](https://github.com/microsoft/unilm/tree/master/dit) release \*\*\*\*\*** - [x] [**DiT**](https://github.com/microsoft/unilm/tree/master/dit) (March 4, 2022): DiT, a self-supervised pre-trained Document Image Transformer model using large-scale unlabeled text images for Document AI tasks, which is essential since no supervised counterparts ever exist due to the lack of human labeled document images. We leverage DiT as the backbone network in a variety of vision-based Document AI tasks, including document image classification, document layout analysis, table detection as well as text detection for OCR. Experiment results have illustrated that the self-supervised pre-trained DiT model achieves new state-of-the-art results on these downstream tasks, e.g. document image classification (91.11 → 92.69), document layout analysis (91.0 → 94.9), table detection (94.23 → 96.55) and text detection for OCR (93.07 → 94.29). "[DiT: Self-supervised Pre-training for Document Image Transformer](https://arxiv.org/abs/2203.02378) ```ACM MM 2022```" **\*\*\*\*\* ```October, 2021```: [WavLM](https://github.com/microsoft/unilm/tree/master/wavlm) release \*\*\*\*\*** - [x] [**WavLM**](https://github.com/microsoft/unilm/tree/master/wavlm) (October 27, 2021): WavLM, a new pre-trained speech model, to solve full-stack downstream speech tasks. WavLM integrates the gated relative position embedding structure and the utterance mixing method, to model both spoken content and speaker identity preservation. WavLM is trained on 94k hours of public audio data, which is larger than other released checkpoints for English Speech modeling. WavLM Large achieves state-of-the-art performance on the SUPERB benchmark, and brings significant improvements for various speech processing tasks on their representative benchmarks. "[WavLM: Large-Scale Self-Supervised Pre-training for Full Stack Speech Processing](https://arxiv.org/pdf/2110.13900.pdf)" **\*\*\*\*\* ```October, 2021```: [MarkupLM](https://github.com/microsoft/unilm/tree/master/markuplm) release \*\*\*\*\*** - [x] [**MarkupLM**](https://github.com/microsoft/unilm/tree/master/markuplm) (October 19, 2021): MarkupLM, a simple yet effective pre-training approach for text and markup language. With the Transformer architecture, MarkupLM integrates different input embeddings including text embeddings, position embeddings, and XPath embeddings. Furthermore, we also propose new pre-training objectives that are specially designed for understanding the markup language. We evaluate the pre-trained MarkupLM model on the WebSRC and SWDE datasets. Experiments show that MarkupLM significantly outperforms several SOTA baselines in these tasks. "[MarkupLM: Pre-training of Text and Markup Language for Visually-rich Document Understanding](https://arxiv.org/abs/2110.08518) ```ACL 2022```" **\*\*\*\*\* ```September, 2021```: [TrOCR](https://github.com/microsoft/unilm/tree/master/trocr) release \*\*\*\*\*** - [x] [**TrOCR**](https://github.com/microsoft/unilm/tree/master/trocr) (September 22, 2021): Transformer-based OCR with pre-trained models, which leverages the Transformer architecture for both image understanding and bpe-level text generation. The TrOCR model is simple but effective (convolution free), and can be pre-trained with large-scale synthetic data and fine-tuned with human-labeled datasets. "[TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models](https://arxiv.org/abs/2109.10282) ```AAAI 2023```" **\*\*\*\*\* ```August, 2021```: [LayoutReader](https://github.com/microsoft/unilm/tree/master/layoutreader) release \*\*\*\*\*** - [x] [**LayoutReader**](https://github.com/microsoft/unilm/tree/master/layoutreader) (August 26, 2021): pre-training of text and layout for reading order detection. The pre-trained LayoutReader significantly improves both open-source and commercial OCR engines in ordering text lines. Meanwhile, we also created a reading order benchmark dataset [ReadingBank](https://github.com/doc-analysis/ReadingBank) to further empower the research in this area. "[LayoutReader: Pre-training of Text and Layout for Reading Order Detection](https://arxiv.org/abs/2108.11591) ```EMNLP 2021```" **\*\*\*\*\* ```August, 2021```: [DeltaLM](https://github.com/microsoft/unilm/tree/master/deltalm) release \*\*\*\*\*** - [x] [**DeltaLM**](https://github.com/microsoft/unilm/tree/master/deltalm) (August, 2021): encoder-decoder pre-training for language generation and translation. DeltaLM **ranks first** on the [WMT21 multilingual translation task](http://www.statmt.org/wmt21/large-scale-multilingual-translation-task.html). The task requires a model to translate between 102 languages. "[DeltaLM: Encoder-Decoder Pre-training for Language Generation and Translation by Augmenting Pretrained Multilingual Encoders.](https://arxiv.org/abs/2106.13736)" **\*\*\*\*\* ```July, 2021```: [BEiT](https://github.com/microsoft/unilm/tree/master/beit) release \*\*\*\*\*** - [x] [**BEiT**](https://github.com/microsoft/unilm/tree/master/beit) (June 15, 2021): BERT Pre-Training of Image Transformers. BEiT-large achieves **[state-of-the-art results on ADE20K](https://paperswithcode.com/sota/semantic-segmentation-on-ade20k) (a big jump to 57.0 mIoU) for semantic segmentation**. BEiT-large achieves **state-of-the-art ImageNet top-1 accuracy (88.6%) under the setting without extra data other than ImageNet-22k**. "[BEiT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254)" **\*\*\*\*\* ```June, 2021```: [LayoutXLM](https://github.com/microsoft/unilm/tree/master/layoutxlm) | [AdaLM](https://github.com/microsoft/unilm/tree/master/adalm) | [MiniLMv2](https://github.com/microsoft/unilm/tree/master/minilm) release \*\*\*\*\*** - [x] [**LayoutXLM**](https://github.com/microsoft/unilm/tree/master/layoutxlm) (April 17, 2021): multimodal pre-training for multilingual visually-rich document understanding. The pre-trained LayoutXLM model has significantly outperformed the existing SOTA cross-lingual pre-trained models on the FUNSD and multilingual [XFUND](https://github.com/doc-analysis/XFUND) dataset including 7 languages (Chinese, Japanese, Spanish, French, Italian, German, Portuguese). "[LayoutXLM: Multimodal Pre-training for Multilingual Visually-rich Document Understanding](https://arxiv.org/abs/2104.08836)" - [x] [**AdaLM**](https://github.com/microsoft/unilm/tree/master/adalm) (June 2021): a simple yet effective approach for domain adaptation of pre-trained models. Biomedical specific pre-trained models are released. "[Adapt-and-Distill: Developing Small, Fast and Effective Pretrained Language Models for Domains](#) ```ACL 2021```" - [x] [**MiniLMv2**](https://github.com/microsoft/unilm/tree/master/minilm) (December, 2020): a simple yet effective task-agnostic knowledge distillation method, namely multi-head self-attention relation distillation, for compressing large pre-trained Transformers into small and fast pre-trained models. MiniLMv2 significantly outperforms MiniLMv1. Both English and multilingual MiniLM models are released. "[MiniLMv2: Multi-Head Self-Attention Relation Distillation for Compressing Pretrained Transformers](https://arxiv.org/abs/2012.15828) ```ACL 2021```" **\*\*\*\*\* ```May, 2021```: [LayoutLMv2](https://github.com/microsoft/unilm/tree/master/layoutlmv2) | [LayoutXLM](https://github.com/microsoft/unilm/tree/master/layoutxlm) release \*\*\*\*\*** - [x] [**LayoutLM 2.0**](https://github.com/microsoft/unilm/tree/master/layoutlmv2) (December 29, 2020): multimodal pre-training for visually-rich document understanding by leveraging text, layout and image information in a single framework. It is coming with new SOTA on a wide range of document understanding tasks, including FUNSD (0.7895 -> 0.8420), CORD (0.9493 -> 0.9601), SROIE (0.9524 -> 0.9781), Kleister-NDA (0.834 -> 0.852), RVL-CDIP (0.9443 -> 0.9564), and DocVQA (0.7295 -> 0.8672). "[LayoutLMv2: Multi-modal Pre-training for Visually-Rich Document Understanding](https://arxiv.org/abs/2012.14740) ```ACL 2021```" **\*\*\*\*\* ```February, 2020```: [UniLM v2](https://github.com/microsoft/unilm/tree/master/unilm) | [MiniLM v1](https://github.com/microsoft/unilm/tree/master/minilm) | [LayoutLM v1](https://github.com/microsoft/unilm/tree/master/layoutlm) | [s2s-ft v1](https://github.com/microsoft/unilm/tree/master/s2s-ft) release \*\*\*\*\*** - [x] [**LayoutLM 1.0**](https://github.com/microsoft/unilm/tree/master/layoutlm) (February 18, 2020): pre-trained models for document (image) understanding (e.g. receipts, forms, etc.) . It achieves new SOTA results in several downstream tasks, including form understanding (the FUNSD dataset from 70.72 to 79.27), receipt understanding (the [ICDAR 2019 SROIE leaderboard](https://rrc.cvc.uab.es/?ch=13&com=evaluation&task=3) from 94.02 to 95.24) and document image classification (the RVL-CDIP dataset from 93.07 to 94.42). "[LayoutLM: Pre-training of Text and Layout for Document Image Understanding](https://arxiv.org/abs/1912.13318) ```KDD 2020```" - [x] [**s2s-ft 1.0**](https://github.com/microsoft/unilm/tree/master/s2s-ft) (February 26, 2020): A PyTorch package used to fine-tune pre-trained Transformers for sequence-to-sequence language generation. "[s2s-ft: Fine-Tuning Pre-Trained Transformers for Sequence-to-Sequence Learning](#)" - [x] [**MiniLM 1.0**](https://github.com/microsoft/unilm/tree/master/minilm) (February 26, 2020): deep self-attention distillation is all you need (for task-agnostic knowledge distillation of pre-trained Transformers). MiniLM (12-layer, 384-hidden) achieves 2.7x speedup and comparable results over BERT-base (12-layer, 768-hidden) on NLU tasks as well as strong results on NLG tasks. The even smaller MiniLM (6-layer, 384-hidden) obtains 5.3x speedup and produces very competitive results. "[MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformers](https://arxiv.org/abs/2002.10957) ```NeurIPS 2020```" - [x] [**UniLM 2.0**](https://github.com/microsoft/unilm/tree/master/unilm) (February 28, 2020): **unified pre-training** of bi-directional LM (via autoencoding) and sequence-to-sequence LM (via partially autoregressive) w/ **Pseudo-Masked Language Model** for language understanding and generation. UniLM v2 achieves new SOTA in a wide range of natural language understanding and generation tasks. "[UniLMv2: Pseudo-Masked Language Models for Unified Language Model Pre-Training](https://arxiv.org/abs/2002.12804) ```ICML 2020```" **\*\*\*\*\* October 1st, 2019: UniLM v1 release \*\*\*\*\*** - [x] [**UniLM v1**](https://github.com/microsoft/unilm/tree/master/unilm-v1) (September 30, 2019): the code and pre-trained models for the ```NeurIPS 2019``` paper entitled "[Unified Language Model Pre-training for Natural Language Understanding and Generation](https://arxiv.org/abs/1905.03197)". UniLM (v1) achieves the **new SOTA results** in **NLG** (especially **sequence-to-sequence generation**) tasks, including abstractive summarization (the Gigaword and CNN/DM datasets), question generation (the SQuAD QG dataset), etc. --> ## License This project is licensed under the license found in the LICENSE file in the root directory of this source tree. Portions of the source code are based on the [transformers](https://github.com/huggingface/transformers) project. [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct) ### Contact Information For help or issues using the pre-trained models, please submit a GitHub issue. For other communications, please contact [Furu Wei](https://thegenerality.com) (`[email protected]`).

ML Frameworks
22.1K Github Stars
agent-lightning
Open Source

agent-lightning

<p align="center"> <img src="docs/assets/readme-banner.svg" alt="Agent-lightning-banner" style="width:600px"/> </p> # Agent Lightning⚡ [![Unit Tests](https://github.com/microsoft/agent-lightning/actions/workflows/badge-unit.yml/badge.svg)](https://github.com/microsoft/agent-lightning/actions/workflows/badge-unit.yml) [![Documentation](https://img.shields.io/badge/GitHub%20Pages-Documentation-blue)](https://microsoft.github.io/agent-lightning/) [![PyPI version](https://badge.fury.io/py/agentlightning.svg)](https://badge.fury.io/py/agentlightning) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/microsoft/agent-lightning) [![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/RYk7CdvDR7) **The absolute trainer to light up AI agents.** Join our [Discord community](https://discord.gg/RYk7CdvDR7) to connect with other users and contributors. ## ⚡ Core Features - Turn your agent into an optimizable beast with **ZERO CODE CHANGE** (almost)! 💤 - Build with **ANY** agent framework (LangChain, OpenAI Agent SDK, AutoGen, CrewAI, Microsoft Agent Framework...); or even WITHOUT agent framework (Python OpenAI). You name it! 🤖 - **Selectively** optimize one or more agents in a multi-agent system. 🎯 - Embraces **Algorithms** like Reinforcement Learning, Automatic Prompt Optimization, Supervised Fine-tuning and more. 🤗 Read more on our [documentation website](https://microsoft.github.io/agent-lightning/). <p align="center"> <img src="docs/assets/readme-diff.svg" alt="Agent-Lightning Core Quickstart" style="width:100%"/> </p> ## ⚡ Installation ```bash pip install agentlightning ``` For the latest nightly build (cutting-edge features), you can install from Test PyPI: ```bash pip install --upgrade --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ --pre agentlightning ``` Please refer to our [installation guide](https://microsoft.github.io/agent-lightning/stable/tutorials/installation/) for more details. To start using Agent-lightning, check out our [documentation](https://microsoft.github.io/agent-lightning/) and [examples](./examples). ## ⚡ Articles - 12/17/2025 [Adopting the Trajectory Level Aggregation for Faster Training](https://agent-lightning.github.io/posts/trajectory_level_aggregation/) Agent-lightning blog. - 11/4/2025 [Tuning ANY AI agent with Tinker ✕ Agent-lightning](https://medium.com/@yugez/tuning-any-ai-agent-with-tinker-agent-lightning-part-1-1d8c9a397f0e) Medium. See also [Part 2](https://medium.com/@yugez/tuning-any-ai-agent-with-tinker-agent-lightning-part-2-332c5437f0dc). - 10/22/2025 [No More Retokenization Drift: Returning Token IDs via the OpenAI Compatible API Matters in Agent RL](https://blog.vllm.ai/2025/10/22/agent-lightning.html) vLLM blog. See also [Zhihu writeup](https://zhuanlan.zhihu.com/p/1965067274642785725). - 8/11/2025 [Training AI Agents to Write and Self-correct SQL with Reinforcement Learning](https://medium.com/@yugez/training-ai-agents-to-write-and-self-correct-sql-with-reinforcement-learning-571ed31281ad) Medium. - 8/5/2025 [Agent Lightning: Train ANY AI Agents with Reinforcement Learning](https://arxiv.org/abs/2508.03680) arXiv paper. - 7/26/2025 [We discovered an approach to train any AI agent with RL, with (almost) zero code changes.](https://www.reddit.com/r/LocalLLaMA/comments/1m9m670/we_discovered_an_approach_to_train_any_ai_agent/) Reddit. - 6/6/2025 [Agent Lightning - Microsoft Research](https://www.microsoft.com/en-us/research/project/agent-lightning/) Project page. ## ⚡ Community Projects - [DeepWerewolf](https://github.com/af-74413592/DeepWerewolf) — A case study of agent RL training for the Chinese Werewolf game built with AgentScope and Agent Lightning. - [AgentFlow](https://agentflow.stanford.edu/) — A modular multi-agent framework that combines planner, executor, verifier, and generator agents with the Flow-GRPO algorithm to tackle long-horizon, sparse-reward tasks. - [Youtu-Agent](https://github.com/TencentCloudADP/Youtu-agent) — Youtu-Agent lets you build and train your agent with ease. Built with [a modified branch](https://github.com/microsoft/agent-lightning/tree/contrib/youtu-agent-lightning) of Agent Lightning, Youtu-Agent has verified up to 128 GPUs RL training on maths/code and search capabilities with steady convergence. Also check [the recipe](https://github.com/TencentCloudADP/youtu-agent/tree/rl/agl) and their blog [*Stop Wrestling with Your Agent RL: How Youtu-Agent Achieved Stable, 128-GPU Scaling Without Breaking a Sweat*](https://spotted-coconut-df8.notion.site/Stop-Wrestling-with-Your-Agent-RL-How-Youtu-Agent-Achieved-Stable-128-GPU-Scaling-Without-Breaking-2ca5e8f089ba80539a98c582b65e0233). ## ⚡ Architecture Agent Lightning keeps the moving parts to a minimum so you can focus on your idea, not the plumbing. Your agent continues to run as usual; you can still use any agent framework you like; you drop in the lightweight `agl.emit_xxx()` helper, or let the tracer collect every prompt, tool call, and reward. Those events become structured spans that flow into the LightningStore, a central hub that keeps tasks, resources, and traces in sync. On the other side of the store sits the algorithm you choose, or write yourself. The algorithm reads spans, learns from them, and posts updated resources such as refined prompt templates or new policy weights. The Trainer ties it all together: it streams datasets to runners, ferries resources between the store and the algorithm, and updates the inference engine when improvements land. You can either stop there, or simply let the same loop keep turning. No rewrites, no lock-in, just a clear path from first rollout to steady improvement. <p align="center"> <img src="docs/assets/readme-architecture.svg" alt="Agent-lightning Architecture" style="width:100%"/> </p> ## ⚡ CI Status | Workflow | Status | |----------|--------| | CPU Tests | [![tests workflow status](https://github.com/microsoft/agent-lightning/actions/workflows/tests.yml/badge.svg)](https://github.com/microsoft/agent-lightning/actions/workflows/tests.yml) | | Full Tests | [![tests summary workflow status](https://github.com/microsoft/agent-lightning/actions/workflows/badge-unit.yml/badge.svg)](https://github.com/microsoft/agent-lightning/actions/workflows/badge-unit.yml) | | UI Tests | [![UI Tests](https://github.com/microsoft/agent-lightning/actions/workflows/dashboard.yml/badge.svg)](https://github.com/microsoft/agent-lightning/actions/workflows/dashboard.yml) | | Examples Integration | [![examples summary workflow status](https://github.com/microsoft/agent-lightning/actions/workflows/badge-examples.yml/badge.svg)](https://github.com/microsoft/agent-lightning/actions/workflows/badge-examples.yml) | | Latest Dependency Compatibility | [![latest summary workflow status](https://github.com/microsoft/agent-lightning/actions/workflows/badge-latest.yml/badge.svg)](https://github.com/microsoft/agent-lightning/actions/workflows/badge-latest.yml) | | Legacy Examples Compatibility | [![compat summary workflow status](https://github.com/microsoft/agent-lightning/actions/workflows/badge-compat.yml/badge.svg)](https://github.com/microsoft/agent-lightning/actions/workflows/badge-compat.yml) | ## ⚡ Citation If you find Agent Lightning useful in your research or projects, please cite our paper: ```bibtex @misc{luo2025agentlightningtrainai, title={Agent Lightning: Train ANY AI Agents with Reinforcement Learning}, author={Xufang Luo and Yuge Zhang and Zhiyuan He and Zilong Wang and Siyun Zhao and Dongsheng Li and Luna K. Qiu and Yuqing Yang}, year={2025}, eprint={2508.03680}, archivePrefix={arXiv}, primaryClass={cs.AI}, url={https://arxiv.org/abs/2508.03680}, } ``` ## ⚡ Contributing This project welcomes contributions and suggestions. Start by reading the [Contributing Guide](docs/community/contributing.md) for recommended contribution points, environment setup, branching conventions, and pull request expectations. 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. ## ⚡ 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). 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. ## ⚡ Responsible AI This project has been evaluated and certified to comply with the Microsoft Responsible AI Standard. The team will continue to monitor and maintain the repository, addressing any severe issues, including potential harms, if they arise. ## ⚡ License This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

AI Agents ML Frameworks
17.3K Github Stars
RD-Agent
Open Source

RD-Agent

<h4 align="center"> <img src="docs/_static/logo.png" alt="RA-Agent logo" style="width:70%; "> <a href="https://rdagent.azurewebsites.net" target="_blank">🖥️ Live Demo</a> | <a href="https://rdagent.azurewebsites.net/factor_loop" target="_blank">🎥 Demo Video</a> <a href="https://www.youtube.com/watch?v=JJ4JYO3HscM&list=PLALmKB0_N3_i52fhUmPQiL4jsO354uopR" target="_blank">▶️YouTube</a> | <a href="https://rdagent.readthedocs.io/en/latest/index.html" target="_blank">📖 Documentation</a> | <a href="https://aka.ms/RD-Agent-Tech-Report" target="_blank">📄 Tech Report</a> | <a href="#-paperwork-list"> 📃 Papers </a> </h3> [![CI](https://github.com/microsoft/RD-Agent/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/RD-Agent/actions/workflows/ci.yml) [![CodeQL](https://github.com/microsoft/RD-Agent/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/microsoft/RD-Agent/actions/workflows/github-code-scanning/codeql) [![Dependabot Updates](https://github.com/microsoft/RD-Agent/actions/workflows/dependabot/dependabot-updates/badge.svg)](https://github.com/microsoft/RD-Agent/actions/workflows/dependabot/dependabot-updates) [![Lint PR Title](https://github.com/microsoft/RD-Agent/actions/workflows/pr.yml/badge.svg)](https://github.com/microsoft/RD-Agent/actions/workflows/pr.yml) [![Release.yml](https://github.com/microsoft/RD-Agent/actions/workflows/release.yml/badge.svg)](https://github.com/microsoft/RD-Agent/actions/workflows/release.yml) [![Platform](https://img.shields.io/badge/platform-Linux-blue)](https://pypi.org/project/rdagent/#files) [![PyPI](https://img.shields.io/pypi/v/rdagent)](https://pypi.org/project/rdagent/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rdagent)](https://pypi.org/project/rdagent/) [![Release](https://img.shields.io/github/v/release/microsoft/RD-Agent)](https://github.com/microsoft/RD-Agent/releases) [![GitHub](https://img.shields.io/github/license/microsoft/RD-Agent)](https://github.com/microsoft/RD-Agent/blob/main/LICENSE) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![Chat](https://img.shields.io/badge/chat-discord-blue)](https://discord.gg/ybQ97B6Jjy) [![Documentation Status](https://readthedocs.org/projects/rdagent/badge/?version=latest)](https://rdagent.readthedocs.io/en/latest/?badge=latest) [![Readthedocs Preview](https://github.com/microsoft/RD-Agent/actions/workflows/readthedocs-preview.yml/badge.svg)](https://github.com/microsoft/RD-Agent/actions/workflows/readthedocs-preview.yml) <!-- this badge is too long, please place it in the last one to make it pretty --> [![arXiv](https://img.shields.io/badge/arXiv-2505.14738-00ff00.svg)](https://arxiv.org/abs/2505.14738) # 📰 News | 🗞️ News | 📝 Description | | -- | ------ | | ICML 2026 Acceptance | We are thrilled to announce that our paper [FT-Dojo: Towards Autonomous LLM Fine-Tuning with Language Agents](https://arxiv.org/abs/2603.01712) has been accepted to ICML 2026. The FT-Agent implementation is available in the [LLM fine-tuning guide](rdagent/app/finetune/llm/README.md). | | ACL 2026 Findings Acceptance | We are thrilled to announce that our paper [Reasoning as Gradient](https://arxiv.org/abs/2603.01692) has been accepted to ACL 2026 Findings. Execution traces are available at [Gome GPT-5 Traces](https://huggingface.co/datasets/amstrongzyf/Gome-GPT5-Traces) | | Web UI Release | We release a new frontend that can be built and served by `rdagent server_ui` for real-time interaction and trace viewing, currently excluding the `data_science` scenario. | | NeurIPS 2025 Acceptance | We are thrilled to announce that our paper [R&D-Agent-Quant](https://arxiv.org/abs/2505.15155) has been accepted to NeurIPS 2025 | | [Technical Report Release](#overall-technical-report) | Overall framework description and results on MLE-bench | | [R&D-Agent-Quant Release](#deep-application-in-diverse-scenarios) | Apply R&D-Agent to quant trading | | MLE-Bench Results Released | R&D-Agent currently leads as the [top-performing machine learning engineering agent](#-the-best-machine-learning-engineering-agent) on MLE-bench | | Support LiteLLM Backend | We now fully support **[LiteLLM](https://github.com/BerriAI/litellm)** as our default backend for integration with multiple LLM providers. | | General Data Science Agent | [Data Science Agent](https://rdagent.readthedocs.io/en/latest/scens/data_science.html) | | Kaggle Scenario release | We release **[Kaggle Agent](https://rdagent.readthedocs.io/en/latest/scens/data_science.html)**, try the new features! | | Official WeChat group release | We created a WeChat group, welcome to join! (🗪[QR Code](https://github.com/microsoft/RD-Agent/issues/880)) | | Official Discord release | We launch our first chatting channel in Discord (🗪[![Chat](https://img.shields.io/badge/chat-discord-blue)](https://discord.gg/ybQ97B6Jjy)) | | First release | **R&D-Agent** is released on GitHub | # 🏆 The Best Machine Learning Engineering Agent! [MLE-bench](https://github.com/openai/mle-bench) is a comprehensive benchmark evaluating the performance of AI agents on machine learning engineering tasks. Utilizing datasets from 75 Kaggle competitions, MLE-bench provides robust assessments of AI systems' capabilities in real-world ML engineering scenarios. R&D-Agent currently leads as the top-performing machine learning engineering agent on MLE-bench: | Agent | Low == Lite (%) | Medium (%) | High (%) | All (%) | |---------|--------|-----------|---------|----------| | R&D-Agent o3(R)+GPT-4.1(D) | 51.52 ± 6.9 | 19.3 ± 5.5 | 26.67 ± 0 | 30.22 ± 1.5 | | R&D-Agent o1-preview | 48.18 ± 2.49 | 8.95 ± 2.36 | 18.67 ± 2.98 | 22.4 ± 1.1 | | AIDE o1-preview | 34.3 ± 2.4 | 8.8 ± 1.1 | 10.0 ± 1.9 | 16.9 ± 1.1 | **Notes:** - **O3(R)+GPT-4.1(D)**: This version is designed to both reduce average time per loop and leverage a cost-effective combination of backend LLMs by seamlessly integrating Research Agent (o3) with Development Agent (GPT-4.1). - **AIDE o1-preview**: Represents the previously best public result on MLE-bench as reported in the original MLE-bench paper. - Average and standard deviation results for R&D-Agent o1-preview is based on a independent of 5 seeds and for R&D-Agent o3(R)+GPT-4.1(D) is based on 6 seeds. - According to MLE-Bench, the 75 competitions are categorized into three levels of complexity: **Low==Lite** if we estimate that an experienced ML engineer can produce a sensible solution in under 2 hours, excluding the time taken to train any models; **Medium** if it takes between 2 and 10 hours; and **High** if it takes more than 10 hours. You can inspect the detailed runs of the above results online. - [R&D-Agent o1-preview detailed runs](https://aka.ms/RD-Agent_MLE-Bench_O1-preview) - [R&D-Agent o3(R)+GPT-4.1(D) detailed runs](https://aka.ms/RD-Agent_MLE-Bench_O3_GPT41) For running R&D-Agent on MLE-bench, refer to **[MLE-bench Guide: Running ML Engineering via MLE-bench](https://rdagent.readthedocs.io/en/latest/scens/data_science.html)** # 🥇 The First Data-Centric Quant Multi-Agent Framework! R&D-Agent for Quantitative Finance, in short **RD-Agent(Q)**, is the first data-centric, multi-agent framework designed to automate the full-stack research and development of quantitative strategies via coordinated factor-model co-optimization. ![image](https://github.com/user-attachments/assets/3198bc10-47ba-4ee0-8a8e-46d5ce44f45d) Extensive experiments in real stock markets show that, at a cost under $10, RD-Agent(Q) achieves approximately 2× higher ARR than benchmark factor libraries while using over 70% fewer factors. It also surpasses state-of-the-art deep time-series models under smaller resource budgets. Its alternating factor–model optimization further delivers excellent trade-off between predictive accuracy and strategy robustness. You can learn more details about **RD-Agent(Q)** through the [paper](https://arxiv.org/abs/2505.15155) and reproduce it through the [documentation](https://rdagent.readthedocs.io/en/latest/scens/quant_agent_fin.html). # Data Science Agent Preview Check out our demo video showcasing the current progress of our Data Science Agent under development: https://github.com/user-attachments/assets/3eccbecb-34a4-4c81-bce4-d3f8862f7305 # 🌟 Introduction <div align="center"> <img src="docs/_static/scen.png" alt="Our focused scenario" style="width:80%; "> </div> R&D-Agent aims to automate the most critical and valuable aspects of the industrial R&D process, and we begin with focusing on the data-driven scenarios to streamline the development of models and data. Methodologically, we have identified a framework with two key components: 'R' for proposing new ideas and 'D' for implementing them. We believe that the automatic evolution of R&D will lead to solutions of significant industrial value. <!-- Tag Cloud --> R&D is a very general scenario. The advent of R&D-Agent can be your - 💰 **Automatic Quant Factory** ([🎥Demo Video](https://rdagent.azurewebsites.net/factor_loop)|[▶️YouTube](https://www.youtube.com/watch?v=X4DK2QZKaKY&t=6s)) - 🤖 **Data Mining Agent:** Iteratively proposing data & models ([🎥Demo Video 1](https://rdagent.azurewebsites.net/model_loop)|[▶️YouTube](https://www.youtube.com/watch?v=dm0dWL49Bc0&t=104s)) ([🎥Demo Video 2](https://rdagent.azurewebsites.net/dmm)|[▶️YouTube](https://www.youtube.com/watch?v=VIaSTZuoZg4)) and implementing them by gaining knowledge from data. - 🦾 **Research Copilot:** Auto read research papers ([🎥Demo Video](https://rdagent.azurewebsites.net/report_model)|[▶️YouTube](https://www.youtube.com/watch?v=BiA2SfdKQ7o)) / financial reports ([🎥Demo Video](https://rdagent.azurewebsites.net/report_factor)|[▶️YouTube](https://www.youtube.com/watch?v=ECLTXVcSx-c)) and implement model structures or building datasets. - 🤖 **Kaggle Agent:** Auto Model Tuning and Feature Engineering([🎥Demo Video Coming Soon...]()) and implementing them to achieve more in competitions. - 🧪 **FT-Agent:** Autonomous LLM fine-tuning for benchmark-driven domain adaptation. See the [LLM fine-tuning guide](rdagent/app/finetune/llm/README.md). - ... You can click the links above to view the demo. We're continuously adding more methods and scenarios to the project to enhance your R&D processes and boost productivity. Additionally, you can take a closer look at the examples in our **[🖥️ Live Demo](https://rdagent.azurewebsites.net/)**. <div align="center"> <a href="https://rdagent.azurewebsites.net/" target="_blank"> <img src="docs/_static/demo.png" alt="Watch the demo" width="80%"> </a> </div> # ⚡ Quick start ### RD-Agent currently only supports Linux. You can try above demos by running the following command: ### 🐳 Docker installation. Users must ensure Docker is installed before attempting most scenarios. Please refer to the [official 🐳Docker page](https://docs.docker.com/engine/install/) for installation instructions. Ensure the current user can run Docker commands **without using sudo**. You can verify this by executing `docker run hello-world`. ### 🐍 Create a Conda Environment - Create a new conda environment with Python (3.10 and 3.11 are well-tested in our CI): ```sh conda create -n rdagent python=3.10 ``` - Activate the environment: ```sh conda activate rdagent ``` ### 🛠️ Install the R&D-Agent #### For Users - You can directly install the R&D-Agent package from PyPI: ```sh pip install rdagent ``` #### For Developers - If you want to try the latest version or contribute to RD-Agent, you can install it from the source and follow the development setup: ```sh git clone https://github.com/microsoft/RD-Agent cd RD-Agent make dev ``` More details can be found in the [development setup](https://rdagent.readthedocs.io/en/latest/development.html). ### 💊 Health check - rdagent provides a health check that currently checks two things. - whether the docker installation was successful. - whether the default port used by the [rdagent ui](https://github.com/microsoft/RD-Agent?tab=readme-ov-file#%EF%B8%8F-monitor-the-application-results) is occupied. ```sh rdagent health_check --no-check-env ``` ### ⚙️ Configuration - The demos requires following ability: - ChatCompletion - json_mode - embedding query You can set your Chat Model and Embedding Model in the following ways: > **🔥 Attention**: We now provide experimental support for **DeepSeek** models! You can use DeepSeek's official API for cost-effective and high-performance inference. See the configuration example below for DeepSeek setup. - **Using LiteLLM (Default)**: We now support LiteLLM as a backend for integration with multiple LLM providers. You can configure in multiple ways: **Option 1: Unified API base for both models** *Configuration Example: `OpenAI` Setup :* ```bash cat << EOF > .env # Set to any model supported by LiteLLM. CHAT_MODEL=gpt-4o EMBEDDING_MODEL=text-embedding-3-small # Configure unified API base OPENAI_API_BASE=<your_unified_api_base> OPENAI_API_KEY=<replace_with_your_openai_api_key> ``` *Configuration Example: `Azure OpenAI` Setup :* > Before using this configuration, please confirm in advance that your `Azure OpenAI API key` supports `embedded models`. ```bash cat << EOF > .env EMBEDDING_MODEL=azure/<Model deployment supporting embedding> CHAT_MODEL=azure/<your deployment name> AZURE_API_KEY=<replace_with_your_openai_api_key> AZURE_API_BASE=<your_unified_api_base> AZURE_API_VERSION=<azure api version> ``` **Option 2: Separate API bases for Chat and Embedding models** ```bash cat << EOF > .env # Set to any model supported by LiteLLM. # Configure separate API bases for chat and embedding # CHAT MODEL: CHAT_MODEL=gpt-4o OPENAI_API_BASE=<your_chat_api_base> OPENAI_API_KEY=<replace_with_your_openai_api_key> # EMBEDDING MODEL: # TAKE siliconflow as an example, you can use other providers. # Note: embedding requires litellm_proxy prefix EMBEDDING_MODEL=litellm_proxy/BAAI/bge-large-en-v1.5 LITELLM_PROXY_API_KEY=<replace_with_your_siliconflow_api_key> LITELLM_PROXY_API_BASE=https://api.siliconflow.cn/v1 ``` *Configuration Example: `DeepSeek` Setup :* >Since many users encounter configuration errors when setting up DeepSeek. Here's a complete working example for DeepSeek Setup: ```bash cat << EOF > .env # CHAT MODEL: Using DeepSeek Official API CHAT_MODEL=deepseek/deepseek-chat DEEPSEEK_API_KEY=<replace_with_your_deepseek_api_key> # EMBEDDING MODEL: Using SiliconFlow for embedding since deepseek has no embedding model. # Note: embedding requires litellm_proxy prefix EMBEDDING_MODEL=litellm_proxy/BAAI/bge-m3 LITELLM_PROXY_API_KEY=<replace_with_your_siliconflow_api_key> LITELLM_PROXY_API_BASE=https://api.siliconflow.cn/v1 ``` Notice: If you are using reasoning models that include thought processes in their responses (such as \<think> tags), you need to set the following environment variable: ```bash REASONING_THINK_RM=True ``` You can also use a deprecated backend if you only use `OpenAI API` or `Azure OpenAI` directly. For this deprecated setting and more configuration information, please refer to the [documentation](https://rdagent.readthedocs.io/en/latest/installation_and_configuration.html). - If your environment configuration is complete, please execute the following commands to check if your configuration is valid. This step is necessary. ```bash rdagent health_check ``` ### 🚀 Run the Application The **[🖥️ Live Demo](https://rdagent.azurewebsites.net/)** is implemented by the following commands(each item represents one demo, you can select the one you prefer): - Run the **Automated Quantitative Trading & Iterative Factors Model Joint Evolution**: [Qlib](http://github.com/microsoft/qlib) self-loop factor & model proposal and implementation application ```sh rdagent fin_quant ``` - Run the **Automated Quantitative Trading & Iterative Factors Evolution**: [Qlib](http://github.com/microsoft/qlib) self-loop factor proposal and implementation application ```sh rdagent fin_factor ``` - Run the **Automated Quantitative Trading & Iterative Model Evolution**: [Qlib](http://github.com/microsoft/qlib) self-loop model proposal and implementation application ```sh rdagent fin_model ``` - Run the **Automated Quantitative Trading & Factors Extraction from Financial Reports**: Run the [Qlib](http://github.com/microsoft/qlib) factor extraction and implementation application based on financial reports ```sh # 1. Generally, you can run this scenario using the following command: rdagent fin_factor_report --report-folder=<Your financial reports folder path> # 2. Specifically, you need to prepare some financial reports first. You can follow this concrete example: wget https://github.com/SunsetWolf/rdagent_resource/releases/download/reports/all_reports.zip unzip all_reports.zip -d git_ignore_folder/reports rdagent fin_factor_report --report-folder=git_ignore_folder/reports ``` - Run the **Automated Model Research & Development Copilot**: model extraction and implementation application ```sh # 1. Generally, you can run your own papers/reports with the following command: rdagent general_model <Your paper URL> # 2. Specifically, you can do it like this. For more details and additional paper examples, use `rdagent general_model -h`: rdagent general_model "https://arxiv.org/pdf/2210.09789" ``` - Run the **Automated Medical Prediction Model Evolution**: Medical self-loop model proposal and implementation application ```bash # Generally, you can run the data science program with the following command: rdagent data_science --competition <your competition name> # Specifically, you need to create a folder for storing competition files (e.g., competition description file, competition datasets, etc.), and configure the path to the folder in your environment. In addition, you need to use chromedriver when you download the competition descriptors, which you can follow for this specific example: # 1. Download the dataset, extract it to the target folder. wget https://github.com/SunsetWolf/rdagent_resource/releases/download/ds_data/arf-12-hours-prediction-task.zip unzip arf-12-hours-prediction-task.zip -d ./git_ignore_folder/ds_data/ # 2. Configure environment variables in the `.env` file dotenv set DS_LOCAL_DATA_PATH "$(pwd)/git_ignore_folder/ds_data" dotenv set DS_CODER_ON_WHOLE_PIPELINE True dotenv set DS_IF_USING_MLE_DATA False dotenv set DS_SAMPLE_DATA_BY_LLM False dotenv set DS_SCEN rdagent.scenarios.data_science.scen.DataScienceScen # 3. run the application rdagent data_science --competition arf-12-hours-prediction-task ``` **NOTE:** For more information about the dataset, please refer to the [documentation](https://rdagent.readthedocs.io/en/latest/scens/data_science.html). - Run the **Automated Kaggle Model Tuning & Feature Engineering**: self-loop model proposal and feature engineering implementation application <br /> > Using **tabular-playground-series-dec-2021** as an example. <br /> > 1. Register and login on the [Kaggle](https://www.kaggle.com/) website. <br /> > 2. Configuring the Kaggle API. <br /> > (1) Click on the avatar (usually in the top right corner of the page) -> `Settings` -> `Create New Token`, A file called `kaggle.json` will be downloaded. <br /> > (2) Move `kaggle.json` to `~/.config/kaggle/` <br /> > (3) Modify the permissions of the kaggle.json file. Reference command: `chmod 600 ~/.config/kaggle/kaggle.json` <br /> > 3. Join the competition: Click `Join the competition` -> `I Understand and Accept` at the bottom of the [competition details page](https://www.kaggle.com/competitions/tabular-playground-series-dec-2021/data). ```bash # Generally, you can run the Kaggle competition program with the following command: rdagent data_science --competition <your competition name> # 1. Configure environment variables in the `.env` file mkdir -p ./git_ignore_folder/ds_data dotenv set DS_LOCAL_DATA_PATH "$(pwd)/git_ignore_folder/ds_data" dotenv set DS_CODER_ON_WHOLE_PIPELINE True dotenv set DS_IF_USING_MLE_DATA True dotenv set DS_SAMPLE_DATA_BY_LLM True dotenv set DS_SCEN rdagent.scenarios.data_science.scen.KaggleScen # 2. run the application rdagent data_science --competition tabular-playground-series-dec-2021 ``` - Run **FT-Agent for Autonomous LLM Fine-Tuning**: an ICML 2026 LLM fine-tuning scenario for benchmark-driven data processing, training, evaluation, and feedback-guided refinement. ```bash # See the full setup, benchmark descriptions, dataset notes, and examples: # rdagent/app/finetune/llm/README.md # Configure FT_TARGET_BENCHMARK and FT_BENCHMARK_DESCRIPTION before running. rdagent llm_finetune --base-model Qwen/Qwen2.5-7B-Instruct ``` ### 🖥️ Monitor the Application Results #### Streamlit UI Use the Streamlit UI to view run logs, especially for the `data_science` scenario. ```sh rdagent ui --port 19899 --log-dir <your log folder like "log/"> --data-science ``` About the `data_science` parameter: If you want to see the logs of the data science scenario, set the `data_science` parameter to `True`; otherwise set it to `False`. #### Web UI We also provide a separate web frontend in `web/` for the Flask backend started by `server_ui`. **NOTE:** This web UI is different from `rdagent ui`. The current web UI does not support the `data_science` scenario yet. For the `data_science` scenario, please continue to use `rdagent ui --data-science`. ```sh cd web npm install ``` To build the frontend for the Flask backend, generate the static assets into the default directory used by `server_ui`: ```sh cd web npm run build:flask ``` By default, `server_ui` serves static files from `./git_ignore_folder/static`. If you need a different location, set the `UI_STATIC_PATH` environment variable before starting the backend. Start the Flask backend and serve the built frontend together with the real-time APIs: ```sh rdagent server_ui --port 19899 ``` After that, open `http://127.0.0.1:19899` in your browser. #### Common Notes Port `19899` is used in the examples above. Before starting either UI, check whether this port is already occupied. If it is, please change it to another available port. You can check whether the port is occupied by running: ```sh rdagent health_check --no-check-env --no-check-docker ``` # 🏭 Scenarios We have applied R&D-Agent to multiple valuable data-driven industrial scenarios. ## 🎯 Goal: Agent for Data-driven R&D In this project, we are aiming to build an Agent to automate Data-Driven R\&D that can + 📄 Read real-world material (reports, papers, etc.) and **extract** key formulas, descriptions of interested **features** and **models**, which are the key components of data-driven R&D . + 🛠️ **Implement** the extracted formulas (e.g., features, factors, and models) in runnable codes. + Due to the limited ability of LLM in implementing at once, build an evolving process for the agent to improve performance by learning from feedback and knowledge. + 💡 Propose **new ideas** based on current knowledge and observations. <!-- ![Data-Centric R&D Overview](docs/_static/overview.png) --> ## 📈 Scenarios/Demos In the two key areas of data-driven scenarios, model implementation and data building, our system aims to serve two main roles: 🦾Copilot and 🤖Agent. - The 🦾Copilot follows human instructions to automate repetitive tasks. - The 🤖Agent, being more autonomous, actively proposes ideas for better results in the future. The supported scenarios are listed below: | Scenario/Target | Model Implementation | Data Building | | -- | -- | -- | | **💹 Finance** | 🤖 [Iteratively Proposing Ideas & Evolving](https://rdagent.azurewebsites.net/model_loop)[▶️YouTube](https://www.youtube.com/watch?v=dm0dWL49Bc0&t=104s) | 🤖 [Iteratively Proposing Ideas & Evolving](https://rdagent.azurewebsites.net/factor_loop) [▶️YouTube](https://www.youtube.com/watch?v=X4DK2QZKaKY&t=6s) <br/> 🦾 [Auto reports reading & implementation](https://rdagent.azurewebsites.net/report_factor)[▶️YouTube](https://www.youtube.com/watch?v=ECLTXVcSx-c) | | **🩺 Medical** | 🤖 [Iteratively Proposing Ideas & Evolving](https://rdagent.azurewebsites.net/dmm)[▶️YouTube](https://www.youtube.com/watch?v=VIaSTZuoZg4) | - | | **🏭 General** | 🦾 [Auto paper reading & implementation](https://rdagent.azurewebsites.net/report_model)[▶️YouTube](https://www.youtube.com/watch?v=BiA2SfdKQ7o) <br/> 🤖 Auto Kaggle Model Tuning | 🤖Auto Kaggle feature Engineering | - **[RoadMap](https://rdagent.readthedocs.io/en/latest/scens/data_science.html#roadmap)**: Currently, we are working hard to add new features to the Kaggle scenario. Different scenarios vary in entrance and configuration. Please check the detailed setup tutorial in the scenarios documents. Here is a gallery of [successful explorations](https://github.com/SunsetWolf/rdagent_resource/releases/download/demo_traces/demo_traces.zip) (5 traces showed in **[🖥️ Live Demo](https://rdagent.azurewebsites.net/)**). You can download and view the execution trace using [this command](https://github.com/microsoft/RD-Agent?tab=readme-ov-file#%EF%B8%8F-monitor-the-application-results) from the documentation. Please refer to **[📖readthedocs_scen](https://rdagent.readthedocs.io/en/latest/scens/catalog.html)** for more details of the scenarios. # ⚙️ Framework <div align="center"> <img src="docs/_static/Framework-RDAgent.png" alt="Framework-RDAgent" width="85%"> </div> Automating the R&D process in data science is a highly valuable yet underexplored area in industry. We propose a framework to push the boundaries of this important research field. The research questions within this framework can be divided into three main categories: | Research Area | Paper/Work List | |--------------------|-----------------| | **Benchmark the R&D abilities** | [Benchmark](#benchmark) | | **Idea proposal:** Explore new ideas or refine existing ones | [Research](#research) | | **Ability to realize ideas:** Implement and execute ideas | [Development](#development) | We believe that the key to delivering high-quality solutions lies in the ability to evolve R&D capabilities. Agents should learn like human experts, continuously improving their R&D skills. More documents can be found in the **[📖 readthedocs](https://rdagent.readthedocs.io/)**. # 📃 Paper/Work list ## Overall Technical Report - [R&D-Agent: An LLM-Agent Framework Towards Autonomous Data Science](https://arxiv.org/abs/2505.14738) ```BibTeX @misc{yang2025rdagentllmagentframeworkautonomous, title={R&D-Agent: An LLM-Agent Framework Towards Autonomous Data Science}, author={Xu Yang and Xiao Yang and Shikai Fang and Yifei Zhang and Jian Wang and Bowen Xian and Qizheng Li and Jingyuan Li and Minrui Xu and Yuante Li and Haoran Pan and Yuge Zhang and Weiqing Liu and Yelong Shen and Weizhu Chen and Jiang Bian}, year={2025}, eprint={2505.14738}, archivePrefix={arXiv}, primaryClass={cs.AI}, url={https://arxiv.org/abs/2505.14738}, } ``` ![image](https://github.com/user-attachments/assets/28b0488d-a546-4fef-8dc5-563ed64a9b4d) ## 📊 Benchmark - [Towards Data-Centric Automatic R&D](https://arxiv.org/abs/2404.11276) ```BibTeX @misc{chen2024datacentric, title={Towards Data-Centric Automatic R&D}, author={Haotian Chen and Xinjie Shen and Zeqi Ye and Wenjun Feng and Haoxue Wang and Xiao Yang and Xu Yang and Weiqing Liu and Jiang Bian}, year={2024}, eprint={2404.11276}, archivePrefix={arXiv}, primaryClass={cs.AI} } ``` ![image](https://github.com/user-attachments/assets/494f55d3-de9e-4e73-ba3d-a787e8f9e841) ## 🔍 Research In a data mining expert's daily research and development process, they propose a hypothesis (e.g., a model structure like RNN can capture patterns in time-series data), design experiments (e.g., finance data contains time-series and we can verify the hypothesis in this scenario), implement the experiment as code (e.g., Pytorch model structure), and then execute the code to get feedback (e.g., metrics, loss curve, etc.). The experts learn from the feedback and improve in the next iteration. Based on the principles above, we have established a basic method framework that continuously proposes hypotheses, verifies them, and gets feedback from the real-world practice. This is the first scientific research automation framework that supports linking with real-world verification. For more detail, please refer to our **[🖥️ Live Demo page](https://rdagent.azurewebsites.net)**. ## 🛠️ Development - [Collaborative Evolving Strategy for Automatic Data-Centric Development](https://arxiv.org/abs/2407.18690) ```BibTeX @misc{yang2024collaborative, title={Collaborative Evolving Strategy for Automatic Data-Centric Development}, author={Xu Yang and Haotian Chen and Wenjun Feng and Haoxue Wang and Zeqi Ye and Xinjie Shen and Xiao Yang and Shizhao Sun and Weiqing Liu and Jiang Bian}, year={2024}, eprint={2407.18690}, archivePrefix={arXiv}, primaryClass={cs.AI} } ``` ![image](https://github.com/user-attachments/assets/75d9769b-0edd-4caf-9d45-57d1e577054b) ## Deep Application in Diverse Scenarios - [FT-Dojo: Towards Autonomous LLM Fine-Tuning with Language Agents](https://arxiv.org/abs/2603.01712) ```BibTeX @misc{li2026ftdojo, title={FT-Dojo: Towards Autonomous LLM Fine-Tuning with Language Agents}, author={Qizheng Li and Yifei Zhang and Xiao Yang and Xu Yang and Zhuo Wang and Weiqing Liu and Jiang Bian}, year={2026}, eprint={2603.01712}, archivePrefix={arXiv}, primaryClass={cs.AI}, url={https://arxiv.org/abs/2603.01712} } ``` FT-Agent, the autonomous LLM fine-tuning scenario from this paper, is available through the [LLM fine-tuning guide](rdagent/app/finetune/llm/README.md). - [R&D-Agent-Quant: A Multi-Agent Framework for Data-Centric Factors and Model Joint Optimization](https://arxiv.org/abs/2505.15155) ```BibTeX @misc{li2025rdagentquantmultiagentframeworkdatacentric, title={R&D-Agent-Quant: A Multi-Agent Framework for Data-Centric Factors and Model Joint Optimization}, author={Yuante Li and Xu Yang and Xiao Yang and Minrui Xu and Xisen Wang and Weiqing Liu and Jiang Bian}, year={2025}, eprint={2505.15155}, archivePrefix={arXiv}, primaryClass={q-fin.CP}, url={https://arxiv.org/abs/2505.15155}, } ``` ![image](https://github.com/user-attachments/assets/3186f67a-c2f8-4b6b-8bb9-a9b959c13866) - [Reasoning as Gradient: Scaling MLE Agents Beyond Tree Search](https://arxiv.org/abs/2603.01692) ```BibTeX @article{zhang2026reasoning, title={Reasoning as Gradient: Scaling MLE Agents Beyond Tree Search}, author={Zhang, Yifei and Yang, Xu and Yang, Xiao and Xian, Bowen and Li, Qizheng and Fang, Shikai and Li, Jingyuan and Wang, Jian and Xu, Mingrui and Liu, Weiqing and others}, journal={arXiv preprint arXiv:2603.01692}, year={2026} } ``` You can check the detailed execution traces online at [Gome GPT-5 Traces](https://huggingface.co/datasets/amstrongzyf/Gome-GPT5-Traces). # 🤝 Contributing We welcome contributions and suggestions to improve R&D-Agent. Please refer to the [Contributing Guide](CONTRIBUTING.md) for more details on how to contribute. Before submitting a pull request, ensure that your code passes the automatic CI checks. ## 📝 Guidelines This project welcomes contributions and suggestions. Contributing to this project is straightforward and rewarding. Whether it's solving an issue, addressing a bug, enhancing documentation, or even correcting a typo, every contribution is valuable and helps improve R&D-Agent. To get started, you can explore the issues list, or search for `TODO:` comments in the codebase by running the command `grep -r "TODO:"`. <img src="https://img.shields.io/github/contributors-anon/microsoft/RD-Agent"/> <a href="https://github.com/microsoft/RD-Agent/graphs/contributors"> <img src="https://contrib.rocks/image?repo=microsoft/RD-Agent&max=100&columns=15" /> </a> Before we released R&D-Agent as an open-source project on GitHub, it was an internal project within our group. Unfortunately, the internal commit history was not preserved when we removed some confidential code. As a result, some contributions from our group members, including Haotian Chen, Wenjun Feng, Haoxue Wang, Zeqi Ye, Xinjie Shen, and Jinhui Li, were not included in the public commits. # ⚖️ Legal disclaimer <p style="line-height: 1; font-style: italic;">The RD-agent is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. The RD-agent is aimed to facilitate research and development process in the financial industry and not ready-to-use for any financial investment or advice. Users shall independently assess and test the risks of the RD-agent in a specific use scenario, ensure the responsible use of AI technology, including but not limited to developing and integrating risk mitigation measures, and comply with all applicable laws and regulations in all applicable jurisdictions. The RD-agent does not provide financial opinions or reflect the opinions of Microsoft, nor is it designed to replace the role of qualified financial professionals in formulating, assessing, and approving finance products. The inputs and outputs of the RD-agent belong to the users and users shall assume all liability under any theory of liability, whether in contract, torts, regulatory, negligence, products liability, or otherwise, associated with use of the RD-agent and any inputs and outputs thereof.</p>

Analytics & BI AI Agents
13.4K Github Stars
promptflow
Open Source

promptflow

# Prompt flow [![Python package](https://img.shields.io/pypi/v/promptflow)](https://pypi.org/project/promptflow/) [![Python](https://img.shields.io/pypi/pyversions/promptflow.svg?maxAge=2592000)](https://pypi.python.org/pypi/promptflow/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/promptflow)](https://pypi.org/project/promptflow/) [![CLI](https://img.shields.io/badge/CLI-reference-blue)](https://microsoft.github.io/promptflow/reference/pf-command-reference.html) [![vsc extension](https://img.shields.io/visual-studio-marketplace/i/prompt-flow.prompt-flow?logo=Visual%20Studio&label=Extension%20)](https://marketplace.visualstudio.com/items?itemName=prompt-flow.prompt-flow) [![Doc](https://img.shields.io/badge/Doc-online-green)](https://microsoft.github.io/promptflow/index.html) [![Issue](https://img.shields.io/github/issues/microsoft/promptflow)](https://github.com/microsoft/promptflow/issues/new/choose) [![Discussions](https://img.shields.io/github/discussions/microsoft/promptflow)](https://github.com/microsoft/promptflow/issues/new/choose) [![CONTRIBUTING](https://img.shields.io/badge/Contributing-8A2BE2)](https://github.com/microsoft/promptflow/blob/main/CONTRIBUTING.md) [![License: MIT](https://img.shields.io/github/license/microsoft/promptflow)](https://github.com/microsoft/promptflow/blob/main/LICENSE) > Welcome to join us to make prompt flow better by > participating [discussions](https://github.com/microsoft/promptflow/discussions), > opening [issues](https://github.com/microsoft/promptflow/issues/new/choose), > submitting [PRs](https://github.com/microsoft/promptflow/pulls). **Prompt flow** is a suite of development tools designed to streamline the end-to-end development cycle of LLM-based AI applications, from ideation, prototyping, testing, evaluation to production deployment and monitoring. It makes prompt engineering much easier and enables you to build LLM apps with production quality. With prompt flow, you will be able to: - **Create and iteratively develop flow** - Create executable [flows](https://microsoft.github.io/promptflow/concepts/concept-flows.html) that link LLMs, prompts, Python code and other [tools](https://microsoft.github.io/promptflow/concepts/concept-tools.html) together. - Debug and iterate your flows, especially [tracing interaction with LLMs](https://microsoft.github.io/promptflow/how-to-guides/tracing/index.html) with ease. - **Evaluate flow quality and performance** - Evaluate your flow's quality and performance with larger datasets. - Integrate the testing and evaluation into your CI/CD system to ensure quality of your flow. - **Streamlined development cycle for production** - Deploy your flow to the serving platform you choose or integrate into your app's code base easily. - (Optional but highly recommended) Collaborate with your team by leveraging the cloud version of [Prompt flow in Azure AI](https://learn.microsoft.com/en-us/azure/machine-learning/prompt-flow/overview-what-is-prompt-flow?view=azureml-api-2). ------ ## Installation To get started quickly, you can use a pre-built development environment. **Click the button below** to open the repo in GitHub Codespaces, and then continue the readme! [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/promptflow?quickstart=1) If you want to get started in your local environment, first install the packages: Ensure you have a python environment, `python>=3.9, <=3.11` is recommended. ```sh pip install promptflow promptflow-tools ``` ## Quick Start ⚡ **Create a chatbot with prompt flow** Run the command to initiate a prompt flow from a chat template, it creates folder named `my_chatbot` and generates required files within it: ```sh pf flow init --flow ./my_chatbot --type chat ``` **Setup a connection for your API key** For OpenAI key, establish a connection by running the command, using the `openai.yaml` file in the `my_chatbot` folder, which stores your OpenAI key (override keys and name with --set to avoid yaml file changes): ```sh pf connection create --file ./my_chatbot/openai.yaml --set api_key=<your_api_key> --name open_ai_connection ``` For Azure OpenAI key, establish the connection by running the command, using the `azure_openai.yaml` file: ```sh pf connection create --file ./my_chatbot/azure_openai.yaml --set api_key=<your_api_key> api_base=<your_api_base> --name open_ai_connection ``` **Chat with your flow** In the `my_chatbot` folder, there's a `flow.dag.yaml` file that outlines the flow, including inputs/outputs, nodes, connection, and the LLM model, etc > Note that in the `chat` node, we're using a connection named `open_ai_connection` (specified in `connection` field) and the `gpt-35-turbo` model (specified in `deployment_name` field). The deployment_name filed is to specify the OpenAI model, or the Azure OpenAI deployment resource. Interact with your chatbot by running: (press `Ctrl + C` to end the session) ```sh pf flow test --flow ./my_chatbot --interactive ``` **Core value: ensuring "High Quality” from prototype to production** Explore our [**15-minute tutorial**](examples/tutorials/flow-fine-tuning-evaluation/promptflow-quality-improvement.md) that guides you through prompt tuning ➡ batch testing ➡ evaluation, all designed to ensure high quality ready for production. Next Step! Continue with the **Tutorial** 👇 section to delve deeper into prompt flow. ## Tutorial 🏃‍♂️ Prompt flow is a tool designed to **build high quality LLM apps**, the development process in prompt flow follows these steps: develop a flow, improve the flow quality, deploy the flow to production. ### Develop your own LLM apps #### VS Code Extension We also offer a VS Code extension (a flow designer) for an interactive flow development experience with UI. <img src="docs/media/readme/vsc.png" alt="vsc" width="1000"/> You can install it from the <a href="https://marketplace.visualstudio.com/items?itemName=prompt-flow.prompt-flow">visualstudio marketplace</a>. #### Deep delve into flow development [Getting started with prompt flow](./docs/how-to-guides/quick-start.md): A step by step guidance to invoke your first flow run. ### Learn from use cases [Tutorial: Chat with PDF](https://github.com/microsoft/promptflow/blob/main/examples/tutorials/e2e-development/chat-with-pdf.md): An end-to-end tutorial on how to build a high quality chat application with prompt flow, including flow development and evaluation with metrics. > More examples can be found [here](https://microsoft.github.io/promptflow/tutorials/index.html#samples). We welcome contributions of new use cases! ### Setup for contributors If you're interested in contributing, please start with our dev setup guide: [dev_setup.md](./docs/dev/dev_setup.md). Next Step! Continue with the **Contributing** 👇 section to contribute to prompt flow. ## 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. ## 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). 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. ## Code of Conduct 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. ## Data Collection The software may collect information about you and your use of the software and send it to Microsoft if configured to enable telemetry. Microsoft may use this information to provide services and improve our products and services. You may turn on the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices. ### Telemetry Configuration Telemetry collection is on by default. To opt out, please run `pf config set telemetry.enabled=false` to turn it off. ## License Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the [MIT](LICENSE) license.

Developer Tools Workflow Automation
11.1K Github Stars
UFO
Open Source

UFO

<!-- markdownlint-disable MD033 MD041 --> <h1 align="center"> <b>UFO³</b> <img src="assets/logo3.png" alt="UFO logo" width="70" style="vertical-align: -30px;"> : Weaving the Digital Agent Galaxy </h1> <p align="center"> <em>From Single Device Agent to Multi-Device Galaxy</em> </p> <p align="center"> <strong>📖 Language / 语言:</strong> <a href="README.md"><strong>English</strong></a> | <a href="README_ZH.md">中文</a> </p> <div align="center"> <a href="https://trendshift.io/repositories/7874" target="_blank"><img src="https://trendshift.io/api/badge/repositories/7874" alt="microsoft%2FUFO | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a> <br/> [![arxiv](https://img.shields.io/badge/Paper-arXiv:2511.11332-b31b1b.svg)](https://arxiv.org/abs/2511.11332)&ensp; [![arxiv](https://img.shields.io/badge/Paper-arXiv:2504.14603-b31b1b.svg)](https://arxiv.org/abs/2504.14603)&ensp; ![Python Version](https://img.shields.io/badge/Python-3776AB?&logo=python&logoColor=white-blue&label=3.10%20%7C%203.11)&ensp; [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)&ensp; [![Documentation](https://img.shields.io/badge/Documentation-%230ABAB5?style=flat&logo=readthedocs&logoColor=black)](https://microsoft.github.io/UFO/)&ensp; [![YouTube](https://img.shields.io/badge/YouTube-white?logo=youtube&logoColor=%23FF0000)](https://www.youtube.com/watch?v=NGrVWGcJL8o)&ensp; </div> <p align="center"> <strong>📚 Quick Links:</strong> <a href="./galaxy/README.md">🌌 UFO³ README</a> • <a href="./ufo/README.md">🖥️ UFO² README</a> • <a href="https://microsoft.github.io/UFO/">📖 Full Documentation</a> </p> --- ## 🎯 Choose Your Path <table align="center" width="95%"> <tr> <td width="50%" valign="top"> ### <img src="assets/logo3.png" alt="Galaxy logo" width="40" style="vertical-align: -10px;"> **UFO³ Multi-Device Agent Galaxy** <sub>**✨ NEW & RECOMMENDED**</sub> **Perfect for:** - 🔗 Cross-device collaboration workflows - 📊 Complex multi-step automation - 🎯 DAG-based task orchestration - 🌍 Heterogeneous platform integration **Key Features:** - **Constellation**: Task decomposition into executable DAGs - **Dynamic DAG editing** for adaptive workflow evolution - **Asynchronous execution** with parallel task coordination - **Unified AIP protocol** for secure agent communication **📖 [Galaxy Documentation →](./galaxy/README.md)** **📖 [Galaxy Quick Start →](https://microsoft.github.io/UFO/getting_started/quick_start_galaxy/)** ⭐ **Online Docs** </td> <td width="50%" valign="top"> ### <img src="assets/ufo_blue.png" alt="UFO² logo" width="30" style="vertical-align: -5px;"> **UFO² Desktop AgentOS** <sub>**STABLE & BATTLE-TESTED**</sub> **Perfect for:** - 💻 Single Windows automation - ⚡ Quick task execution - 🎓 Learning agent basics - 🛠️ Simple workflows **Key Features:** - Deep Windows OS integration - Hybrid GUI + API actions - Proven reliability - Easy setup - Can serve as Galaxy device agent **📖 [UFO² Documentation →](./ufo/README.md)** </td> </tr> </table> --- ## 🎬 See UFO³ Galaxy in Action Watch how UFO³ Galaxy orchestrates complex workflows across multiple devices: <div align="center"> <a href="https://www.youtube.com/watch?v=NGrVWGcJL8o"> <img src="assets/poster_with_play.png" alt="UFO³ Galaxy Demo" width="90%"> </a> <p><em>🎥 Click to watch: Cross-device task orchestration with UFO³ Galaxy</em></p> </div> --- ## 🌟 What's New in UFO³? ### Evolution Timeline ```mermaid %%{init: {'theme':'base', 'themeVariables': { 'primaryColor':'#E8F4F8','primaryTextColor':'#1A1A1A','primaryBorderColor':'#7CB9E8','lineColor':'#A8D5E2','secondaryColor':'#B8E6F0','tertiaryColor':'#D4F1F4','fontSize':'16px','fontFamily':'Segoe UI, Arial, sans-serif'}}}%% graph LR A["<b>🎈 UFO</b><br/><span style='font-size:14px'>February 2024</span><br/><span style='font-size:13px; color:#666'><i>GUI Agent for Windows</i></span>"] B["<b>🖥️ UFO²</b><br/><span style='font-size:14px'>April 2025</span><br/><span style='font-size:13px; color:#666'><i>Desktop AgentOS</i></span>"] C["<b>🌌 UFO³ Galaxy</b><br/><span style='font-size:14px'>November 2025</span><br/><span style='font-size:13px; color:#666'><i>Multi-Device Orchestration</i></span>"] A -->|Evolve| B B -->|Scale| C style A fill:#E8F4F8,stroke:#7CB9E8,stroke-width:2.5px,color:#1A1A1A,rx:15,ry:15 style B fill:#C5E8F5,stroke:#5BA8D0,stroke-width:2.5px,color:#1A1A1A,rx:15,ry:15 style C fill:#A4DBF0,stroke:#3D96BE,stroke-width:2.5px,color:#1A1A1A,rx:15,ry:15 ``` ### 🚀 UFO³ = **Galaxy** (Multi-Device Orchestration) + **UFO²** (Device Agent) UFO³ introduces **Galaxy**, a revolutionary multi-device orchestration framework that coordinates intelligent agents across heterogeneous platforms. Built on five tightly integrated design principles: 1. **🌟 Declarative Decomposition into Dynamic DAG** - Requests decomposed into structured DAG with TaskStars and dependencies for automated scheduling and runtime rewriting 2. **🔄 Continuous Result-Driven Graph Evolution** - Living constellation that adapts to execution feedback through controlled rewrites and dynamic adjustments 3. **⚡ Heterogeneous, Asynchronous & Safe Orchestration** - Capability-based device matching with async execution, safe locking, and formally verified correctness 4. **🔌 Unified Agent Interaction Protocol (AIP)** - WebSocket-based secure coordination layer with fault tolerance and automatic reconnection 5. **🛠️ Template-Driven MCP-Empowered Device Agents** - Lightweight toolkit for rapid agent development with MCP integration for tool augmentation | Aspect | UFO² | UFO³ Galaxy | |--------|------|-------------| | **Architecture** | Single Windows Agent | Multi-Device Orchestration | | **Task Model** | Sequential ReAct Loop | DAG-based Constellation Workflows | | **Scope** | Single device, multi-app | Multi-device, cross-platform | | **Coordination** | HostAgent + AppAgents | ConstellationAgent + TaskOrchestrator | | **Device Support** | Windows Desktop | Windows, Linux, Android (more coming) | | **Task Planning** | Application-level | Device-level with dependencies | | **Execution** | Sequential | Parallel DAG execution | | **Device Agent Role** | Standalone | Can serve as Galaxy device agent | | **Complexity** | Simple to Moderate | Simple to Very Complex | | **Learning Curve** | Low | Moderate | | **Cross-Device Collaboration** | ❌ Not Supported | ✅ Core Feature | | **Setup Difficulty** | ✅ Easy | ⚠️ Moderate | | **Status** | ✅ LTS (Long-Term Support) | ⚡ Active Development | ### 🎓 Migration Path **For UFO² Users:** 1. ✅ **Keep using UFO²** – Fully supported, actively maintained 2. 🔄 **Gradual adoption** – Galaxy can use UFO² as Windows device agent 3. 📈 **Scale up** – Move to Galaxy when you need multi-device capabilities 4. 📚 **Learning resources** – [Migration Guide](./documents/docs/getting_started/migration_ufo2_to_galaxy.md) --- ## ✨ Capabilities at a Glance ### 🌌 Galaxy Framework – What's Different? <table> <tr> <td width="33%" valign="top"> #### 🌟 Constellation Planning ``` User Request ↓ ConstellationAgent ↓ [Task DAG] / | \ Task1 Task2 Task3 (Win) (Linux)(Mac) ``` **Benefits:** - Cross-device dependency tracking - Parallel execution optimization - Cross-device dataflow management </td> <td width="33%" valign="top"> #### 🎯 Device Assignment ``` Selection Criteria • Platform • Resource • Task requirements • Performance history ↓ Auto-Assignment ↓ Optimal Devices ``` **Smart Matching:** - Capability-based selection - Real-time resource monitoring - Dynamic reallocation </td> <td width="33%" valign="top"> #### 📊 Orchestration ``` Task1 → Running ✅ Task2 → Pending ⏸️ Task3 → Running 🔄 ↓ Completion ↓ Final Report ``` **Orchestration:** - Real-time status updates - Automatic error recovery - Progress tracking with feedback </td> </tr> </table> --- ### 🪟 UFO² Desktop AgentOS – Core Strengths UFO² serves dual roles: **standalone Windows automation** and **Galaxy device agent** for Windows platforms. <div align="center"> | Feature | Description | Documentation | |---------|-------------|---------------| | **Deep OS Integration** | Windows UIA, Win32, WinCOM native control | [Learn More](https://microsoft.github.io/UFO) | | **Hybrid Actions** | GUI clicks + API calls for optimal performance | [Learn More](https://microsoft.github.io/UFO/automator/overview) | | **Speculative Multi-Action** | Batch predictions → **51% fewer LLM calls** | [Learn More](https://microsoft.github.io/UFO/advanced_usage/multi_action) | | **Visual + UIA Detection** | Hybrid control detection for robustness | [Learn More](https://microsoft.github.io/UFO/advanced_usage/control_detection/hybrid_detection) | | **Knowledge Substrate** | RAG with docs, demos, execution traces | [Learn More](https://microsoft.github.io/UFO/advanced_usage/reinforce_appagent/overview/) | | **Device Agent Role** | Can serve as Windows executor in Galaxy orchestration | [Learn More](./galaxy/README.md) | </div> **As Galaxy Device Agent:** - Receives tasks from ConstellationAgent via Galaxy orchestration layer - Executes Windows-specific operations using proven UFO² capabilities - Reports status and results back to TaskOrchestrator - Participates in cross-device workflows seamlessly --- ## 🚀 Quick Start Guide Choose your path and follow the detailed setup guide: <table align="center"> <tr> <td width="50%" valign="top"> ### 🌌 Galaxy Quick Start **For cross-device orchestration** ```powershell # 1. Install pip install -r requirements.txt # 2. Configure ConstellationAgent copy config\galaxy\agent.yaml.template config\galaxy\agent.yaml # Edit and add your API keys # 3. Configure devices # Edit config\galaxy\devices.yaml to register your devices # 4. Start device agents (with platform flags) # Windows: Start server + client # Linux: Start server + MCP servers + client # Mobile (Android): Start server + MCP servers + client # See platform-specific guides for detailed setup # 5. Launch Galaxy python -m galaxy --interactive ``` **📖 Complete Guide:** - [Galaxy README](./galaxy/README.md) – Architecture & concepts - [Online Quick Start](https://microsoft.github.io/UFO/getting_started/quick_start_galaxy/) – Step-by-step tutorial - [Windows Device Setup](https://microsoft.github.io/UFO/getting_started/quick_start_ufo2/) - [Linux Device Setup](https://microsoft.github.io/UFO/getting_started/quick_start_linux/) - [Mobile Device Setup](https://microsoft.github.io/UFO/getting_started/quick_start_mobile/) – Android agent setup - [Configuration](https://microsoft.github.io/UFO/configuration/system/galaxy_devices/) – Device pool configuration </td> <td width="50%" valign="top"> ### 🪟 UFO² Quick Start **For Windows automation** ```powershell # 1. Install pip install -r requirements.txt # 2. Configure copy config\ufo\agents.yaml.template config\ufo\agents.yaml # Edit and add your API keys # 3. Run python -m ufo --task <task_name> ``` **📖 Complete Guide:** - [UFO² README](./ufo/README.md) – Full documentation - [Configuration Guide](./ufo/README.md#️-step-2-configure-the-llms) – LLM setup - [Advanced Features](https://microsoft.github.io/UFO/advanced_usage/overview/) – Multi-action, RAG </td> </tr> </table> ### 📋 Common Configuration Both frameworks require LLM API configuration. Choose your provider: <details> <summary><strong>OpenAI Configuration</strong></summary> **For Galaxy (`config/galaxy/agent.yaml`):** ```yaml CONSTELLATION_AGENT: REASONING_MODEL: false API_TYPE: "openai" API_BASE: "https://api.openai.com/v1/chat/completions" API_KEY: "sk-your-key-here" API_MODEL: "gpt-4o" ``` **For UFO² (`config/ufo/agents.yaml`):** ```yaml VISUAL_MODE: True API_TYPE: "openai" API_BASE: "https://api.openai.com/v1/chat/completions" API_KEY: "sk-your-key-here" API_MODEL: "gpt-4o" ``` </details> <details> <summary><strong>Azure OpenAI Configuration</strong></summary> **For Galaxy (`config/galaxy/agent.yaml`):** ```yaml CONSTELLATION_AGENT: REASONING_MODEL: false API_TYPE: "aoai" API_BASE: "https://YOUR-RESOURCE.openai.azure.com" API_KEY: "your-azure-key" API_MODEL: "gpt-4o" API_DEPLOYMENT_ID: "your-deployment-id" ``` **For UFO² (`config/ufo/agents.yaml`):** ```yaml VISUAL_MODE: True API_TYPE: "aoai" API_BASE: "https://YOUR-RESOURCE.openai.azure.com" API_KEY: "your-azure-key" API_MODEL: "gpt-4o" API_DEPLOYMENT_ID: "your-deployment-id" ``` </details> > 💡 **More LLM Options:** See [Model Configuration Guide](https://microsoft.github.io/UFO/supported_models/overview/) for Qwen, Gemini, Claude, and more. --- ## 📚 Documentation Structure <table> <tr> <td width="50%" valign="top"> ### 🌌 Galaxy Documentation - **[Galaxy Framework Overview](./galaxy/README.md)** ⭐ **Start Here** – Architecture & technical concepts - **[Quick Start Tutorial](https://microsoft.github.io/UFO/getting_started/quick_start_galaxy/)** – Get running in minutes - **[Galaxy Client](https://microsoft.github.io/UFO/galaxy/client/overview/)** – Device coordination and API - **[Constellation Agent](https://microsoft.github.io/UFO/galaxy/constellation_agent/overview/)** – Task decomposition and planning - **[Task Orchestrator](https://microsoft.github.io/UFO/galaxy/constellation_orchestrator/overview/)** – Execution engine - **[Task Constellation](https://microsoft.github.io/UFO/galaxy/constellation/overview/)** – DAG structure - **[Agent Registration](https://microsoft.github.io/UFO/galaxy/agent_registration/overview/)** – Device registry - **[Configuration Guide](https://microsoft.github.io/UFO/configuration/system/galaxy_devices/)** – Setup and device pools **📖 Technical Documentation:** - [AIP Protocol](https://microsoft.github.io/UFO/aip/overview/) – WebSocket messaging - [Session Management](https://microsoft.github.io/UFO/galaxy/session/overview/) – Session lifecycle - [Visualization](https://microsoft.github.io/UFO/galaxy/visualization/overview/) – Real-time monitoring - [Events & Observers](https://microsoft.github.io/UFO/galaxy/core/overview/) – Event system </td> <td width="50%" valign="top"> ### 🪟 UFO² Documentation - **[UFO² Overview](./ufo/README.md)** – Desktop AgentOS architecture - **[Installation](./ufo/README.md#️-step-1-installation)** – Setup & dependencies - **[Configuration](./ufo/README.md#️-step-2-configure-the-llms)** – LLM & RAG setup - **[Usage Guide](./ufo/README.md#-step-4-start-ufo)** – Running UFO² - **[Advanced Features](https://microsoft.github.io/UFO/advanced_usage/overview/)** – Multi-action, RAG, etc. - **[Automator Guide](https://microsoft.github.io/UFO/automator/overview)** – Hybrid GUI + API - **[Benchmarks](./ufo/README.md#-evaluation)** – WAA & OSWorld results **📖 Online Docs:** - [Complete Documentation](https://microsoft.github.io/UFO/) - [Model Support](https://microsoft.github.io/UFO/supported_models/overview/) - [RAG Configuration](https://microsoft.github.io/UFO/advanced_usage/reinforce_appagent/overview/) </td> </tr> </table> --- ## 📢 Latest Updates ### 2025-11 – UFO³ Galaxy Framework Released 🌌 **Major Research Breakthrough:** Multi-Device Orchestration System - 🌟 **Declarative DAG Decomposition**: TaskConstellation structure for workflow logic and dependencies - 🔄 **Dynamic Graph Evolution**: Living constellation that adapts through controlled rewrites - 🎯 **Heterogeneous Orchestration**: Safe, asynchronous execution with capability-based device matching - 🔌 **Unified AIP Protocol**: WebSocket-based secure agent coordination with fault tolerance - 🛠️ **MCP-Empowered Agent Framework**: Template-driven toolkit for rapid device agent development - 📄 **Research Paper**: [UFO³: Weaving the Digital Agent Galaxy](https://arxiv.org/abs/2511.11332) **Key Features:** - First multi-device orchestration framework for GUI agents - Result-driven adaptive execution instead of rigid workflows - Model Context Protocol (MCP) integration for tool augmentation - Formally verified correctness and concurrency safety guarantees ### 2025-04 – UFO² v2.0.0 - 📅 UFO² Desktop AgentOS released - 🏗️ Enhanced architecture with AgentOS concept - 📄 [Technical Report](https://arxiv.org/pdf/2504.14603) published - ✅ Entered Long-Term Support (LTS) status ### 2024-02 – Original UFO - 🎈 First UFO release - UI-Focused agent for Windows - 📄 [Original Paper](https://arxiv.org/abs/2402.07939) - 🌍 Wide media coverage and adoption --- ## 📚 Citation If you use UFO³ Galaxy or UFO² in your research, please cite the relevant papers: ### UFO³ Galaxy Framework (2025) ```bibtex @article{zhang2025ufo3, title={UFO$^3$: Weaving the Digital Agent Galaxy}, author = {Zhang, Chaoyun and Li, Liqun and Huang, He and Ni, Chiming and Qiao, Bo and Qin, Si and Kang, Yu and Ma, Minghua and Lin, Qingwei and Rajmohan, Saravan and Zhang, Dongmei}, journal = {arXiv preprint arXiv:2511.11332}, year = {2025}, } ``` ### UFO² Desktop AgentOS (2025) ```bibtex @article{zhang2025ufo2, title = {{UFO2: The Desktop AgentOS}}, author = {Zhang, Chaoyun and Huang, He and Ni, Chiming and Mu, Jian and Qin, Si and He, Shilin and Wang, Lu and Yang, Fangkai and Zhao, Pu and Du, Chao and Li, Liqun and Kang, Yu and Jiang, Zhao and Zheng, Suzhen and Wang, Rujia and Qian, Jiaxu and Ma, Minghua and Lou, Jian-Guang and Lin, Qingwei and Rajmohan, Saravan and Zhang, Dongmei}, journal = {arXiv preprint arXiv:2504.14603}, year = {2025} } ``` ### Original UFO (2024) ```bibtex @article{zhang2024ufo, title = {{UFO: A UI-Focused Agent for Windows OS Interaction}}, author = {Zhang, Chaoyun and Li, Liqun and He, Shilin and Zhang, Xu and Qiao, Bo and Qin, Si and Ma, Minghua and Kang, Yu and Lin, Qingwei and Rajmohan, Saravan and Zhang, Dongmei and Zhang, Qi}, journal = {arXiv preprint arXiv:2402.07939}, year = {2024} } ``` --- ## 🌐 Media & Community **Media Coverage:** - [微软正式开源UFO²,Windows桌面迈入「AgentOS 时代」](https://www.jiqizhixin.com/articles/2025-05-06-13) - [Microsoft's UFO: Smarter Windows Experience](https://the-decoder.com/microsofts-ufo-abducts-traditional-user-interfaces-for-a-smarter-windows-experience/) - [下一代Windows系统曝光](https://baijiahao.baidu.com/s?id=1790938358152188625) - **[More coverage →](./ufo/README.md#-tracing-the-stars)** **Community:** - 💬 [GitHub Discussions](https://github.com/microsoft/UFO/discussions) - 🐛 [Issue Tracker](https://github.com/microsoft/UFO/issues) - 📧 Email: [[email protected]](mailto:[email protected]) - 📺 [YouTube Channel](https://www.youtube.com/watch?v=QT_OhygMVXU) --- ## 🎨 Related Projects & Research **Microsoft Research:** - **[TaskWeaver](https://github.com/microsoft/TaskWeaver)** – Code-first LLM agent framework for data analytics and task automation **GUI Agent Research:** - **[LLM-Brained GUI Agents Survey](https://github.com/vyokky/LLM-Brained-GUI-Agents-Survey)** – Comprehensive survey of GUI automation agents - **[Interactive Survey Site](https://vyokky.github.io/LLM-Brained-GUI-Agents-Survey/)** – Explore latest GUI agent research and developments **Multi-Agent Systems:** - **UFO³ Galaxy** represents a novel approach to multi-device orchestration, introducing the Constellation framework for coordinating heterogeneous agents across platforms - Builds on multi-agent coordination research while addressing unique challenges of cross-device GUI automation **Benchmarks:** - **[Windows Agent Arena (WAA)](https://github.com/nice-mee/WindowsAgentArena)** – Evaluation benchmark for Windows automation agents - **[OSWorld](https://github.com/nice-mee/WindowsAgentArena/tree/2020-qqtcg/osworld)** – Cross-application task evaluation suite --- ## 💡 FAQ <details> <summary><strong>🤔 Should I use Galaxy or UFO²?</strong></summary> **Start with UFO²** if: - You only need Windows automation - You want quick setup and learning - Tasks are relatively simple **Choose Galaxy** if: - You need cross-device coordination - Tasks are complex and multi-step - You want advanced orchestration - You're comfortable with active development **Hybrid approach** if: - You want best of both worlds - Some tasks are simple (UFO²), some complex (Galaxy) - You're gradually migrating </details> <details> <summary><strong>⚠️ Will UFO² be deprecated?</strong></summary> **No!** UFO² has entered **Long-Term Support (LTS)** status: - ✅ Actively maintained - ✅ Bug fixes and security updates - ✅ Performance improvements - ✅ Full community support - ✅ No plans for deprecation UFO² is the stable, proven solution for Windows automation. </details> <details> <summary><strong>🔄 How do I migrate from UFO² to Galaxy?</strong></summary> Migration is **gradual and optional**: 1. **Phase 1: Learn** – Understand Galaxy concepts 2. **Phase 2: Experiment** – Try Galaxy with non-critical tasks 3. **Phase 3: Hybrid** – Use both frameworks 4. **Phase 4: Migrate** – Gradually move complex tasks to Galaxy **No forced migration!** Continue using UFO² as long as it meets your needs. See [Migration Guide](./documents/docs/getting_started/migration_ufo2_to_galaxy.md) for details. </details> <details> <summary><strong>🎯 Can Galaxy do everything UFO² does?</strong></summary> **Functionally: Yes.** Galaxy can use UFO² as a Windows device agent. **Practically: It depends.** - For **simple Windows tasks**: UFO² standalone is easier and more streamlined - For **complex workflows**: Galaxy orchestrates UFO² with other device agents **Recommendation:** Use the right tool for the job. UFO² can work standalone or as Galaxy's Windows device agent. </details> <details> <summary><strong>📊 How mature is Galaxy?</strong></summary> **Status: Active Development** 🚧 **Stable:** - ✅ Core architecture - ✅ DAG orchestration - ✅ Basic multi-device support - ✅ Event system **In Development:** - 🔨 Advanced device types - 🔨 Enhanced monitoring - 🔨 Performance optimization - 🔨 Extended documentation **Recommendation:** Great for experimentation and non-critical workflows. </details> <details> <summary><strong>🔧 Can I extend or customize?</strong></summary> **Both frameworks are highly extensible:** **UFO²:** - Custom actions and automators - Custom knowledge sources (RAG) - Custom control detectors - Custom evaluation metrics **Galaxy:** - Custom agents - Custom device types - Custom orchestration strategies - Custom visualization components See respective documentation for extension guides. </details> <details> <summary><strong>🤝 How can I contribute?</strong></summary> We welcome contributions to both UFO² and Galaxy! **Ways to contribute:** - 🐛 Report bugs and issues - 💡 Suggest features and improvements - 📝 Improve documentation - 🧪 Add tests and examples - 🔧 Submit pull requests See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines. </details> --- ## ⚠️ Disclaimer & License **Disclaimer:** By using this software, you acknowledge and agree to the terms in [DISCLAIMER.md](./DISCLAIMER.md). **License:** This project is licensed under the [MIT License](LICENSE). **Trademarks:** Use of Microsoft trademarks follows [Microsoft's Trademark Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). --- <div align="center"> ## 🚀 Ready to Get Started? <table> <tr> <td align="center" width="50%"> ### 🌌 Explore Galaxy **Multi-Device Orchestration** [![Start Galaxy](https://img.shields.io/badge/Start-Galaxy-blue?style=for-the-badge)](./galaxy/README.md) </td> <td align="center" width="50%"> ### 🪟 Try UFO² **Windows Desktop Agent** [![Start UFO²](https://img.shields.io/badge/Start-UFO²-green?style=for-the-badge)](./ufo/README.md) </td> </tr> </table> --- <sub>© Microsoft 2025 | UFO³ is an open-source research project</sub> <sub>⭐ Star us on GitHub | 🤝 Contribute | 📖 Read the docs | 💬 Join discussions</sub> </div> --- <p align="center"> <img src="assets/logo3.png" alt="UFO logo" width="60"> <br> <em>From Single Agent to Digital Galaxy</em> <br> <strong>UFO³ - Weaving the Future of Intelligent Automation</strong> </p>

AI Agents
8.9K Github Stars
TypeChat
Open Source

TypeChat

# TypeChat TypeChat is a library that makes it easy to build natural language interfaces using types. Building natural language interfaces has traditionally been difficult. These apps often relied on complex decision trees to determine intent and collect the required inputs to take action. Large language models (LLMs) have made this easier by enabling us to take natural language input from a user and match to intent. This has introduced its own challenges including the need to constrain the model's reply for safety, structure responses from the model for further processing, and ensuring that the reply from the model is valid. Prompt engineering aims to solve these problems, but comes with a steep learning curve and increased fragility as the prompt increases in size. TypeChat replaces _prompt engineering_ with _schema engineering_. Simply define types that represent the intents supported in your natural language application. That could be as simple as an interface for categorizing sentiment or more complex examples like types for a shopping cart or music application. For example, to add additional intents to a schema, a developer can add additional types into a discriminated union. To make schemas hierarchical, a developer can use a "meta-schema" to choose one or more sub-schemas based on user input. After defining your types, TypeChat takes care of the rest by: 1. Constructing a prompt to the LLM using types. 2. Validating the LLM response conforms to the schema. If the validation fails, repair the non-conforming output through further language model interaction. 3. Summarizing succinctly (without use of a LLM) the instance and confirm that it aligns with user intent. Types are all you need! # Getting Started Install TypeChat for TypeScript/JavaScript: ``` npm install typechat ``` <!-- Or from PyPI: ... Or NuGet ... --> You can also work with TypeChat from source for: * [Python](./python/README.md) * [TypeScript](./typescript/README.md) * [C#/.NET](https://github.com/microsoft/TypeChat.net) To see TypeChat in action, we recommend exploring the [TypeChat example projects](./typescript/examples). You can try them on your local machine or in a GitHub Codespace. To learn more about TypeChat, visit the [documentation](https://microsoft.github.io/TypeChat) which includes more information on TypeChat and how to get started. ## 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. ## 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). 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.

AI & Machine Learning JavaScript Libraries & Components
8.7K Github Stars
poml
Open Source

poml

# POML: Prompt Orchestration Markup Language [![Documentation](https://img.shields.io/badge/docs-microsoft.github.io-blue)](https://microsoft.github.io/poml/) [![VSCode Extension](https://img.shields.io/visual-studio-marketplace/v/poml-team.poml)](https://marketplace.visualstudio.com/items?itemName=poml-team.poml) [![PyPI](https://img.shields.io/pypi/v/poml)](https://pypi.org/project/poml/) [![npm (latest)](https://img.shields.io/npm/v/pomljs)](https://www.npmjs.com/package/pomljs) [![Test Status](https://github.com/microsoft/poml/actions/workflows/test.yml/badge.svg)](https://github.com/microsoft/poml/actions/workflows/test.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Discord](https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white)](https://discord.gg/FhMCqWzAn6) **POML (Prompt Orchestration Markup Language)** is a novel markup language designed to bring structure, maintainability, and versatility to advanced prompt engineering for Large Language Models (LLMs). It addresses common challenges in prompt development, such as lack of structure, complex data integration, format sensitivity, and inadequate tooling. POML provides a systematic way to organize prompt components, integrate diverse data types seamlessly, and manage presentation variations, empowering developers to create more sophisticated and reliable LLM applications. ## Demo Video [![The 5-minute guide to POML](https://i3.ytimg.com/vi/b9WDcFsKixo/maxresdefault.jpg)](https://youtu.be/b9WDcFsKixo) ## Key Features - **Structured Prompting Markup**: Employs an HTML-like syntax with semantic components such as `<role>`, `<task>`, and `<example>` to encourage modular design, enhancing prompt readability, reusability, and maintainability. - **Comprehensive Data Handling**: Incorporates specialized data components (e.g., `<document>`, `<table>`, `<img>`) that seamlessly embed or reference external data sources like text files, spreadsheets, and images, with customizable formatting options. - **Decoupled Presentation Styling**: Features a CSS-like styling system that separates content from presentation. This allows developers to modify styling (e.g., verbosity, syntax format) via `<stylesheet>` definitions or inline attributes without altering core prompt logic, mitigating LLM format sensitivity. - **Integrated Templating Engine**: Includes a built-in templating engine with support for variables (`{{ }}`), loops (`for`), conditionals (`if`), and variable definitions (`<let>`) for dynamically generating complex, data-driven prompts. - **Rich Development Toolkit**: - **IDE Extension (Visual Studio Code)**: Provides essential development aids like syntax highlighting, context-aware auto-completion, hover documentation, real-time previews, inline diagnostics for error checking, and integrated interactive testing. - **Software Development Kits (SDKs)**: Offers SDKs for Node.js (JavaScript/TypeScript) and Python for seamless integration into various application workflows and popular LLM frameworks. ## Quick Start Here's a very simple POML example. Please put it in a file named `example.poml`. Make sure it resides in the same directory as the `photosynthesis_diagram.png` image file. ```xml <poml> <role>You are a patient teacher explaining concepts to a 10-year-old.</role> <task>Explain the concept of photosynthesis using the provided image as a reference.</task> <img src="photosynthesis_diagram.png" alt="Diagram of photosynthesis" /> <output-format> Keep the explanation simple, engaging, and under 100 words. Start with "Hey there, future scientist!". </output-format> </poml> ``` This example defines a role and task for the LLM, includes an image for context, and specifies the desired output format. With the POML toolkit, the prompt can be easily rendered with a flexible format, and tested with a vision LLM. ## Installation ### Visual Studio Code Extension Install from [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=poml-team.poml). You can also install the extension manually by downloading the `.vsix` file from our [GitHub releases page](https://github.com/microsoft/poml/releases) and installing it in VS Code via the Extensions view. Before testing prompts with the POML toolkit, make sure you have configured your preferred LLM model, API key, and endpoint. If these are not set, prompt testing will not work. **To configure in Visual Studio Code:** - Open the extension settings (open "Settings" and search for "POML"). - Set your model provider (e.g., OpenAI, Azure, Google), API key, and endpoint URL in the POML section. - Alternatively, you can add these settings directly to your `settings.json` file. ### Node.js (via npm) ```bash npm install pomljs ``` ### Python (via pip) ```bash pip install poml ``` For development or local installation, you might use `pip install -e .` from a cloned repository. **Refer to the [documentation](https://microsoft.github.io/poml) for more details on installing the nightly build.** ## Documentation For detailed information on POML syntax, components, styling, templating, SDKs, and the VS Code extension, please refer to our [documentation](https://microsoft.github.io/poml). ## Learn More - **Watch our Demo Video on YouTube:** [POML Introduction & Demo](https://youtu.be/b9WDcFsKixo) - **Join our Discord community:** Connect with the team and other users on our [Discord server](https://discord.gg/FhMCqWzAn6). - **Read the Prompt Orchestration Markup Language paper:** [Prompt Orchestration Markup Language](https://arxiv.org/abs/2508.13948) presents the design of POML and its impact on prompt engineering. - **Explore Content-Format Integrated Prompt Optimization:** [Beyond Prompt Content: Enhancing LLM Performance via Content-Format Integrated Prompt Optimization](https://arxiv.org/abs/2502.04295) proposes an iterative approach that jointly optimizes prompt content and formatting to improve LLM performance. ## Citation If you find POML useful or related to your research, please cite the following paper: ```bibtex @misc{zhang2025promptorchestrationmarkuplanguage, title={Prompt Orchestration Markup Language}, author={Yuge Zhang and Nan Chen and Jiahang Xu and Yuqing Yang}, year={2025}, eprint={2508.13948}, archivePrefix={arXiv}, primaryClass={cs.HC}, url={https://arxiv.org/abs/2508.13948}, } ``` ## Ecosystem & Community Projects - [mini-poml-rs](https://github.com/linmx0130/mini-poml-rs) – Experimental Rust-based POML renderer for environments without JavaScript or Python interpreters. - [poml-ruby](https://github.com/GhennadiiMir/poml) – Ruby gem implementation of POML for Ruby applications. - [ai-chatbot-with-python-and-angular](https://github.com/hereandnowai/ai-chatbot-with-python-and-angular) – A chatbot built with Python and Angular (version 20), utilizing POML for prompting and the Langchain framework. Developed by HERE AND NOW AI. - [PomlSDK.jl](https://github.com/imohag9/PomlSDK.jl) – Julia implementation of the POML specification. ## 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. ## 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). 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. ## Responsible AI This project has been evaluated and certified to comply with the Microsoft Responsible AI Standard. The team will continue to monitor and maintain the repository, addressing any severe issues, including potential harms, if they arise. For more details, refer to the [Responsible AI Readme](RAI_README.md). ## License This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

AI Tools Documentation
4.9K Github Stars
LMOps
Open Source

LMOps

<!--# LMOps: Enabling AI w/ LLMs--> # LMOps LMOps is a research initiative on fundamental research and technology for building AI products w/ foundation models, especially on the general technology for enabling AI capabilities w/ LLMs and Generative AI models. - Better Prompts: [Automatic Prompt Optimization](https://arxiv.org/abs/2305.03495), [Promptist](https://arxiv.org/abs/2212.09611), [Extensible prompts](https://arxiv.org/abs/2212.00616), [Universal prompt retrieval](https://arxiv.org/abs/2303.08518), [LLM Retriever](https://arxiv.org/abs/2307.07164), [In-Context Demonstration Selection](https://arxiv.org/abs/2305.14726) - Longer Context: [Structured prompting](https://arxiv.org/abs/2212.06713), [Length-Extrapolatable Transformers](https://arxiv.org/abs/2212.10554) - LLM Alignment: [Alignment via LLM feedback]() - LLM Accelerator (Faster Inference): [Lossless Acceleration of LLMs](https://arxiv.org/abs/2304.04487) - LLM Customization: [Adapt LLM to domains](https://arxiv.org/pdf/2309.09530.pdf) - Fundamentals: [Understanding In-Context Learning](https://arxiv.org/abs/2212.10559) ## Links - [microsoft/unilm](https://github.com/microsoft/unilm): Large-scale Self-supervised Pre-training Across Tasks, Languages, and Modalities - [microsoft/torchscale](https://github.com/microsoft/torchscale): Transformers at (any) Scale ## News - [Paper Release] Nov, 2023: [In-Context Demonstration Selection with Cross Entropy Difference](https://arxiv.org/abs/2305.14726) (EMNLP 2023) - [Paper Release] Oct, 2023: [Tuna: Instruction Tuning using Feedback from Large Language Models](https://arxiv.org/pdf/2310.13385.pdf) (EMNLP 2023) - [Paper Release] Oct, 2023: [Automatic Prompt Optimization with "Gradient Descent" and Beam Search](https://arxiv.org/abs/2305.03495) (EMNLP 2023) - [Paper Release] Oct, 2023: [UPRISE: Universal Prompt Retrieval for Improving Zero-Shot Evaluation](https://arxiv.org/abs/2303.08518) (EMNLP 2023) - [Paper Release] July, 2023: [Learning to Retrieve In-Context Examples for Large Language Models](https://arxiv.org/abs/2307.07164) - [Paper Release] April, 2023: [Inference with Reference: Lossless Acceleration of Large Language Models](https://arxiv.org/abs/2304.04487) - [Paper Release] Dec, 2022: [Why Can GPT Learn In-Context? Language Models Secretly Perform Finetuning as Meta Optimizers](https://arxiv.org/abs/2212.10559) - [Paper & Model & Demo Release] Dec, 2022: [Optimizing Prompts for Text-to-Image Generation](https://aka.ms/promptist) - [Paper & Code Release] Dec, 2022: [Structured Prompting: Scaling In-Context Learning to 1,000 Examples](https://arxiv.org/abs/2212.06713) - [Paper Release] Nov, 2022: [Extensible Prompts for Language Models](https://arxiv.org/abs/2212.00616) ## Prompt Intelligence Advanced technologies facilitating prompting language models. ### Promptist: reinforcement learning for automatic prompt optimization [Paper] [Optimizing Prompts for Text-to-Image Generation](https://arxiv.org/abs/2212.09611) > - Language models serve as a prompt interface that optimizes user input into model-preferred prompts. > - Learn a language model for automatic prompt optimization via reinforcement learning. ![image](https://user-images.githubusercontent.com/1070872/207856962-02f08d92-f2bf-441a-b1c3-efff1a4b6187.png) ### Structured Prompting: consume long-sequence prompts in an efficient way [Paper] [Structured Prompting: Scaling In-Context Learning to 1,000 Examples](https://arxiv.org/abs/2212.06713) - Example use cases: > 1) Prepend (many) retrieved (long) documents as context in GPT. > 2) Scale in-context learning to many demonstration examples. ![image](https://user-images.githubusercontent.com/1070872/207856629-2bb0c933-c27b-4177-9e10-e397622ae79b.png) ### X-Prompt: extensible prompts beyond NL for descriptive instructions [Paper] [Extensible Prompts for Language Models](https://arxiv.org/abs/2212.00616) > - Extensible interface allowing prompting LLMs beyond natural language for fine-grain specifications > - Context-guided imaginary word learning for general usability ![Extensible Prompts for Language Models](https://user-images.githubusercontent.com/1070872/207856788-5409d04d-c406-4b29-ae7b-2732e727d4cc.png) ## LLMA: LLM Accelerators ### Accelerate LLM Inference with References [Paper] [Inference with Reference: Lossless Acceleration of Large Language Models](https://arxiv.org/abs/2304.04487) > - Outputs of LLMs often have significant overlaps with some references (e.g., retrieved documents). > - LLMA losslessly accelerate the inference of LLMs by copying and verifying text spans from references into the LLM inputs. > - Applicable to important LLM scenarios such as retrieval-augmented generation and multi-turn conversations. > - Achieves 2~3 times speed-up without additional models. ![image](https://user-images.githubusercontent.com/6700539/231664563-aec35679-b4ab-4b6b-b6b4-b2b4ea1aab53.png) ## Fundamental Understanding of LLMs ### Understanding In-Context Learning [Paper] [Why Can GPT Learn In-Context? Language Models Secretly Perform Finetuning as Meta Optimizers](https://arxiv.org/abs/2212.10559) > - According to the demonstration examples, GPT produces meta gradients for In-Context Learning (ICL) through forward computation. ICL works by applying these meta gradients to the model through attention. > - The meta optimization process of ICL shares a dual view with finetuning that explicitly updates the model parameters with back-propagated gradients. > - We can translate optimization algorithms (such as SGD with Momentum) to their corresponding Transformer architectures. ![image](https://user-images.githubusercontent.com/1070872/208835096-54407f5f-d136-4747-9629-3219988df5d4.png) ## Hiring: [aka.ms/GeneralAI](https://aka.ms/GeneralAI) We are hiring at all levels (including FTE researchers and interns)! If you are interested in working with us on Foundation Models (aka large-scale pre-trained models) and AGI, NLP, MT, Speech, Document AI and Multimodal AI, please send your resume to <a href="mailto:[email protected]" class="x-hidden-focus">[email protected]</a>. ## License This project is licensed under the license found in the LICENSE file in the root directory of this source tree. [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct) ### Contact Information For help or issues using the pre-trained models, please submit a GitHub issue. For other communications, please contact [Furu Wei](http://gitnlp.org/) (`[email protected]`).

AI & Machine Learning AI Agents ML Frameworks
4.4K Github Stars
WindowsAgentArena
Open Source

WindowsAgentArena

<div align="center"> ![Banner](img/banner.png) [![Website](https://img.shields.io/badge/Website-red)](https://microsoft.github.io/WindowsAgentArena) [![arXiv](https://img.shields.io/badge/Paper-green)](https://arxiv.org/abs/2409.08264) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![PRs](https://img.shields.io/badge/AI-Podcast-blue.svg?logo=data:image/svg%2bxml;base64,PHN2ZyBmaWxsPSIjZmZmZmZmIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgaWQ9IlNWR1JlcG9fYmdDYXJyaWVyIiBzdHJva2Utd2lkdGg9IjAiPjwvZz48ZyBpZD0iU1ZHUmVwb190cmFjZXJDYXJyaWVyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjwvZz48ZyBpZD0iU1ZHUmVwb19pY29uQ2FycmllciI+PHBhdGggZD0iTTEzLDRWMjBhMSwxLDAsMCwxLTIsMFY0YTEsMSwwLDAsMSwyLDBaTTgsNUExLDEsMCwwLDAsNyw2VjE4YTEsMSwwLDAsMCwyLDBWNkExLDEsMCwwLDAsOCw1Wk00LDdBMSwxLDAsMCwwLDMsOHY4YTEsMSwwLDAsMCwyLDBWOEExLDEsMCwwLDAsNCw3Wk0xNiw1YTEsMSwwLDAsMC0xLDFWMThhMSwxLDAsMCwwLDIsMFY2QTEsMSwwLDAsMCwxNiw1Wm00LDJhMSwxLDAsMCwwLTEsMXY4YTEsMSwwLDAsMCwyLDBWOEExLDEsMCwwLDAsMjAsN1oiPjwvcGF0aD48L2c+PC9zdmc+)](https://microsoft.github.io/WindowsAgentArena/static/files/waa_podcast.wav) </div> **Windows Agent Arena (WAA) 🪟** is a scalable Windows AI agent platform for testing and benchmarking multi-modal, desktop AI agents. WAA provides researchers and developers with a reproducible and realistic Windows OS environment for AI research, where agentic AI workflows can be tested across a diverse range of tasks. WAA supports the deployment of agents **at scale** using the Azure ML cloud infrastructure, allowing for the parallel running of multiple agents and delivering quick benchmark results for hundreds of tasks in minutes, not days. <div align="center"> <video src="https://github.com/user-attachments/assets/e0a8d88d-d28a-493d-b74f-2455f36c21f1" alt="waa_intro"> </div> ## 📢 Updates - 2024-11-10: We added a new difficulty mode for Windows Agent Arena! You can try the new harder difficulty mode by changing the default `diff_lvl="normal"` to `diff_lvl="hard"` in `src/win-arena-container/start_client.sh`. Under the harder difficulty, in many tasks, agents must also learn to initialize/set up the task themselves (e.g., finding and opening the right program/application for the task) rather than have the task "set up" for them by the task config. - 2024-10-30: We released the code for our Navi agent with Omniparser! For the top performing mode in the paper, run `./run-local.sh --som-origin mixed-omni --gpu-enabled true` - 2024-10-23: Microsoft open-sourced [Omniparser](https://github.com/microsoft/OmniParser), the current top performing screen understanding model in our benchmark. - 2024-09-13: We released our [paper](https://arxiv.org/abs/2409.08264), [code](https://github.com/microsoft/WindowsAgentArena), [project page](https://microsoft.github.io/WindowsAgentArena), and [blog post](https://www.microsoft.com/applied-sciences/projects/windows-agent-arena). Check it out! ## 📚 Citation Our technical report paper can be found [here](https://arxiv.org/abs/2409.08264). If you find this environment useful, please consider citing our work: ``` @article{bonatti2024windows, author = { Bonatti, Rogerio and Zhao, Dan and Bonacci, Francesco and Dupont, Dillon, and Abdali, Sara and Li, Yinheng and Wagle, Justin and Koishida, Kazuhito and Bucker, Arthur and Jang, Lawrence and Hui, Zack}, title = {Windows Agent Arena: Evaluating Multi-Modal OS Agents at Scale}, institution = {Microsoft}, year = {2024}, month = {September}, } ``` ## ☝️ Pre-requisites: <div align="center"> <img src="img/main.png" alt="main" height="200"/> </div> - Docker daemon installed and running. On Windows, we recommend using [Docker with WSL 2](https://docs.docker.com/desktop/wsl/). - An [OpenAI](https://platform.openai.com/docs/introduction) or [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service) API Key. - Python 3.9 - we recommend using [Conda](https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html) and creating an adhoc python environment for running the scripts. For creating a new environment run `conda create -n winarena python=3.9`. Clone the repository and install dependencies: ```bash git clone https://github.com/microsoft/WindowsAgentArena.git cd WindowsAgentArena # Install the required dependencies in your python environment # conda activate winarena pip install -r requirements.txt ``` ## 💻 Local deployment (WSL or Linux) ### 1. Configuration file Create a new `config.json` at the root of the project with the necessary keys (from OpenAI or Azure endpoints): ```json { "OPENAI_API_KEY": "<OPENAI_API_KEY>", // if you are using OpenAI endpoint "AZURE_API_KEY": "<AZURE_API_KEY>", // if you are using Azure endpoint "AZURE_ENDPOINT": "https://yourendpoint.openai.azure.com/", // if you are using Azure endpoint } ``` ### 2. Prepare the Windows Arena Docker Image #### 2.1 Pull the WinArena-Base Image from Docker Hub To get started, pull the base image from Docker Hub: ```bash docker pull windowsarena/winarena-base:latest ``` This image includes all the necessary dependencies (such as packages and models) required to run the code in the `src` directory. #### 2.2 Build the WinArena Image Locally Next, build the WinArena image locally: ```bash cd scripts ./build-container-image.sh # If there are any changes in 'Dockerfile-WinArena-Base', use the --build-base-image flag to build also the base image locally # ./build-container-image.sh --build-base-image true # For other build options: # ./build-container-image.sh --help ``` This will create the `windowsarena/winarena:latest` image with the latest code from the `src` directory. ### 3. Prepare the Windows 11 VM <div align="center"> <video src="https://github.com/user-attachments/assets/6d55b9b5-3242-49af-be20-64f2086108b9" height="500" alt="local_prepare_golden_image"> </div> #### 3.1 Download Windows 11 Evaluation .iso file: 1. Visit [Microsoft Evaluation Center](https://info.microsoft.com/ww-landing-windows-11-enterprise.html), accept the Terms of Service, and download a **Windows 11 Enterprise Evaluation (90-day trial, English, United States)** ISO file [~6GB] 2. After downloading, rename the file to `setup.iso` and copy it to the directory `WindowsAgentArena/src/win-arena-container/vm/image` #### 3.2 Automatic Setup of the Windows 11 golden image: Before running the arena, you need to prepare a new WAA snapshot (also referred as WAA golden image). This 30GB snapshot represents a fully functional Windows 11 VM with all the programs needed to run the benchmark. This VM additionally hosts a Python server which receives and executes agent commands. To learn more about the components at play, see our [local](/img/architecture-local.png) and [cloud](/img/architecture-azure.png) components diagrams. To prepare the gold snapshot, run **once**: ```bash cd ./scripts ./run-local.sh --prepare-image true ``` You can monitor progress at `http://localhost:8006`. The preparation process is fully automated and will take ~20 minutes. **Please do not interfere with the VM while it is being prepared. It will automatically shut down when the provisioning process is complete.** <div align="center"> <img src="img/local_prepare_screen_unattend.png" alt="local_prepare_screen_unattend" height="500"/> </div> <div align="center"> <img src="img/local_prepare_screen_setup.png" alt="local_prepare_screen_setup" height="500"/> </div> At the end, you should expect the Docker container named `winarena` to gracefully terminate as shown from the below logs. <div align="center"> <img src="img/local_prepare_logs_successful.png" alt="local_prepare_logs_successful" height="200"/> </div> <br/> You will find the 30GB WAA golden image in `WindowsAgentArena/src/win-arena-container/vm/storage`, consisting of the following files: <div align="center"> <img src="img/local_prepare_storage_successful.png" alt="run_local_prepare_storage_successful" height="200"/> </div> <br/> ##### Additional Notes - During development, if you want to include any changes made in the `src/win-arena-container` directory in the WAA golden image, please ensure to specify the flag `--skip-build false` to the `run-local.sh` script (default to true). This will ensure that a new container image is built instead than using the prebuilt `windowsarena/winarena:latest` image. - If you have previously run an installation process and want to do it again from scratch, make sure to delete the content of `storage`. - We recommend copying this `storage` folder to a safe location outside of the repository in case you or the agent accidentally corrupt the VM at some point and you want to avoid a fresh setup. - Depending on your docker settings, you might have to run the above command with `sudo`. - Running on WSL2? If you encounter the error `/bin/bash: bad interpreter: No such file or directory`, we recommend converting the bash scripts from DOS/Windows format to Unix format: ```bash cd ./scripts find . -maxdepth 1 -type f -exec dos2unix {} + ``` ### 4. Deploying the agent in the arena #### 4.1 Running the base benchmark You're now ready to launch the evaluation. To run the baseline agent on all benchmark tasks, do: ```bash cd scripts ./run-local.sh # For client/agent options: # ./run-local.sh --help ``` Open http://localhost:8006 to see the Windows VM with the agent running. If you have a beefy PC, you can instead run the strongest agent configuration in our paper by doing: ```bash ./run-local.sh --gpu-enabled true --som-origin mixed-omni --a11y-backend uia ``` At the end of the run you can display the results using the command: ```bash cd src/win-arena-container/client python show_results.py --result_dir <path_to_results_folder> ``` #### Available Configurations Below is a comparison of various combinations of hyperparameters used by the Navi agent in our study, which can be overridden by specifying `--som-origin <som_origin> --a11y-backend <a11y_backend>` when running the `run-local.sh` script: | Command | Description | Notes | |---------|-------------|--------| | `./run-local.sh --som-origin mixed-omni --a11y-backend uia` | Combines Omniparser with accessibility tree information | ⭐**Recommended for best results** | | `./run-local.sh --som-origin omni` | Uses Omniparser for screen understanding | | | `./run-local.sh --som-origin oss` | Uses webparse, groundingdino, and OCR (TesseractOCR) | 🌲Baseline | | `./run-local.sh --som-origin a11y --a11y-backend uia` | Uses slower, more accurate accessibility tree | | | `./run-local.sh --som-origin a11y --a11y-backend win32` | Uses faster, less accurate accessibility tree | 🐇Fastest | | `./run-local.sh --som-origin mixed-oss --a11y-backend uia` | Combines oss detections with accessibility tree | | - `--som-origin` determines how the Navi agent detects screen elements - `--a11y-backend` specifies the Accessibility backend type (when using `a11y` or mixed modes) #### 4.2 Local development tips At first sight it might seem challenging to develop/debug code running inside the docker container. However, we provide a few tips to make this process easier. Check the [Development-Tips Doc](./docs/Development-Tips.md) for more details such as: - How to attach a VSCode window (with debugger) to the running container - How to change the agent and Windows server code from your local machine and see the changes reflected in real time in the container ## 🌐 Azure Deployment -> Parallelizing the benchmark We offer a seamless way to run the Windows Agent Arena on Azure ML Compute VMs. This option will significantly reduce the time needed to test your agent in all benchmark tasks from hours/days to minutes. ### 1. Set up the Azure resource group: - If you don't already have an Azure subscription, you can start a [free trial](https://azure.microsoft.com/en-us/free/). Take note of the subscription id, we will use it as `AZURE_SUBSCRIPTION_ID` in Section 3. - In the [Azure portal](https://portal.azure.com/), create a new resource group (e.g. `agents`) in the region of your choice. Take note of the resource group name, we will use it as `AZURE_ML_RESOURCE_GROUP` in Section 3. - Within this resource group, create an Azure Machine Learning resource (e.g. name it `agents_ml`). Take note of the ML workspace name, we will use it as `AZURE_ML_WORKSPACE_NAME` in Section 3. During the creation wizard, make sure to check the boxes for automatically creating new: - Storage Account. **Note:** Take note of the Storage Account name, we will use it to upload the golden image in Section 2. - Key vault. - Application Insights. - [optional] Container Registry. You can use the Azure Container Registry to privately store your custom docker images without the need to push them to the public Docker Hub. <div align="center"> <img src="img/azure_create_ml.png" alt="azure_create_ml" height="300"/> </div> - Once creation is complete, navigate to the [Azure Machine Learning portal](https://ml.azure.com/home) and click on your workspace (`agents`) <div align="center"> <img src="img/azure_ml_portal.png" alt="azure_ml_portal" height="200"/> </div> - In the workspace, navigate to the `Notebooks` tab. In your user-assigned folder (as shown in the figure below), create a new bash (.sh) file named `compute-instance-startup.sh`. Copy the content of `scripts/azure_files/compute-instance-startup.sh` into this file and save it. This script will be used every time a new VM is launched in Azure to apply some base configurations. Take note of the path where you save the file (in the form of `Users/<YOUR_USER>/compute-instance-startup.sh`), we will use it to run the script in Section 3. <div align="center"> <img src="img/azure_notebook.png" alt="azure_notebook" height="200"/> </div> - [Optional] You might want to ask for more compute quota for your region depending on your needs. You can do so by navigating to the [Azure Quota page](https://ml.azure.com/quota/). As a reference, we currently use the `Standard_D8_v3` VM size for our benchmarking, which falls under the `Standard Dv3 Family Cluster Dedicated vCPUs` category. Each VM uses 8 cores. Make sure the machine type you use supports [nested virtualization](https://learn.microsoft.com/en-us/answers/questions/813416/how-do-i-know-what-size-azure-vm-supports-nested-v). <div align="center"> <img src="img/azure_quota.png" alt="azure_quota" height="200"/> </div> ### 2. Uploading Windows 11 and Docker images to Azure - Upload the Windows 11 storage folder to the Blob container associated with your default datastore. By default, the Azure ML Workspace's underlying data is backed by a Storage Account through one or more ML datastores. The default datastore, named `workspaceblobstore`, is created during the workspace setup and linked to a Blob container under the Azure Storage Account. You can review the association between the datastores and containers by visiting [Azure ML Datastore](https://ml.azure.com/data/datastore). Once found, you can then upload the storage folder in different ways: - Download the [Azure Storage Explorer](https://azure.microsoft.com/en-us/features/storage-explorer/) program, log in, and select the blob container. Upload the `WindowsAgentArena/src/win-arena-container/vm/storage` folder from your local machine after running the local setup steps.<div align="center"><img src="img/azure_blobstore.png" alt="azure_blobstore" height="100"/></div> - Alternatively, you can use the Azure CLI to upload the folder. To install the CLI, follow the steps provided [here](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli). Once installed, you can use the following command: ```bash az login --use-device-code # Only needed if prompted az storage blob upload-batch --account-name <STORAGE_ACCOUNT_NAME> --destination <CONTAINER_NAME> --source <LOCAL_FOLDER> # For a list of parameters check: https://docs.microsoft.com/en-us/cli/azure/storage/blob?view=azure-cli-latest ``` - Alternatively, use the [Azure portal](https://portal.azure.com/) interface to upload the folder. Navigate to the storage account, click on `Storage browser->Blob containers`, select your container, and upload the folder. This option is not recommended for large files as connections might get unstable. - [Optional] If you are not using the default `windowsarena/winarena:latest` image, you can upload your custom image to the Azure Container Registry. You can do so by following the [Azure Container Registry documentation](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal) ```bash az login --use-device-code # potentially needed if commands below don't work: az acr login --name <ACR_NAME> docker login # you will be prompted to enter your ACR credentials (username + password which can be found in the Azure portal) docker tag <IMAGE_NAME> <ACR_NAME>.azurecr.io/<IMAGE_NAME>:<TAG> docker push <ACR_NAME>.azurecr.io/<IMAGE_NAME>:<TAG> ``` ### 3. Environment configurations and deployment - Add the additional keys to the `config.json` file at the root of the project: ```json { ... // Your previous configs "AZURE_SUBSCRIPTION_ID": "<YOUR_AZURE_SUBSCRIPTION_ID>", "AZURE_ML_RESOURCE_GROUP": "<YOUR_AZURE_ML_RESOURCE_GROUP>", "AZURE_ML_WORKSPACE_NAME": "<YOUR_AZURE_ML_WORKSPACE_NAME>" } ``` - Create a new file named `experiments.json` to specify any parameters needed for each experiment run, including the agent to deploy and the underlying LLM model to use. You can find a reference `experiments.json` consisting of multiple experiments to run at [`scripts/experiments.json`](scripts\experiments.json): ```json { "experiment_1": { "ci_startup_script_path": "Users/<YOUR_USER>/compute-instance-startup.sh", // As seen in Section 1 "agent": "navi", "datastore_input_path": "storage", "docker_img_name": "windowsarena/winarena:latest", "exp_name": "experiment_1", "num_workers": 4, "use_managed_identity": false, "json_name": "evaluation_examples_windows/test_all.json", "model_name": "gpt-4-1106-vision-preview", "som_origin": "oss", // or a11y, or mixed-oss "a11y_backend": "win32" // or uia } // ... } ``` - (Optional) You can also generate the `experiments.json` by using both the `--experiments_json` and `--update_json` parameters of `run_azure.py`, the above JSON is equivalent to the following command: ```bash cd scripts python run_azure.py --experiments_json "experiments.json" --update_json --exp_name "experiment_1" --ci_startup_script_path "Users/<YOUR_USER>/compute-instance-startup.sh" --agent "navi" --json_name "evaluation_examples_windows/test_all.json" --num_workers 4 --som_origin oss --a11y_backend win32 ``` - Deploy the agent on Azure ML Compute by running: ```bash az login --use-device-code # https://learn.microsoft.com/en-us/cli/azure/install-azure-cli # If multiple tenants or subscriptions, make sure to select the right ones with: # az login --use-device-code --tenant "<YOUR_AZURE_AD_TENANT_ID>" # az account set --subscription "<YOUR_AZURE_AD_TENANT_ID>" # Make sure you have installed the python requirements in your conda environment # conda activate winarena # pip install -r requirements.txt # From your activated conda environment: cd scripts python run_azure.py --experiments_json "experiments.json" ``` For any unfinished experiments in `experiments.json`, the script will: 1. Create `<num_workers` Azure Compute Instance VMs. 2. Run one ML Training Job named `<exp_name>` per VM. 3. Dispose the VMs once the jobs are completed. The logs from the run will be saved in a `agent_outputs` folder in the same blob container where you uploaded the Windows 11 image. You can download the `agent_outputs` folder to your local machine and run the `show_azure.py` script to see the results from every experiment as a markdown table. ```bash cd scripts python show_azure.py --json_config "experiments.json" --result_dir <path_to_downloaded_agent_outputs_folder> ``` ## 🤖 BYOA: Bring Your Own Agent Want to test your own agents in Windows Agent Arena? You can use our default agent as a template and create your own folder under `src/win-arena-container/client/mm_agents`. You just need to make sure that your `agent.py` file features `predict()` and `reset()` functions. For more information on agent development check out the [BYOA Doc](./docs/Develop-Agent.md). ## 👩‍💻 Open-source contributions We welcome contributions to the Windows Agent Arena project. In particular, we welcome: - New open-sourced agents to be added to the benchmark - New tasks to be added to our existing categories, or new categories altogether If you are interested in contributing, please check out our [Task Development Guidelines](./docs/Develop-Tasks.md). ## ❓ FAQ ### What are approximate running times and costs for the benchmark? | Component | Cost | Time | |----------|----------|----------| | Azure Standard_D8_v3 VM | ~$8 ($0.38/h * 40 * 0.5h) | | | GPT-4V | $100 | ~35min with 40 VMs | | GPT-4o | $100 | ~35min with 40 VMs | | GPT-4o-mini | $15 | ~30min with 40 VMs | ### How can I customizing resource allocation for local runs? By default, the `run-local.sh` script attempts to create a QEMU VM with 8 GB of RAM and 8 CPU cores. If your system has limited resources, you can override these defaults by specifying the desired RAM and CPU allocation: ```bash ./run-local.sh --ram-size 4G --cpu-cores 4 ``` ### How can I toggle support for KVM acceleration? If your system does not support [KVM acceleration](https://github.com/dockur/windows?tab=readme-ov-file#how-do-i-verify-if-my-system-supports-kvm), you can disable it by specifying the `--use-kvm false` flag: ```bash ./run-local.sh --use-kvm false ``` Note that running the benchmark locally without KVM acceleration is not recommended due to performance issues. In this case, we recommend preparing the golden image for later running the benchmark on Azure. ## 👏 Acknowledgements - [OS World](https://github.com/xlang-ai/OSWorld) for the original benchmark task framework. - [Dockur](https://github.com/dockur/windows) for the Docker infrastructure underlying WAA. - [GroundingDINO](https://github.com/IDEA-Research/GroundingDINO) for the object detection module in our Navi Agent. - [NotebookLM](https://notebooklm.google.com) for our AI-generated podcast. ## 🤝 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. ## 🛡️ 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). 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.

AI & Machine Learning Code Editors & IDEs Testing & QA
865 Github Stars
DebugMCP
Open Source

DebugMCP

# DebugMCP (MCP Server) - Empowering AI Agents with Operational Debugging Capabilities Let AI agents debug your code inside VS Code - set breakpoints, step through execution, inspect variables, and evaluate expressions. Works with **Codex**, **GitHub Copilot**, **GitHub Copilot CLI**, **Cline**, **Cursor**, **Windsurf**, **Roo Code**, and any MCP-compatible assistant. Compatible with any VS Code supported coding language. [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![VS Code](https://img.shields.io/badge/VS%20Code-1.104.0+-blue.svg)](https://code.visualstudio.com/) [![Version](https://img.shields.io/badge/version-2.0.0-green.svg)](https://github.com/microsoft/DebugMCP) [![VS Marketplace](https://img.shields.io/badge/VS%20Marketplace-Install-blue.svg)](https://marketplace.visualstudio.com/items?itemName=ozzafar.debugmcpextension) > ⭐ **If you find DebugMCP useful, please [star the repo on GitHub](https://github.com/microsoft/DebugMCP)!** It helps others discover the project and motivates continued development. > **📢 Developers Notice**: This extension is maintained by [[email protected]](mailto:[email protected]) and [[email protected]](mailto:[email protected]). We welcome feedback and contributions to help improve this extension. > 🎬 Watch DebugMCP in action — your AI assistant autonomously sets breakpoints, steps through code, and inspects variables directly in VS Code. <p align="center"> <img src="assets/DebugMCP.gif" width="800"> </p> ## ✨ What's New in 2.0.0 - **`/debug` Agent Skill** — DebugMCP now ships a companion [Agent Skill](./skills/debug/SKILL.md) that is auto-installed into each configured harness's personal skills directory (e.g. `~/.copilot/skills/debug/`). Invoke it with `/debug` in supporting agents to load the systematic debugging workflow and trigger DebugMCP tools with the right context. - **Robust debugging via the VS Code Testing API** — `start_debugging` with a `testName` now uses the VS Code Testing API to discover and launch the test, replacing the previous best-effort path. This works reliably across language test runners that integrate with the Testing API (pytest, Jest/Vitest, Java, .NET, Go, etc.) and produces consistent breakpoint hits inside individual test cases. ## 🚀 Quick Install **[Install from VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=ozzafar.debugmcpextension)** or use the direct link: `vscode:extension/ozzafar.debugmcpextension` ## Table of Contents - [Overview](#overview) - [Features](#features) - [Installation](#installation) - [Quick Start](#quick-start) - [Supported AI Assistants](#supported-ai-assistants) - [Supported Languages](#supported-languages) - [Configuration](#configuration) - [FAQ](#faq) - [Troubleshooting](#troubleshooting) - [How It Works](#how-it-works) - [Contributing](#contributing) - [License](#license) ## Overview DebugMCP is an MCP server that gives AI coding agents full control over the VS Code debugger. Instead of reading logs or guessing, your AI assistant can autonomously set breakpoints, launch debug sessions, step through code line by line, inspect variable values, and evaluate expressions — just like a human developer would. It runs 100% locally, requires zero configuration, and works out of the box with any MCP-compatible AI assistant. ## Features ### 🔧 Tools | Tool | Description | Parameters | |------|-------------|------------| | **start_debugging** | Start a debug session for a source code file | `fileFullPath` (required)<br>`workingDirectory` (required)<br>`testName` (optional)<br>`configurationName` (optional) | | **stop_debugging** | Stop the current debug session | None | | **step_over** | Execute the next line (step over function calls) | None | | **step_into** | Step into function calls | None | | **step_out** | Step out of the current function | None | | **continue_execution** | Continue until next breakpoint | None | | **restart_debugging** | Restart the current debug session | None | | **add_breakpoint** | Add a breakpoint at a specific line | `fileFullPath` (required)<br>`lineContent` (required) | | **remove_breakpoint** | Remove a breakpoint from a specific line | `fileFullPath` (required)<br>`line` (required) | | **clear_all_breakpoints** | Remove all breakpoints at once | None | | **list_breakpoints** | List all active breakpoints | None | | **get_variables_values** | Get variables and their values at current execution point | `scope` (optional: 'local', 'global', 'all') | | **evaluate_expression** | Evaluate an expression in debug context | `expression` (required) | > **Note:** The MCP server intentionally exposes **tools only** — no procedural > instructions, no documentation resources. Workflow guidance (when to debug, how to > structure a root-cause investigation, language-specific quirks) lives in the companion > [DebugMCP Agent Skill](./skills/debug/SKILL.md) so it can be loaded into an > agent's prompt context independently of the MCP capability surface. ### 🎯 Debugging Best Practices DebugMCP follows systematic debugging practices for effective issue resolution: - **Start with Entry Points**: Begin debugging at function entry points or main execution paths - **Follow the Execution Flow**: Use step-by-step execution to understand code flow - **Root Cause Analysis**: Don't stop at symptoms - find the underlying cause ### 🛡️ Security & Reliability - **Secure Communication**: All MCP communications use secure protocols - **Local Operation**: The MCP server runs 100% locally with no external communications and requires no credentials - **State Validation**: Robust validation of debugging states and operations ## Installation ### Quick Install Options **Option 1: Direct Link** (Fastest) - Click this link: [vscode:extension/ozzafar.debugmcpextension](vscode:extension/ozzafar.debugmcpextension) - Or copy and paste in your browser: `vscode:extension/ozzafar.debugmcpextension` **Option 2: VS Code Marketplace** - Visit: [https://marketplace.visualstudio.com/items?itemName=ozzafar.debugmcpextension](https://marketplace.visualstudio.com/items?itemName=ozzafar.debugmcpextension) - Click "Install" **Option 3: Within VS Code** 1. Open VSCode 2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X) 3. Search for "DebugMCP" 4. Click Install 5. The extension automatically activates and registers as an MCP server ### Verification After installation, you should see: - DebugMCP extension in your installed extensions - MCP server automatically running on port 3001 (configurable) - Debug tools available to connected AI assistants > **📝 Note**: No additional debugging rule instructions are needed - the extension works out of the box. > **💡 Tip**: Enable auto-approval for all debugmcp tools in your AI assistant to create seamless debugging workflows without constant approval interruptions. ## Quick Start 1. **Install the extension** (see [Installation](#installation)) 2. **Open your project** in VSCode 3. **Ask your AI to debug** - it can now set breakpoints, start debugging, and analyze your code! ## Supported AI Assistants DebugMCP works with any MCP-compatible AI assistant. It auto-detects and offers to register itself with: | Assistant | Auto-Registration | Manual Config | |-----------|:-----------------:|:-------------:| | **GitHub Copilot** | ✅ | [See config](#github-copilot) | | **GitHub Copilot CLI** | ✅ | [See config](#github-copilot-cli) | | **Cline** | ✅ | [See config](#cline) | | **Cursor** | ✅ | [See config](#cursor) | | **Codex** | ✅ | [See config](#codex) | | **Windsurf** | ✅ | [See config](#windsurf) | | **Roo Code** | ✅ | [See config](#roo-code) | | **Antigravity** | ✅ | [See config](#antigravity) | | Any MCP-compatible assistant | — | [See manual setup](#manual-mcp-server-registration-optional) | ## Supported Languages DebugMCP supports debugging for the following languages with their respective VSCode extensions: | Language | Extension Required | File Extensions | Status | |----------|-------------------|-----------------|---------| | **Python** | [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) | `.py` | ✅ Fully Supported | | **JavaScript/TypeScript** | Built-in / [JS Debugger](https://marketplace.visualstudio.com/items?itemName=ms-vscode.js-debug) | `.js`, `.ts`, `.jsx`, `.tsx` | ✅ Fully Supported | | **Java** | [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) | `.java` | ✅ Fully Supported | | **C/C++** | [C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) | `.c`, `.cpp`, `.cc` | ✅ Fully Supported | | **Go** | [Go](https://marketplace.visualstudio.com/items?itemName=golang.Go) | `.go` | ✅ Fully Supported | | **Rust** | [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) | `.rs` | ✅ Fully Supported | | **PHP** | [PHP Debug](https://marketplace.visualstudio.com/items?itemName=xdebug.php-debug) | `.php` | ✅ Fully Supported | | **Ruby** | [Ruby](https://marketplace.visualstudio.com/items?itemName=rebornix.ruby) | `.rb` | ✅ Fully Supported | | **C#/.NET** | [C#](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) | `.cs`, `.csproj` | ✅ Fully Supported | ## Configuration ### MCP Server Configuration (Recommended) The extension runs an MCP server automatically. It will pop up a message to auto-register the MCP server in your AI assistant. You can also trigger the registration manually via the Command Palette: - **`DebugMCP: Show Agent Selection Popup`** ### Manual MCP Server Registration (Optional) > **🔄 Auto-Migration**: If you previously configured DebugMCP with SSE transport, the extension will automatically migrate your configuration to the new Streamable HTTP transport on activation. #### Cline Add to your Cline settings or `cline_mcp_settings.json`: ```json { "mcpServers": { "debugmcp": { "type": "streamableHttp", "url": "http://localhost:3001/mcp", "description": "DebugMCP - AI-powered debugging assistant" } } } ``` #### GitHub Copilot Add to your VS Code settings (`settings.json`): ```json { "mcp": { "servers": { "debugmcp": { "type": "http", "url": "http://localhost:3001/mcp", "description": "DebugMCP - Multi-language debugging support" } } } } ``` #### GitHub Copilot CLI Add to `~/.copilot/mcp-config.json` (`${COPILOT_HOME}/mcp-config.json` if `COPILOT_HOME` is set): ```json { "mcpServers": { "debugmcp": { "type": "http", "url": "http://localhost:3001/mcp", "tools": ["*"] } } } ``` #### Cursor Add to Cursor's MCP settings: ```json { "mcpServers": { "debugmcp": { "type": "streamableHttp", "url": "http://localhost:3001/mcp", "description": "DebugMCP - Debugging tools for AI assistants" } } } ``` #### Codex Register DebugMCP with Codex: ```bash codex mcp add debugmcp --url http://localhost:3001/mcp ``` Or add the equivalent configuration to `~/.codex/config.toml` (`${CODEX_HOME}/config.toml` if `CODEX_HOME` is set): ```toml [mcp_servers.debugmcp] url = "http://localhost:3001/mcp" ``` #### Windsurf Add to Windsurf's MCP settings (`~/.windsurf/mcp_settings.json` or workspace `.windsurf/mcp_settings.json`): ```json { "mcpServers": { "debugmcp": { "type": "streamableHttp", "url": "http://localhost:3001/mcp", "description": "DebugMCP - Debugging tools for AI assistants" } } } ``` #### Roo Code Add to Roo Code's MCP settings: ```json { "mcpServers": { "debugmcp": { "type": "streamableHttp", "url": "http://localhost:3001/mcp", "description": "DebugMCP - Debugging tools for AI assistants" } } } ``` #### Antigravity Add to Antigravity's MCP settings: ```json { "mcpServers": { "debugmcp": { "type": "streamableHttp", "url": "http://localhost:3001/mcp", "description": "DebugMCP - Debugging tools for AI assistants" } } } ``` ### Extension Settings Configure DebugMCP behavior in VSCode settings: ```json { "debugmcp.serverPort": 3001, "debugmcp.timeoutInSeconds": 180, "debugmcp.bindHost": ["127.0.0.1", "::1"] } ``` | Setting | Default | Description | |---------|---------|-------------| | `debugmcp.serverPort` | `3001` | Port number for the MCP server | | `debugmcp.timeoutInSeconds` | `180` | Timeout for debugging operations | | `debugmcp.bindHost` | `["127.0.0.1", "::1"]` | Network interface(s) the HTTP server binds to. Accepts a string or array of strings. See [Security model](#security-model) before changing. | ### Security model DebugMCP exposes powerful debugger primitives (`evaluate_expression`, `start_debugging`, …) over an unauthenticated local HTTP endpoint. To keep that surface safe, the server enforces two controls: 1. **Loopback-only bind.** The HTTP server binds to the IPv4 and IPv6 loopback addresses (`127.0.0.1` and `::1`) by default, so other hosts on your network cannot reach `http://<your-ip>:3001/mcp`. Binding both families ensures clients that resolve `localhost` to either family connect successfully. The `debugmcp.bindHost` setting (string or array of strings) lets you opt into a different interface (for example, when forwarding the port into a remote container), but doing so exposes the unauthenticated debugger to anything that can route to that address — do not point it at `0.0.0.0` or a LAN address on an untrusted network. 2. **Host / Origin header validation.** Every request must carry a `Host` header naming a loopback address (`localhost`, `127.0.0.1`, or `[::1]`); any port suffix in the `Host` must also match the server's listening port. Requests with any other `Host` — including those that arrive via DNS rebinding from a malicious webpage — are rejected with HTTP 403. The same loopback check is applied to the `Origin` header when present. ## FAQ <details> <summary><b>Which AI assistants are supported?</b></summary> DebugMCP works with any MCP-compatible AI assistant, including **GitHub Copilot**, **GitHub Copilot CLI**, **Cline**, **Cursor**, **Codex**, **Windsurf**, **Roo Code**, **Antigravity**, and others. If your assistant supports the Model Context Protocol, it can use DebugMCP. </details> <details> <summary><b>Does it work with VS Code Remote SSH / Codespaces / WSL?</b></summary> Yes. DebugMCP runs as a VS Code extension with `extensionKind: workspace`, so it activates in the remote environment where your code lives. The MCP server runs on `localhost` within that remote context. </details> <details> <summary><b>Do I need to configure launch.json?</b></summary> No. DebugMCP automatically generates appropriate debug configurations based on the file's language/extension. If you have a `launch.json`, it will automatically pick the most relevant configuration. </details> <details> <summary><b>Is my code sent to any external service?</b></summary> No. DebugMCP runs 100% locally. The MCP server runs on `localhost`, and no code, variables, or debug data is sent to any external service. The AI assistant communicates with the MCP server entirely within your local machine. </details> <details> <summary><b>What if port 3001 is already in use?</b></summary> Change the port in VS Code settings: `"debugmcp.serverPort": 3002` (or any available port). Then update your AI assistant's MCP configuration to use the new port. </details> <details> <summary><b>Can I debug unit tests?</b></summary> Yes. Pass the `testName` parameter to `start_debugging` to debug a specific test method. DebugMCP will configure the debug session to run and pause at breakpoints within that test. </details> <details> <summary><b>Why is my AI assistant not using the debug tools?</b></summary> Make sure DebugMCP is registered in your AI assistant's MCP settings. The extension should auto-detect and offer to register itself. If not, see the [Manual MCP Server Registration](#manual-mcp-server-registration-optional) section. Also enable auto-approval for DebugMCP tools for a smoother workflow. </details> <details> <summary><b>Does it support ASP.NET / .csproj projects?</b></summary> Yes. DebugMCP supports `.cs` files and `.csproj` project files for C#/.NET debugging, including ASP.NET applications. </details> ## Troubleshooting ### Common Issues #### MCP Server Not Starting - **Symptom**: AI assistant can't connect to DebugMCP - **Solution**: - Check if port 3001 is available - Restart VSCode - Verify extension is installed and activated #### Debug Session Not Stopping at Breakpoints - **Symptom**: Breakpoints are set but execution doesn't pause - **Solution**: - Ensure the correct file is being debugged - Check that the breakpoint line content matches exactly - Verify the relevant language debugger extension is installed #### Configuration Not Auto-Detected - **Symptom**: Extension doesn't prompt to register with your AI assistant - **Solution**: - Run **`DebugMCP: Show Agent Selection Popup`** from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) - Manually add the configuration (see [Manual MCP Server Registration](#manual-mcp-server-registration-optional)) ## How It Works ### Architecture <p align="center"> <img src="assets/architecture.png" alt="DebugMCP Architecture" width="800"> </p> ``` AI Agent (Copilot/Cline/Cursor/Codex) → MCP/Streamable HTTP → DebugMCPServer → DebuggingHandler → VS Code Debug API ``` ### Launch Configuration Integration The extension handles debug configurations intelligently: - **Existing launch.json**: If a `.vscode/launch.json` file exists, it will: - Search for a relevant configuration - Honor `configurationName` when explicitly provided by the agent - Support JSONC (JSON with comments and trailing commas) - **Default Configuration**: If `configurationName` is omitted, or if no matching named configuration is found, it creates an appropriate default configuration for each language based on file extension detection ## Requirements - VSCode with appropriate language extensions installed: - **Python**: [Python extension](vscode:extension/ms-python.debugpy) for `.py` files - **JavaScript/TypeScript**: Built-in Node.js debugger or [JavaScript Debugger extension](vscode:extension/ms-vscode.js-debug) - **Java**: [Extension Pack for Java](vscode:extension/vscjava.vscode-java-pack) - **C#/.NET**: [C# extension](vscode:extension/ms-dotnettools.csharp) - **C/C++**: [C/C++ extension](vscode:extension/ms-vscode.cpptools) - **Go**: [Go extension](vscode:extension/golang.go) - **Rust**: [rust-analyzer extension](vscode:extension/rust-lang.rust-analyzer) - **PHP**: [PHP Debug extension](vscode:extension/xdebug.php-debug) - **Ruby**: [Ruby extension](vscode:extension/rebornix.ruby) with debug support - MCP-compatible AI assistant (Copilot, Cline, Cursor, Codex, Windsurf, Roo Code, etc.) ## Development To build the extension: ```bash npm install npm run compile ``` To run linting: ```bash npm run lint ``` To run tests: ```bash npm test ``` ## 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. ## Security Security vulnerabilities should be reported following the guidance at [https://aka.ms/SECURITY.md](https://aka.ms/SECURITY.md). Please do not report security vulnerabilities through public GitHub issues. ## 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). 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. ## ⭐ Support DebugMCP If DebugMCP has helped you debug faster, please consider giving it a star on GitHub! Stars help the project gain visibility and attract contributors. **[⭐ Star DebugMCP on GitHub](https://github.com/microsoft/DebugMCP)** ### Star History <a href="https://star-history.com/#microsoft/DebugMCP&Date"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=microsoft/DebugMCP&type=Date&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=microsoft/DebugMCP&type=Date" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=microsoft/DebugMCP&type=Date" /> </picture> </a> ## License MIT License - See [LICENSE](LICENSE.txt) for details This extension was created by **Oz Zafar**, **Ori Bar-Ilan** and **Karin Brisker**.

AI Agents Testing & QA
370 Github Stars
ML-For-Beginners
Open Source

ML-For-Beginners

[![GitHub license](https://img.shields.io/github/license/microsoft/ML-For-Beginners.svg)](https://github.com/microsoft/ML-For-Beginners/blob/master/LICENSE) [![GitHub contributors](https://img.shields.io/github/contributors/microsoft/ML-For-Beginners.svg)](https://GitHub.com/microsoft/ML-For-Beginners/graphs/contributors/) [![GitHub issues](https://img.shields.io/github/issues/microsoft/ML-For-Beginners.svg)](https://GitHub.com/microsoft/ML-For-Beginners/issues/) [![GitHub pull-requests](https://img.shields.io/github/issues-pr/microsoft/ML-For-Beginners.svg)](https://GitHub.com/microsoft/ML-For-Beginners/pulls/) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![GitHub watchers](https://img.shields.io/github/watchers/microsoft/ML-For-Beginners.svg?style=social&label=Watch)](https://GitHub.com/microsoft/ML-For-Beginners/watchers/) [![GitHub forks](https://img.shields.io/github/forks/microsoft/ML-For-Beginners.svg?style=social&label=Fork)](https://GitHub.com/microsoft/ML-For-Beginners/network/) [![GitHub stars](https://img.shields.io/github/stars/microsoft/ML-For-Beginners.svg?style=social&label=Star)](https://GitHub.com/microsoft/ML-For-Beginners/stargazers/) ### 🌐 Multi-Language Support #### Supported via GitHub Action (Automated & Always Up-to-Date) <!-- CO-OP TRANSLATOR LANGUAGES TABLE START --> [Arabic](./translations/ar/README.md) | [Bengali](./translations/bn/README.md) | [Bulgarian](./translations/bg/README.md) | [Burmese (Myanmar)](./translations/my/README.md) | [Chinese (Simplified)](./translations/zh-CN/README.md) | [Chinese (Traditional, Hong Kong)](./translations/zh-HK/README.md) | [Chinese (Traditional, Macau)](./translations/zh-MO/README.md) | [Chinese (Traditional, Taiwan)](./translations/zh-TW/README.md) | [Croatian](./translations/hr/README.md) | [Czech](./translations/cs/README.md) | [Danish](./translations/da/README.md) | [Dutch](./translations/nl/README.md) | [Estonian](./translations/et/README.md) | [Finnish](./translations/fi/README.md) | [French](./translations/fr/README.md) | [German](./translations/de/README.md) | [Greek](./translations/el/README.md) | [Hebrew](./translations/he/README.md) | [Hindi](./translations/hi/README.md) | [Hungarian](./translations/hu/README.md) | [Indonesian](./translations/id/README.md) | [Italian](./translations/it/README.md) | [Japanese](./translations/ja/README.md) | [Kannada](./translations/kn/README.md) | [Khmer](./translations/km/README.md) | [Korean](./translations/ko/README.md) | [Lithuanian](./translations/lt/README.md) | [Malay](./translations/ms/README.md) | [Malayalam](./translations/ml/README.md) | [Marathi](./translations/mr/README.md) | [Nepali](./translations/ne/README.md) | [Nigerian Pidgin](./translations/pcm/README.md) | [Norwegian](./translations/no/README.md) | [Persian (Farsi)](./translations/fa/README.md) | [Polish](./translations/pl/README.md) | [Portuguese (Brazil)](./translations/pt-BR/README.md) | [Portuguese (Portugal)](./translations/pt-PT/README.md) | [Punjabi (Gurmukhi)](./translations/pa/README.md) | [Romanian](./translations/ro/README.md) | [Russian](./translations/ru/README.md) | [Serbian (Cyrillic)](./translations/sr/README.md) | [Slovak](./translations/sk/README.md) | [Slovenian](./translations/sl/README.md) | [Spanish](./translations/es/README.md) | [Swahili](./translations/sw/README.md) | [Swedish](./translations/sv/README.md) | [Tagalog (Filipino)](./translations/tl/README.md) | [Tamil](./translations/ta/README.md) | [Telugu](./translations/te/README.md) | [Thai](./translations/th/README.md) | [Turkish](./translations/tr/README.md) | [Ukrainian](./translations/uk/README.md) | [Urdu](./translations/ur/README.md) | [Vietnamese](./translations/vi/README.md) > **Prefer to Clone Locally?** > > This repository includes 50+ language translations which significantly increases the download size. To clone without translations, use sparse checkout: > > **Bash / macOS / Linux:** > ```bash > git clone --filter=blob:none --sparse https://github.com/microsoft/ML-For-Beginners.git > cd ML-For-Beginners > git sparse-checkout set --no-cone '/*' '!translations' '!translated_images' > ``` > > **CMD (Windows):** > ```cmd > git clone --filter=blob:none --sparse https://github.com/microsoft/ML-For-Beginners.git > cd ML-For-Beginners > git sparse-checkout set --no-cone "/*" "!translations" "!translated_images" > ``` > > This gives you everything you need to complete the course with a much faster download. <!-- CO-OP TRANSLATOR LANGUAGES TABLE END --> #### Join Our Community [![Microsoft Foundry Discord](https://dcbadge.limes.pink/api/server/nTYy5BXMWG)](https://discord.gg/nTYy5BXMWG) We have a Discord learn with AI series ongoing, learn more and join us at [Learn with AI Series](https://aka.ms/learnwithai/discord) from 18 - 30 September, 2025. You will get tips and tricks of using GitHub Copilot for Data Science. ![Learn with AI series](/images/3.png) # Machine Learning for Beginners - A Curriculum > 🌍 Travel around the world as we explore Machine Learning by means of world cultures 🌍 Cloud Advocates at Microsoft are pleased to offer a 12-week, 26-lesson curriculum all about **Machine Learning**. In this curriculum, you will learn about what is sometimes called **classic machine learning**, using primarily Scikit-learn as a library and avoiding deep learning, which is covered in our [AI for Beginners' curriculum](https://aka.ms/ai4beginners). Pair these lessons with our ['Data Science for Beginners' curriculum](https://aka.ms/ds4beginners), as well! Travel with us around the world as we apply these classic techniques to data from many areas of the world. Each lesson includes pre- and post-lesson quizzes, written instructions to complete the lesson, a solution, an assignment, and more. Our project-based pedagogy allows you to learn while building, a proven way for new skills to 'stick'. **✍️ Hearty thanks to our authors** Jen Looper, Stephen Howell, Francesca Lazzeri, Tomomi Imura, Cassie Breviu, Dmitry Soshnikov, Chris Noring, Anirban Mukherjee, Ornella Altunyan, Ruth Yakubu and Amy Boyd **🎨 Thanks as well to our illustrators** Tomomi Imura, Dasani Madipalli, and Jen Looper **🙏 Special thanks 🙏 to our Microsoft Student Ambassador authors, reviewers, and content contributors**, notably Rishit Dagli, Muhammad Sakib Khan Inan, Rohan Raj, Alexandru Petrescu, Abhishek Jaiswal, Nawrin Tabassum, Ioan Samuila, and Snigdha Agarwal **🤩 Extra gratitude to Microsoft Student Ambassadors Eric Wanjau, Jasleen Sondhi, and Vidushi Gupta for our R lessons!** # Getting Started Follow these steps: 1. **Fork the Repository**: Click on the "Fork" button at the top-right corner of this page. 2. **Clone the Repository**: `git clone https://github.com/microsoft/ML-For-Beginners.git` > [find all additional resources for this course in our Microsoft Learn collection](https://learn.microsoft.com/en-us/collections/qrqzamz1nn2wx3?WT.mc_id=academic-77952-bethanycheum) > 🔧 **Need help?** Check our [Troubleshooting Guide](TROUBLESHOOTING.md) for solutions to common issues with installation, setup, and running lessons. **[Students](https://aka.ms/student-page)**, to use this curriculum, fork the entire repo to your own GitHub account and complete the exercises on your own or with a group: - Start with a pre-lecture quiz. - Read the lecture and complete the activities, pausing and reflecting at each knowledge check. - Try to create the projects by comprehending the lessons rather than running the solution code; however that code is available in the `/solution` folders in each project-oriented lesson. - Take the post-lecture quiz. - Complete the challenge. - Complete the assignment. - After completing a lesson group, visit the [Discussion Board](https://github.com/microsoft/ML-For-Beginners/discussions) and "learn out loud" by filling out the appropriate PAT rubric. A 'PAT' is a Progress Assessment Tool that is a rubric you fill out to further your learning. You can also react to other PATs so we can learn together. > For further study, we recommend following these [Microsoft Learn](https://docs.microsoft.com/en-us/users/jenlooper-2911/collections/k7o7tg1gp306q4?WT.mc_id=academic-77952-leestott) modules and learning paths. **Teachers**, we have [included some suggestions](for-teachers.md) on how to use this curriculum. --- ## Video walkthroughs Some of the lessons are available as short form video. You can find all these in-line in the lessons, or on the [ML for Beginners playlist on the Microsoft Developer YouTube channel](https://aka.ms/ml-beginners-videos) by clicking the image below. [![ML for beginners banner](./images/ml-for-beginners-video-banner.png)](https://aka.ms/ml-beginners-videos) --- ## Meet the Team [![Promo video](./images/ml.gif)](https://youtu.be/Tj1XWrDSYJU) **Gif by** [Mohit Jaisal](https://linkedin.com/in/mohitjaisal) > 🎥 Click the image above for a video about the project and the folks who created it! --- ## Pedagogy We have chosen two pedagogical tenets while building this curriculum: ensuring that it is hands-on **project-based** and that it includes **frequent quizzes**. In addition, this curriculum has a common **theme** to give it cohesion. By ensuring that the content aligns with projects, the process is made more engaging for students and retention of concepts will be augmented. In addition, a low-stakes quiz before a class sets the intention of the student towards learning a topic, while a second quiz after class ensures further retention. This curriculum was designed to be flexible and fun and can be taken in whole or in part. The projects start small and become increasingly complex by the end of the 12-week cycle. This curriculum also includes a postscript on real-world applications of ML, which can be used as extra credit or as a basis for discussion. > Find our [Code of Conduct](CODE_OF_CONDUCT.md), [Contributing](CONTRIBUTING.md), [Translations](translations), and [Troubleshooting](TROUBLESHOOTING.md) guidelines. We welcome your constructive feedback! ## Each lesson includes - optional sketchnote - optional supplemental video - video walkthrough (some lessons only) - [pre-lecture warmup quiz](https://ff-quizzes.netlify.app/en/ml/) - written lesson - for project-based lessons, step-by-step guides on how to build the project - knowledge checks - a challenge - supplemental reading - assignment - [post-lecture quiz](https://ff-quizzes.netlify.app/en/ml/) > **A note about languages**: These lessons are primarily written in Python, but many are also available in R. To complete an R lesson, go to the `/solution` folder and look for R lessons. They include an .rmd extension that represents an **R Markdown** file which can be simply defined as an embedding of `code chunks` (of R or other languages) and a `YAML header` (that guides how to format outputs such as PDF) in a `Markdown document`. As such, it serves as an exemplary authoring framework for data science since it allows you to combine your code, its output, and your thoughts by allowing you to write them down in Markdown. Moreover, R Markdown documents can be rendered to output formats such as PDF, HTML, or Word. > **A note about quizzes**: All quizzes are contained in [Quiz App folder](./quiz-app/), for 52 total quizzes of three questions each. They are linked from within the lessons but the quiz app can be run locally; follow the instruction in the `quiz-app` folder to locally host or deploy to Azure. | Lesson Number | Topic | Lesson Grouping | Learning Objectives | Linked Lesson | Author | | :-----------: | :------------------------------------------------------------: | :-------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------: | | 01 | Introduction to machine learning | [Introduction](1-Introduction/README.md) | Learn the basic concepts behind machine learning | [Lesson](1-Introduction/1-intro-to-ML/README.md) | Muhammad | | 02 | The History of machine learning | [Introduction](1-Introduction/README.md) | Learn the history underlying this field | [Lesson](1-Introduction/2-history-of-ML/README.md) | Jen and Amy | | 03 | Fairness and machine learning | [Introduction](1-Introduction/README.md) | What are the important philosophical issues around fairness that students should consider when building and applying ML models? | [Lesson](1-Introduction/3-fairness/README.md) | Tomomi | | 04 | Techniques for machine learning | [Introduction](1-Introduction/README.md) | What techniques do ML researchers use to build ML models? | [Lesson](1-Introduction/4-techniques-of-ML/README.md) | Chris and Jen | | 05 | Introduction to regression | [Regression](2-Regression/README.md) | Get started with Python and Scikit-learn for regression models | [Python](2-Regression/1-Tools/README.md) • [R](2-Regression/1-Tools/solution/R/lesson_1.html) | Jen • Eric Wanjau | | 06 | North American pumpkin prices 🎃 | [Regression](2-Regression/README.md) | Visualize and clean data in preparation for ML | [Python](2-Regression/2-Data/README.md) • [R](2-Regression/2-Data/solution/R/lesson_2.html) | Jen • Eric Wanjau | | 07 | North American pumpkin prices 🎃 | [Regression](2-Regression/README.md) | Build linear and polynomial regression models | [Python](2-Regression/3-Linear/README.md) • [R](2-Regression/3-Linear/solution/R/lesson_3.html) | Jen and Dmitry • Eric Wanjau | | 08 | North American pumpkin prices 🎃 | [Regression](2-Regression/README.md) | Build a logistic regression model | [Python](2-Regression/4-Logistic/README.md) • [R](2-Regression/4-Logistic/solution/R/lesson_4.html) | Jen • Eric Wanjau | | 09 | A Web App 🔌 | [Web App](3-Web-App/README.md) | Build a web app to use your trained model | [Python](3-Web-App/1-Web-App/README.md) | Jen | | 10 | Introduction to classification | [Classification](4-Classification/README.md) | Clean, prep, and visualize your data; introduction to classification | [Python](4-Classification/1-Introduction/README.md) • [R](4-Classification/1-Introduction/solution/R/lesson_10.html) | Jen and Cassie • Eric Wanjau | | 11 | Delicious Asian and Indian cuisines 🍜 | [Classification](4-Classification/README.md) | Introduction to classifiers | [Python](4-Classification/2-Classifiers-1/README.md) • [R](4-Classification/2-Classifiers-1/solution/R/lesson_11.html) | Jen and Cassie • Eric Wanjau | | 12 | Delicious Asian and Indian cuisines 🍜 | [Classification](4-Classification/README.md) | More classifiers | [Python](4-Classification/3-Classifiers-2/README.md) • [R](4-Classification/3-Classifiers-2/solution/R/lesson_12.html) | Jen and Cassie • Eric Wanjau | | 13 | Delicious Asian and Indian cuisines 🍜 | [Classification](4-Classification/README.md) | Build a recommender web app using your model | [Python](4-Classification/4-Applied/README.md) | Jen | | 14 | Introduction to clustering | [Clustering](5-Clustering/README.md) | Clean, prep, and visualize your data; Introduction to clustering | [Python](5-Clustering/1-Visualize/README.md) • [R](5-Clustering/1-Visualize/solution/R/lesson_14.html) | Jen • Eric Wanjau | | 15 | Exploring Nigerian Musical Tastes 🎧 | [Clustering](5-Clustering/README.md) | Explore the K-Means clustering method | [Python](5-Clustering/2-K-Means/README.md) • [R](5-Clustering/2-K-Means/solution/R/lesson_15.html) | Jen • Eric Wanjau | | 16 | Introduction to natural language processing ☕️ | [Natural language processing](6-NLP/README.md) | Learn the basics about NLP by building a simple bot | [Python](6-NLP/1-Introduction-to-NLP/README.md) | Stephen | | 17 | Common NLP Tasks ☕️ | [Natural language processing](6-NLP/README.md) | Deepen your NLP knowledge by understanding common tasks required when dealing with language structures | [Python](6-NLP/2-Tasks/README.md) | Stephen | | 18 | Translation and sentiment analysis ♥️ | [Natural language processing](6-NLP/README.md) | Translation and sentiment analysis with Jane Austen | [Python](6-NLP/3-Translation-Sentiment/README.md) | Stephen | | 19 | Romantic hotels of Europe ♥️ | [Natural language processing](6-NLP/README.md) | Sentiment analysis with hotel reviews 1 | [Python](6-NLP/4-Hotel-Reviews-1/README.md) | Stephen | | 20 | Romantic hotels of Europe ♥️ | [Natural language processing](6-NLP/README.md) | Sentiment analysis with hotel reviews 2 | [Python](6-NLP/5-Hotel-Reviews-2/README.md) | Stephen | | 21 | Introduction to time series forecasting | [Time series](7-TimeSeries/README.md) | Introduction to time series forecasting | [Python](7-TimeSeries/1-Introduction/README.md) | Francesca | | 22 | ⚡️ World Power Usage ⚡️ - time series forecasting with ARIMA | [Time series](7-TimeSeries/README.md) | Time series forecasting with ARIMA | [Python](7-TimeSeries/2-ARIMA/README.md) | Francesca | | 23 | ⚡️ World Power Usage ⚡️ - time series forecasting with SVR | [Time series](7-TimeSeries/README.md) | Time series forecasting with Support Vector Regressor | [Python](7-TimeSeries/3-SVR/README.md) | Anirban | | 24 | Introduction to reinforcement learning | [Reinforcement learning](8-Reinforcement/README.md) | Introduction to reinforcement learning with Q-Learning | [Python](8-Reinforcement/1-QLearning/README.md) | Dmitry | | 25 | Help Peter avoid the wolf! 🐺 | [Reinforcement learning](8-Reinforcement/README.md) | Reinforcement learning Gym | [Python](8-Reinforcement/2-Gym/README.md) | Dmitry | | Postscript | Real-World ML scenarios and applications | [ML in the Wild](9-Real-World/README.md) | Interesting and revealing real-world applications of classical ML | [Lesson](9-Real-World/1-Applications/README.md) | Team | | Postscript | Model Debugging in ML using RAI dashboard | [ML in the Wild](9-Real-World/README.md) | Model Debugging in Machine Learning using Responsible AI dashboard components | [Lesson](9-Real-World/2-Debugging-ML-Models/README.md) | Ruth Yakubu | > [find all additional resources for this course in our Microsoft Learn collection](https://learn.microsoft.com/en-us/collections/qrqzamz1nn2wx3?WT.mc_id=academic-77952-bethanycheum) ## Offline access You can run this documentation offline by using [Docsify](https://docsify.js.org/#/). Fork this repo, [install Docsify](https://docsify.js.org/#/quickstart) on your local machine, and then in the root folder of this repo, type `docsify serve`. The website will be served on port 3000 on your localhost: `localhost:3000`. ## PDFs Find a pdf of the curriculum with links [here](https://microsoft.github.io/ML-For-Beginners/pdf/readme.pdf). ## 🎒 Other Courses Our team produces other courses! Check out: <!-- CO-OP TRANSLATOR OTHER COURSES START --> ### LangChain [![LangChain4j for Beginners](https://img.shields.io/badge/LangChain4j%20for%20Beginners-22C55E?style=for-the-badge&&labelColor=E5E7EB&color=0553D6)](https://aka.ms/langchain4j-for-beginners) [![LangChain.js for Beginners](https://img.shields.io/badge/LangChain.js%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=0553D6)](https://aka.ms/langchainjs-for-beginners?WT.mc_id=m365-94501-dwahlin) [![LangChain for Beginners](https://img.shields.io/badge/LangChain%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=0553D6)](https://github.com/microsoft/langchain-for-beginners?WT.mc_id=m365-94501-dwahlin) --- ### Azure / Edge / MCP / Agents [![AZD for Beginners](https://img.shields.io/badge/AZD%20for%20Beginners-0078D4?style=for-the-badge&labelColor=E5E7EB&color=0078D4)](https://github.com/microsoft/AZD-for-beginners?WT.mc_id=academic-105485-koreyst) [![Edge AI for Beginners](https://img.shields.io/badge/Edge%20AI%20for%20Beginners-00B8E4?style=for-the-badge&labelColor=E5E7EB&color=00B8E4)](https://github.com/microsoft/edgeai-for-beginners?WT.mc_id=academic-105485-koreyst) [![MCP for Beginners](https://img.shields.io/badge/MCP%20for%20Beginners-009688?style=for-the-badge&labelColor=E5E7EB&color=009688)](https://github.com/microsoft/mcp-for-beginners?WT.mc_id=academic-105485-koreyst) [![AI Agents for Beginners](https://img.shields.io/badge/AI%20Agents%20for%20Beginners-00C49A?style=for-the-badge&labelColor=E5E7EB&color=00C49A)](https://github.com/microsoft/ai-agents-for-beginners?WT.mc_id=academic-105485-koreyst) --- ### Generative AI Series [![Generative AI for Beginners](https://img.shields.io/badge/Generative%20AI%20for%20Beginners-8B5CF6?style=for-the-badge&labelColor=E5E7EB&color=8B5CF6)](https://github.com/microsoft/generative-ai-for-beginners?WT.mc_id=academic-105485-koreyst) [![Generative AI (.NET)](https://img.shields.io/badge/Generative%20AI%20(.NET)-9333EA?style=for-the-badge&labelColor=E5E7EB&color=9333EA)](https://github.com/microsoft/Generative-AI-for-beginners-dotnet?WT.mc_id=academic-105485-koreyst) [![Generative AI (Java)](https://img.shields.io/badge/Generative%20AI%20(Java)-C084FC?style=for-the-badge&labelColor=E5E7EB&color=C084FC)](https://github.com/microsoft/generative-ai-for-beginners-java?WT.mc_id=academic-105485-koreyst) [![Generative AI (JavaScript)](https://img.shields.io/badge/Generative%20AI%20(JavaScript)-E879F9?style=for-the-badge&labelColor=E5E7EB&color=E879F9)](https://github.com/microsoft/generative-ai-with-javascript?WT.mc_id=academic-105485-koreyst) --- ### Core Learning [![ML for Beginners](https://img.shields.io/badge/ML%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=22C55E)](https://aka.ms/ml-beginners?WT.mc_id=academic-105485-koreyst) [![Data Science for Beginners](https://img.shields.io/badge/Data%20Science%20for%20Beginners-84CC16?style=for-the-badge&labelColor=E5E7EB&color=84CC16)](https://aka.ms/datascience-beginners?WT.mc_id=academic-105485-koreyst) [![AI for Beginners](https://img.shields.io/badge/AI%20for%20Beginners-A3E635?style=for-the-badge&labelColor=E5E7EB&color=A3E635)](https://aka.ms/ai-beginners?WT.mc_id=academic-105485-koreyst) [![Cybersecurity for Beginners](https://img.shields.io/badge/Cybersecurity%20for%20Beginners-F97316?style=for-the-badge&labelColor=E5E7EB&color=F97316)](https://github.com/microsoft/Security-101?WT.mc_id=academic-96948-sayoung) [![Web Dev for Beginners](https://img.shields.io/badge/Web%20Dev%20for%20Beginners-EC4899?style=for-the-badge&labelColor=E5E7EB&color=EC4899)](https://aka.ms/webdev-beginners?WT.mc_id=academic-105485-koreyst) [![IoT for Beginners](https://img.shields.io/badge/IoT%20for%20Beginners-14B8A6?style=for-the-badge&labelColor=E5E7EB&color=14B8A6)](https://aka.ms/iot-beginners?WT.mc_id=academic-105485-koreyst) [![XR Development for Beginners](https://img.shields.io/badge/XR%20Development%20for%20Beginners-38BDF8?style=for-the-badge&labelColor=E5E7EB&color=38BDF8)](https://github.com/microsoft/xr-development-for-beginners?WT.mc_id=academic-105485-koreyst) --- ### Copilot Series [![Copilot for AI Paired Programming](https://img.shields.io/badge/Copilot%20for%20AI%20Paired%20Programming-FACC15?style=for-the-badge&labelColor=E5E7EB&color=FACC15)](https://aka.ms/GitHubCopilotAI?WT.mc_id=academic-105485-koreyst) [![Copilot for C#/.NET](https://img.shields.io/badge/Copilot%20for%20C%23/.NET-FBBF24?style=for-the-badge&labelColor=E5E7EB&color=FBBF24)](https://github.com/microsoft/mastering-github-copilot-for-dotnet-csharp-developers?WT.mc_id=academic-105485-koreyst) [![Copilot Adventure](https://img.shields.io/badge/Copilot%20Adventure-FDE68A?style=for-the-badge&labelColor=E5E7EB&color=FDE68A)](https://github.com/microsoft/CopilotAdventures?WT.mc_id=academic-105485-koreyst) <!-- CO-OP TRANSLATOR OTHER COURSES END --> ## Getting Help If you get stuck or have questions while learning Machine Learning or building AI applications, don't worry — help is available. You can join discussions with other learners and developers, ask questions, and share your ideas with the community. - Join the community to ask questions and learn with others - Discuss Machine Learning concepts and project ideas - Get guidance from experienced developers A supportive community is a great way to grow your skills and solve problems faster. [Microsoft Foundry Discord Community](https://discord.gg/nTYy5BXMWG) If you encounter bugs, errors, or have suggestions for improvements, you can also open an **Issue** in this repository to report the problem. For product feedback or to search existing community posts, visit the Developer Forum: [![Microsoft Foundry Developer Forum](https://img.shields.io/badge/GitHub-Microsoft_Foundry_Developer_Forum-blue?style=for-the-badge&logo=github&color=000000&logoColor=fff)](https://aka.ms/foundry/forum) ## Additional Learning Tips - Review notebooks after each lesson for better understanding. - Practice implementing algorithms on your own. - Explore real-world datasets using learned concepts.

Education & Learning ML Frameworks
86.5K Github Stars
AI-For-Beginners
Open Source

AI-For-Beginners

[![GitHub license](https://img.shields.io/github/license/microsoft/AI-For-Beginners.svg)](https://github.com/microsoft/AI-For-Beginners/blob/main/LICENSE) [![GitHub contributors](https://img.shields.io/github/contributors/microsoft/AI-For-Beginners.svg)](https://GitHub.com/microsoft/AI-For-Beginners/graphs/contributors/) [![GitHub issues](https://img.shields.io/github/issues/microsoft/AI-For-Beginners.svg)](https://GitHub.com/microsoft/AI-For-Beginners/issues/) [![GitHub pull-requests](https://img.shields.io/github/issues-pr/microsoft/AI-For-Beginners.svg)](https://GitHub.com/microsoft/AI-For-Beginners/pulls/) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![GitHub watchers](https://img.shields.io/github/watchers/microsoft/AI-For-Beginners.svg?style=social&label=Watch)](https://GitHub.com/microsoft/AI-For-Beginners/watchers/) [![GitHub forks](https://img.shields.io/github/forks/microsoft/AI-For-Beginners.svg?style=social&label=Fork)](https://GitHub.com/microsoft/AI-For-Beginners/network/) [![GitHub stars](https://img.shields.io/github/stars/microsoft/AI-For-Beginners.svg?style=social&label=Star)](https://GitHub.com/microsoft/AI-For-Beginners/stargazers/) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/microsoft/ai-for-beginners/HEAD) [![Gitter](https://badges.gitter.im/Microsoft/ai-for-beginners.svg)](https://gitter.im/Microsoft/ai-for-beginners?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Microsoft Foundry Discord](https://dcbadge.limes.pink/api/server/nTYy5BXMWG)](https://discord.gg/nTYy5BXMWG) # Artificial Intelligence for Beginners - A Curriculum |![Sketchnote by @girlie_mac https://twitter.com/girlie_mac](https://github.com/microsoft/AI-For-Beginners/raw/main/lessons/sketchnotes/ai-overview.png)| |:---:| | AI For Beginners - _Sketchnote by [@girlie_mac](https://twitter.com/girlie_mac)_ | Explore the world of **Artificial Intelligence** (AI) with our 12-week, 24-lesson curriculum! It includes practical lessons, quizzes, and labs. The curriculum is beginner-friendly and covers tools like TensorFlow and PyTorch, as well as ethics in AI ### 🌐 Multi-Language Support #### Supported via GitHub Action (Automated & Always Up-to-Date) <!-- CO-OP TRANSLATOR LANGUAGES TABLE START --> [Arabic](./translations/ar/README.md) | [Bengali](./translations/bn/README.md) | [Bulgarian](./translations/bg/README.md) | [Burmese (Myanmar)](./translations/my/README.md) | [Chinese (Simplified)](./translations/zh-CN/README.md) | [Chinese (Traditional, Hong Kong)](./translations/zh-HK/README.md) | [Chinese (Traditional, Macau)](./translations/zh-MO/README.md) | [Chinese (Traditional, Taiwan)](./translations/zh-TW/README.md) | [Croatian](./translations/hr/README.md) | [Czech](./translations/cs/README.md) | [Danish](./translations/da/README.md) | [Dutch](./translations/nl/README.md) | [Estonian](./translations/et/README.md) | [Finnish](./translations/fi/README.md) | [French](./translations/fr/README.md) | [German](./translations/de/README.md) | [Greek](./translations/el/README.md) | [Hebrew](./translations/he/README.md) | [Hindi](./translations/hi/README.md) | [Hungarian](./translations/hu/README.md) | [Indonesian](./translations/id/README.md) | [Italian](./translations/it/README.md) | [Japanese](./translations/ja/README.md) | [Kannada](./translations/kn/README.md) | [Khmer](./translations/km/README.md) | [Korean](./translations/ko/README.md) | [Lithuanian](./translations/lt/README.md) | [Malay](./translations/ms/README.md) | [Malayalam](./translations/ml/README.md) | [Marathi](./translations/mr/README.md) | [Nepali](./translations/ne/README.md) | [Nigerian Pidgin](./translations/pcm/README.md) | [Norwegian](./translations/no/README.md) | [Persian (Farsi)](./translations/fa/README.md) | [Polish](./translations/pl/README.md) | [Portuguese (Brazil)](./translations/pt-BR/README.md) | [Portuguese (Portugal)](./translations/pt-PT/README.md) | [Punjabi (Gurmukhi)](./translations/pa/README.md) | [Romanian](./translations/ro/README.md) | [Russian](./translations/ru/README.md) | [Serbian (Cyrillic)](./translations/sr/README.md) | [Slovak](./translations/sk/README.md) | [Slovenian](./translations/sl/README.md) | [Spanish](./translations/es/README.md) | [Swahili](./translations/sw/README.md) | [Swedish](./translations/sv/README.md) | [Tagalog (Filipino)](./translations/tl/README.md) | [Tamil](./translations/ta/README.md) | [Telugu](./translations/te/README.md) | [Thai](./translations/th/README.md) | [Turkish](./translations/tr/README.md) | [Ukrainian](./translations/uk/README.md) | [Urdu](./translations/ur/README.md) | [Vietnamese](./translations/vi/README.md) > **Prefer to Clone Locally?** > > This repository includes 50+ language translations which significantly increases the download size. To clone without translations, use sparse checkout: > > **Bash / macOS / Linux:** > ```bash > git clone --filter=blob:none --sparse https://github.com/microsoft/AI-For-Beginners.git > cd AI-For-Beginners > git sparse-checkout set --no-cone '/*' '!translations' '!translated_images' > ``` > > **CMD (Windows):** > ```cmd > git clone --filter=blob:none --sparse https://github.com/microsoft/AI-For-Beginners.git > cd AI-For-Beginners > git sparse-checkout set --no-cone "/*" "!translations" "!translated_images" > ``` > > This gives you everything you need to complete the course with a much faster download. <!-- CO-OP TRANSLATOR LANGUAGES TABLE END --> **If you wish to have additional translations languages supported are listed [here](https://github.com/Azure/co-op-translator/blob/main/getting_started/supported-languages.md)** ## Join the Community [![Microsoft Foundry Discord](https://dcbadge.limes.pink/api/server/nTYy5BXMWG)](https://discord.gg/nTYy5BXMWG) ## What you will learn **[Mindmap of the Course](http://soshnikov.com/courses/ai-for-beginners/mindmap.html)** In this curriculum, you will learn: * Different approaches to Artificial Intelligence, including the "good old" symbolic approach with **Knowledge Representation** and reasoning ([GOFAI](https://en.wikipedia.org/wiki/Symbolic_artificial_intelligence)). * **Neural Networks** and **Deep Learning**, which are at the core of modern AI. We will illustrate the concepts behind these important topics using code in two of the most popular frameworks - [TensorFlow](http://Tensorflow.org) and [PyTorch](http://pytorch.org). * **Neural Architectures** for working with images and text. We will cover recent models but may be a bit lacking in the state-of-the-art. * Less popular AI approaches, such as **Genetic Algorithms** and **Multi-Agent Systems**. What we will not cover in this curriculum: > [Find all additional resources for this course in our Microsoft Learn collection](https://learn.microsoft.com/en-us/collections/7w28iy2xrqzdj0?WT.mc_id=academic-77998-bethanycheum) * Business cases of using **AI in Business**. Consider taking [Introduction to AI for business users](https://docs.microsoft.com/learn/paths/introduction-ai-for-business-users/?WT.mc_id=academic-77998-bethanycheum) learning path on Microsoft Learn, or [AI Business School](https://www.microsoft.com/ai/ai-business-school/?WT.mc_id=academic-77998-bethanycheum), developed in cooperation with [INSEAD](https://www.insead.edu/). * **Classic Machine Learning**, which is well described in our [Machine Learning for Beginners Curriculum](http://github.com/Microsoft/ML-for-Beginners). * Practical AI applications built using **[Cognitive Services](https://azure.microsoft.com/services/cognitive-services/?WT.mc_id=academic-77998-bethanycheum)**. For this, we recommend that you start with modules Microsoft Learn for [vision](https://docs.microsoft.com/learn/paths/create-computer-vision-solutions-azure-cognitive-services/?WT.mc_id=academic-77998-bethanycheum), [natural language processing](https://docs.microsoft.com/learn/paths/explore-natural-language-processing/?WT.mc_id=academic-77998-bethanycheum), **[Generative AI with Azure OpenAI Service](https://learn.microsoft.com/en-us/training/paths/develop-ai-solutions-azure-openai/?WT.mc_id=academic-77998-bethanycheum)** and others. * Specific ML **Cloud Frameworks**, such as [Azure Machine Learning](https://azure.microsoft.com/services/machine-learning/?WT.mc_id=academic-77998-bethanycheum), [Microsoft Fabric](https://learn.microsoft.com/en-us/training/paths/get-started-fabric/?WT.mc_id=academic-77998-bethanycheum), or [Azure Databricks](https://docs.microsoft.com/learn/paths/data-engineer-azure-databricks?WT.mc_id=academic-77998-bethanycheum). Consider using [Build and operate machine learning solutions with Azure Machine Learning](https://docs.microsoft.com/learn/paths/build-ai-solutions-with-azure-ml-service/?WT.mc_id=academic-77998-bethanycheum) and [Build and Operate Machine Learning Solutions with Azure Databricks](https://docs.microsoft.com/learn/paths/build-operate-machine-learning-solutions-azure-databricks/?WT.mc_id=academic-77998-bethanycheum) learning paths. * **Conversational AI** and **Chat Bots**. There is a separate [Create conversational AI solutions](https://docs.microsoft.com/learn/paths/create-conversational-ai-solutions/?WT.mc_id=academic-77998-bethanycheum) learning path, and you can also refer to [this blog post](https://soshnikov.com/azure/hello-bot-conversational-ai-on-microsoft-platform/) for more detail. * **Deep Mathematics** behind deep learning. For this, we would recommend [Deep Learning](https://www.amazon.com/Deep-Learning-Adaptive-Computation-Machine/dp/0262035618) by Ian Goodfellow, Yoshua Bengio and Aaron Courville, which is also available online at [https://www.deeplearningbook.org/](https://www.deeplearningbook.org/). For a gentle introduction to _AI in the Cloud_ topics you may consider taking the [Get started with artificial intelligence on Azure](https://docs.microsoft.com/learn/paths/get-started-with-artificial-intelligence-on-azure/?WT.mc_id=academic-77998-bethanycheum) Learning Path. # Content | | Lesson Link | PyTorch/Keras/TensorFlow | Lab | | :-: | :------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------: | ------------------------------------------------------------------------------ | | 0 | [Course Setup](./lessons/0-course-setup/setup.md) | [Setup Your Development Environment](./lessons/0-course-setup/how-to-run.md) | | | I | [**Introduction to AI**](./lessons/1-Intro/README.md) | | | | 01 | [Introduction and History of AI](./lessons/1-Intro/README.md) | - | - | | II | **Symbolic AI** | | 02 | [Knowledge Representation and Expert Systems](./lessons/2-Symbolic/README.md) | [Expert Systems](./lessons/2-Symbolic/Animals.ipynb) / [Ontology](./lessons/2-Symbolic/FamilyOntology.ipynb) /[Concept Graph](./lessons/2-Symbolic/MSConceptGraph.ipynb) | | | III | [**Introduction to Neural Networks**](./lessons/3-NeuralNetworks/README.md) ||| | 03 | [Perceptron](./lessons/3-NeuralNetworks/03-Perceptron/README.md) | [Notebook](./lessons/3-NeuralNetworks/03-Perceptron/Perceptron.ipynb) | [Lab](./lessons/3-NeuralNetworks/03-Perceptron/lab/README.md) | | 04 | [Multi-Layered Perceptron and Creating our own Framework](./lessons/3-NeuralNetworks/04-OwnFramework/README.md) | [Notebook](./lessons/3-NeuralNetworks/04-OwnFramework/OwnFramework.ipynb) | [Lab](./lessons/3-NeuralNetworks/04-OwnFramework/lab/README.md) | | 05 | [Intro to Frameworks (PyTorch/TensorFlow) and Overfitting](./lessons/3-NeuralNetworks/05-Frameworks/README.md) | [PyTorch](./lessons/3-NeuralNetworks/05-Frameworks/IntroPyTorch.ipynb) / [Keras](./lessons/3-NeuralNetworks/05-Frameworks/IntroKeras.ipynb) / [TensorFlow](./lessons/3-NeuralNetworks/05-Frameworks/IntroKerasTF.ipynb) | [Lab](./lessons/3-NeuralNetworks/05-Frameworks/lab/README.md) | | IV | [**Computer Vision**](./lessons/4-ComputerVision/README.md) | [PyTorch](https://docs.microsoft.com/learn/modules/intro-computer-vision-pytorch/?WT.mc_id=academic-77998-cacaste) / [TensorFlow](https://docs.microsoft.com/learn/modules/intro-computer-vision-TensorFlow/?WT.mc_id=academic-77998-cacaste)| [Explore Computer Vision on Microsoft Azure](https://learn.microsoft.com/en-us/collections/7w28iy2xrqzdj0?WT.mc_id=academic-77998-bethanycheum) | | 06 | [Intro to Computer Vision. OpenCV](./lessons/4-ComputerVision/06-IntroCV/README.md) | [Notebook](./lessons/4-ComputerVision/06-IntroCV/OpenCV.ipynb) | [Lab](./lessons/4-ComputerVision/06-IntroCV/lab/README.md) | | 07 | [Convolutional Neural Networks](./lessons/4-ComputerVision/07-ConvNets/README.md) & [CNN Architectures](./lessons/4-ComputerVision/07-ConvNets/CNN_Architectures.md) | [PyTorch](./lessons/4-ComputerVision/07-ConvNets/ConvNetsPyTorch.ipynb) /[TensorFlow](./lessons/4-ComputerVision/07-ConvNets/ConvNetsTF.ipynb) | [Lab](./lessons/4-ComputerVision/07-ConvNets/lab/README.md) | | 08 | [Pre-trained Networks and Transfer Learning](./lessons/4-ComputerVision/08-TransferLearning/README.md) and [Training Tricks](./lessons/4-ComputerVision/08-TransferLearning/TrainingTricks.md) | [PyTorch](./lessons/4-ComputerVision/08-TransferLearning/TransferLearningPyTorch.ipynb) / [TensorFlow](./lessons/3-NeuralNetworks/05-Frameworks/IntroKerasTF.ipynb) | [Lab](./lessons/4-ComputerVision/08-TransferLearning/lab/README.md) | | 09 | [Autoencoders and VAEs](./lessons/4-ComputerVision/09-Autoencoders/README.md) | [PyTorch](./lessons/4-ComputerVision/09-Autoencoders/AutoEncodersPyTorch.ipynb) / [TensorFlow](./lessons/4-ComputerVision/09-Autoencoders/AutoencodersTF.ipynb) | | | 10 | [Generative Adversarial Networks & Artistic Style Transfer](./lessons/4-ComputerVision/10-GANs/README.md) | [PyTorch](./lessons/4-ComputerVision/10-GANs/GANPyTorch.ipynb) / [TensorFlow](./lessons/4-ComputerVision/10-GANs/GANTF.ipynb) | | | 11 | [Object Detection](./lessons/4-ComputerVision/11-ObjectDetection/README.md) | [TensorFlow](./lessons/4-ComputerVision/11-ObjectDetection/ObjectDetection.ipynb) | [Lab](./lessons/4-ComputerVision/11-ObjectDetection/lab/README.md) | | 12 | [Semantic Segmentation. U-Net](./lessons/4-ComputerVision/12-Segmentation/README.md) | [PyTorch](./lessons/4-ComputerVision/12-Segmentation/SemanticSegmentationPytorch.ipynb) / [TensorFlow](./lessons/4-ComputerVision/12-Segmentation/SemanticSegmentationTF.ipynb) | | | V | [**Natural Language Processing**](./lessons/5-NLP/README.md) | [PyTorch](https://docs.microsoft.com/learn/modules/intro-natural-language-processing-pytorch/?WT.mc_id=academic-77998-cacaste) /[TensorFlow](https://docs.microsoft.com/learn/modules/intro-natural-language-processing-TensorFlow/?WT.mc_id=academic-77998-cacaste) | [Explore Natural Language Processing on Microsoft Azure](https://learn.microsoft.com/en-us/collections/7w28iy2xrqzdj0?WT.mc_id=academic-77998-bethanycheum)| | 13 | [Text Representation. Bow/TF-IDF](./lessons/5-NLP/13-TextRep/README.md) | [PyTorch](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/13-TextRep/TextRepresentationPyTorch.ipynb) / [TensorFlow](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/13-TextRep/TextRepresentationTF.ipynb) | | | 14 | [Semantic word embeddings. Word2Vec and GloVe](./lessons/5-NLP/14-Embeddings/README.md) | [PyTorch](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/14-Embeddings/EmbeddingsPyTorch.ipynb) / [TensorFlow](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/14-Embeddings/EmbeddingsTF.ipynb) | | | 15 | [Language Modeling. Training your own embeddings](./lessons/5-NLP/15-LanguageModeling/README.md) | [PyTorch](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/15-LanguageModeling/CBoW-PyTorch.ipynb) / [TensorFlow](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/15-LanguageModeling/CBoW-TF.ipynb) | [Lab](./lessons/5-NLP/15-LanguageModeling/lab/README.md) | | 16 | [Recurrent Neural Networks](./lessons/5-NLP/16-RNN/README.md) | [PyTorch](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/16-RNN/RNNPyTorch.ipynb) / [TensorFlow](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/16-RNN/RNNTF.ipynb) | | | 17 | [Generative Recurrent Networks](./lessons/5-NLP/17-GenerativeNetworks/README.md) | [PyTorch](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/17-GenerativeNetworks/GenerativePyTorch.ipynb) / [TensorFlow](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/17-GenerativeNetworks/GenerativeTF.ipynb) | [Lab](./lessons/5-NLP/17-GenerativeNetworks/lab/README.md) | | 18 | [Transformers. BERT.](./lessons/5-NLP/18-Transformers/README.md) | [PyTorch](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/18-Transformers/TransformersPyTorch.ipynb) /[TensorFlow](https://github.com/microsoft/AI-For-Beginners/blob/main/lessons/5-NLP/18-Transformers/TransformersTF.ipynb) | | | 19 | [Named Entity Recognition](./lessons/5-NLP/19-NER/README.md) | [TensorFlow](https://microsoft.github.io/AI-For-Beginners/lessons/5-NLP/19-NER/NER-TF.ipynb) | [Lab](./lessons/5-NLP/19-NER/lab/README.md) | | 20 | [Large Language Models, Prompt Programming and Few-Shot Tasks](./lessons/5-NLP/20-LangModels/README.md) | [PyTorch](https://microsoft.github.io/AI-For-Beginners/lessons/5-NLP/20-LangModels/GPT-PyTorch.ipynb) | | | VI | **Other AI Techniques** || | | 21 | [Genetic Algorithms](./lessons/6-Other/21-GeneticAlgorithms/README.md) | [Notebook](./lessons/6-Other/21-GeneticAlgorithms/Genetic.ipynb) | | | 22 | [Deep Reinforcement Learning](./lessons/6-Other/22-DeepRL/README.md) | [PyTorch](./lessons/6-Other/22-DeepRL/CartPole-RL-PyTorch.ipynb) /[TensorFlow](./lessons/6-Other/22-DeepRL/CartPole-RL-TF.ipynb) | [Lab](./lessons/6-Other/22-DeepRL/lab/README.md) | | 23 | [Multi-Agent Systems](./lessons/6-Other/23-MultiagentSystems/README.md) | | | | VII | **AI Ethics** | | | | 24 | [AI Ethics and Responsible AI](./lessons/7-Ethics/README.md) | [Microsoft Learn: Responsible AI Principles](https://docs.microsoft.com/learn/paths/responsible-ai-business-principles/?WT.mc_id=academic-77998-cacaste) | | | IX | **Extras** | | | | 25 | [Multi-Modal Networks, CLIP and VQGAN](./lessons/X-Extras/X1-MultiModal/README.md) | [Notebook](./lessons/X-Extras/X1-MultiModal/Clip.ipynb) | | ## Each lesson contains * Pre-reading material * Executable Jupyter Notebooks, which are often specific to the framework (**PyTorch** or **TensorFlow**). The executable notebook also contains a lot of theoretical material, so to understand the topic you need to go through at least one version of the notebook (either PyTorch or TensorFlow). * **Labs** available for some topics, which give you an opportunity to try applying the material you have learned to a specific problem. * Some sections contain links to [**MS Learn**](https://learn.microsoft.com/en-us/collections/7w28iy2xrqzdj0?WT.mc_id=academic-77998-bethanycheum) modules that cover related topics. ## Getting Started ### 🎯 New to AI? Start Here! If you're completely new to AI and want quick, hands-on examples, check out our [**Beginner-Friendly Examples**](./examples/README.md)! These include: - 🌟 **Hello AI World** - Your first AI program (pattern recognition) - 🧠 **Simple Neural Network** - Build a neural network from scratch - 🖼️ **Image Classifier** - Classify images with detailed comments - 💬 **Text Sentiment** - Analyze positive/negative text These examples are designed to help you understand AI concepts before diving into the full curriculum. ### 📚 Full Curriculum Setup - We have created a [setup lesson](./lessons/0-course-setup/setup.md) to help you with setting up your development environment. - For Educators, we have created a [curricula setup lesson](./lessons/0-course-setup/for-teachers.md) for you too! - How to [Run the code in a VSCode or a Codespace](./lessons/0-course-setup/how-to-run.md) Follow these steps: Fork the Repository: Click on the "Fork" button at the top-right corner of this page. Clone the Repository: `git clone https://github.com/microsoft/AI-For-Beginners.git` Don't forget to star (🌟) this repo to find it easier later. ## Meet other Learners Join our [official AI Discord server](https://aka.ms/genai-discord?WT.mc_id=academic-105485-bethanycheum) to meet and network with other learners taking this course and get support. If you have product feedback or questions whilst building visit our [Azure AI Foundry Developer Forum](https://aka.ms/foundry/forum) ## Quizzes > **A note about quizzes**: All quizzes are contained in the Quiz-app folder in etc\quiz-app, or [Online Here](https://ff-quizzes.netlify.app/) They are linked from within the lessons the quiz app can be run locally or deployed to Azure; follow the instruction in the `quiz-app` folder. They are gradually being localized. ## Help Wanted Do you have suggestions or found spelling or code errors? Raise an issue or create a pull request. ## Special Thanks * **✍️ Primary Author:** [Dmitry Soshnikov](http://soshnikov.com), PhD * **🔥 Editor:** [Jen Looper](https://twitter.com/jenlooper), PhD * **🎨 Sketchnote illustrator:** [Tomomi Imura](https://twitter.com/girlie_mac) * **✅ Quiz Creator:** [Lateefah Bello](https://github.com/CinnamonXI), [MLSA](https://studentambassadors.microsoft.com/) * **🙏 Core Contributors:** [Evgenii Pishchik](https://github.com/Pe4enIks) ## Other Curricula Our team produces other curricula! Check out: <!-- CO-OP TRANSLATOR OTHER COURSES START --> ### LangChain [![LangChain4j for Beginners](https://img.shields.io/badge/LangChain4j%20for%20Beginners-22C55E?style=for-the-badge&&labelColor=E5E7EB&color=0553D6)](https://aka.ms/langchain4j-for-beginners) [![LangChain.js for Beginners](https://img.shields.io/badge/LangChain.js%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=0553D6)](https://aka.ms/langchainjs-for-beginners?WT.mc_id=m365-94501-dwahlin) [![LangChain for Beginners](https://img.shields.io/badge/LangChain%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=0553D6)](https://github.com/microsoft/langchain-for-beginners?WT.mc_id=m365-94501-dwahlin) --- ### Azure / Edge / MCP / Agents [![AZD for Beginners](https://img.shields.io/badge/AZD%20for%20Beginners-0078D4?style=for-the-badge&labelColor=E5E7EB&color=0078D4)](https://github.com/microsoft/AZD-for-beginners?WT.mc_id=academic-105485-koreyst) [![Edge AI for Beginners](https://img.shields.io/badge/Edge%20AI%20for%20Beginners-00B8E4?style=for-the-badge&labelColor=E5E7EB&color=00B8E4)](https://github.com/microsoft/edgeai-for-beginners?WT.mc_id=academic-105485-koreyst) [![MCP for Beginners](https://img.shields.io/badge/MCP%20for%20Beginners-009688?style=for-the-badge&labelColor=E5E7EB&color=009688)](https://github.com/microsoft/mcp-for-beginners?WT.mc_id=academic-105485-koreyst) [![AI Agents for Beginners](https://img.shields.io/badge/AI%20Agents%20for%20Beginners-00C49A?style=for-the-badge&labelColor=E5E7EB&color=00C49A)](https://github.com/microsoft/ai-agents-for-beginners?WT.mc_id=academic-105485-koreyst) --- ### Generative AI Series [![Generative AI for Beginners](https://img.shields.io/badge/Generative%20AI%20for%20Beginners-8B5CF6?style=for-the-badge&labelColor=E5E7EB&color=8B5CF6)](https://github.com/microsoft/generative-ai-for-beginners?WT.mc_id=academic-105485-koreyst) [![Generative AI (.NET)](https://img.shields.io/badge/Generative%20AI%20(.NET)-9333EA?style=for-the-badge&labelColor=E5E7EB&color=9333EA)](https://github.com/microsoft/Generative-AI-for-beginners-dotnet?WT.mc_id=academic-105485-koreyst) [![Generative AI (Java)](https://img.shields.io/badge/Generative%20AI%20(Java)-C084FC?style=for-the-badge&labelColor=E5E7EB&color=C084FC)](https://github.com/microsoft/generative-ai-for-beginners-java?WT.mc_id=academic-105485-koreyst) [![Generative AI (JavaScript)](https://img.shields.io/badge/Generative%20AI%20(JavaScript)-E879F9?style=for-the-badge&labelColor=E5E7EB&color=E879F9)](https://github.com/microsoft/generative-ai-with-javascript?WT.mc_id=academic-105485-koreyst) --- ### Core Learning [![ML for Beginners](https://img.shields.io/badge/ML%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=22C55E)](https://aka.ms/ml-beginners?WT.mc_id=academic-105485-koreyst) [![Data Science for Beginners](https://img.shields.io/badge/Data%20Science%20for%20Beginners-84CC16?style=for-the-badge&labelColor=E5E7EB&color=84CC16)](https://aka.ms/datascience-beginners?WT.mc_id=academic-105485-koreyst) [![AI for Beginners](https://img.shields.io/badge/AI%20for%20Beginners-A3E635?style=for-the-badge&labelColor=E5E7EB&color=A3E635)](https://aka.ms/ai-beginners?WT.mc_id=academic-105485-koreyst) [![Cybersecurity for Beginners](https://img.shields.io/badge/Cybersecurity%20for%20Beginners-F97316?style=for-the-badge&labelColor=E5E7EB&color=F97316)](https://github.com/microsoft/Security-101?WT.mc_id=academic-96948-sayoung) [![Web Dev for Beginners](https://img.shields.io/badge/Web%20Dev%20for%20Beginners-EC4899?style=for-the-badge&labelColor=E5E7EB&color=EC4899)](https://aka.ms/webdev-beginners?WT.mc_id=academic-105485-koreyst) [![IoT for Beginners](https://img.shields.io/badge/IoT%20for%20Beginners-14B8A6?style=for-the-badge&labelColor=E5E7EB&color=14B8A6)](https://aka.ms/iot-beginners?WT.mc_id=academic-105485-koreyst) [![XR Development for Beginners](https://img.shields.io/badge/XR%20Development%20for%20Beginners-38BDF8?style=for-the-badge&labelColor=E5E7EB&color=38BDF8)](https://github.com/microsoft/xr-development-for-beginners?WT.mc_id=academic-105485-koreyst) --- ### Copilot Series [![Copilot for AI Paired Programming](https://img.shields.io/badge/Copilot%20for%20AI%20Paired%20Programming-FACC15?style=for-the-badge&labelColor=E5E7EB&color=FACC15)](https://aka.ms/GitHubCopilotAI?WT.mc_id=academic-105485-koreyst) [![Copilot for C#/.NET](https://img.shields.io/badge/Copilot%20for%20C%23/.NET-FBBF24?style=for-the-badge&labelColor=E5E7EB&color=FBBF24)](https://github.com/microsoft/mastering-github-copilot-for-dotnet-csharp-developers?WT.mc_id=academic-105485-koreyst) [![Copilot Adventure](https://img.shields.io/badge/Copilot%20Adventure-FDE68A?style=for-the-badge&labelColor=E5E7EB&color=FDE68A)](https://github.com/microsoft/CopilotAdventures?WT.mc_id=academic-105485-koreyst) <!-- CO-OP TRANSLATOR OTHER COURSES END --> ## Getting Help If you get stuck or have any questions about building AI apps. Join fellow learners and experienced developers in discussions about MCP. It's a supportive community where questions are welcome and knowledge is shared freely. [![Microsoft Foundry Discord](https://dcbadge.limes.pink/api/server/nTYy5BXMWG)](https://discord.gg/nTYy5BXMWG) If you have product feedback or errors while building visit: [![Microsoft Foundry Developer Forum](https://img.shields.io/badge/GitHub-Microsoft_Foundry_Developer_Forum-blue?style=for-the-badge&logo=github&color=000000&logoColor=fff)](https://aka.ms/foundry/forum)

Education & Learning ML Frameworks
48K Github Stars
qlib
Open Source

qlib

[![Python Versions](https://img.shields.io/pypi/pyversions/pyqlib.svg?logo=python&logoColor=white)](https://pypi.org/project/pyqlib/#files) [![Platform](https://img.shields.io/badge/platform-linux%20%7C%20windows%20%7C%20macos-lightgrey)](https://pypi.org/project/pyqlib/#files) [![PypI Versions](https://img.shields.io/pypi/v/pyqlib)](https://pypi.org/project/pyqlib/#history) [![Upload Python Package](https://github.com/microsoft/qlib/workflows/Upload%20Python%20Package/badge.svg)](https://pypi.org/project/pyqlib/) [![Github Actions Test Status](https://github.com/microsoft/qlib/workflows/Test/badge.svg?branch=main)](https://github.com/microsoft/qlib/actions) [![Documentation Status](https://readthedocs.org/projects/qlib/badge/?version=latest)](https://qlib.readthedocs.io/en/latest/?badge=latest) [![License](https://img.shields.io/pypi/l/pyqlib)](LICENSE) [![Join the chat at https://gitter.im/Microsoft/qlib](https://badges.gitter.im/Microsoft/qlib.svg)](https://gitter.im/Microsoft/qlib?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ## :newspaper: **What's NEW!** &nbsp; :sparkling_heart: Recent released features ### Introducing <a href="https://github.com/microsoft/RD-Agent"><img src="docs/_static/img/rdagent_logo.png" alt="RD_Agent" style="height: 2em"></a>: LLM-Based Autonomous Evolving Agents for Industrial Data-Driven R&D We are excited to announce the release of **RD-Agent**📢, a powerful tool that supports automated factor mining and model optimization in quant investment R&D. RD-Agent is now available on [GitHub](https://github.com/microsoft/RD-Agent), and we welcome your star🌟! To learn more, please visit the [RD-Agent repository](https://github.com/microsoft/RD-Agent). We have prepared several public demo videos for you: | Scenario | Demo video (English) | Demo video (中文) | | -- | ------ | ------ | | Quant Factor Mining | [YouTube](https://www.youtube.com/watch?v=X4DK2QZKaKY&t=6s) | [YouTube](https://www.youtube.com/watch?v=X4DK2QZKaKY&t=6s) | | Quant Factor Mining from reports | [YouTube](https://www.youtube.com/watch?v=ECLTXVcSx-c) | [YouTube](https://www.youtube.com/watch?v=ECLTXVcSx-c) | | Quant Model Optimization | [YouTube](https://www.youtube.com/watch?v=dm0dWL49Bc0&t=104s) | [YouTube](https://www.youtube.com/watch?v=dm0dWL49Bc0&t=104s) | - 📃**Paper**: [R&D-Agent-Quant: A Multi-Agent Framework for Data-Centric Factors and Model Joint Optimization](https://arxiv.org/abs/2505.15155) - 👾**Code**: https://github.com/microsoft/RD-Agent/ ```BibTeX @misc{li2025rdagentquant, title={R\&D-Agent-Quant: A Multi-Agent Framework for Data-Centric Factors and Model Joint Optimization}, author={Yuante Li and Xu Yang and Xiao Yang and Minrui Xu and Xisen Wang and Weiqing Liu and Jiang Bian}, year={2025}, eprint={2505.15155}, archivePrefix={arXiv}, primaryClass={cs.AI} } ``` ![image](https://github.com/user-attachments/assets/3198bc10-47ba-4ee0-8a8e-46d5ce44f45d) *** | Feature | Status | | -- | ------ | | [R&D-Agent-Quant](https://arxiv.org/abs/2505.15155) Published | Apply R&D-Agent to Qlib for quant trading | | BPQP for End-to-end learning | 📈Coming soon!([Under review](https://github.com/microsoft/qlib/pull/1863)) | | 🔥LLM-driven Auto Quant Factory🔥 | 🚀 Released in [♾️RD-Agent](https://github.com/microsoft/RD-Agent) on Aug 8, 2024 | | KRNN and Sandwich models | :chart_with_upwards_trend: [Released](https://github.com/microsoft/qlib/pull/1414/) on May 26, 2023 | | Release Qlib v0.9.0 | :octocat: [Released](https://github.com/microsoft/qlib/releases/tag/v0.9.0) on Dec 9, 2022 | | RL Learning Framework | :hammer: :chart_with_upwards_trend: Released on Nov 10, 2022. [#1332](https://github.com/microsoft/qlib/pull/1332), [#1322](https://github.com/microsoft/qlib/pull/1322), [#1316](https://github.com/microsoft/qlib/pull/1316),[#1299](https://github.com/microsoft/qlib/pull/1299),[#1263](https://github.com/microsoft/qlib/pull/1263), [#1244](https://github.com/microsoft/qlib/pull/1244), [#1169](https://github.com/microsoft/qlib/pull/1169), [#1125](https://github.com/microsoft/qlib/pull/1125), [#1076](https://github.com/microsoft/qlib/pull/1076)| | HIST and IGMTF models | :chart_with_upwards_trend: [Released](https://github.com/microsoft/qlib/pull/1040) on Apr 10, 2022 | | Qlib [notebook tutorial](https://github.com/microsoft/qlib/tree/main/examples/tutorial) | 📖 [Released](https://github.com/microsoft/qlib/pull/1037) on Apr 7, 2022 | | Ibovespa index data | :rice: [Released](https://github.com/microsoft/qlib/pull/990) on Apr 6, 2022 | | Point-in-Time database | :hammer: [Released](https://github.com/microsoft/qlib/pull/343) on Mar 10, 2022 | | Arctic Provider Backend & Orderbook data example | :hammer: [Released](https://github.com/microsoft/qlib/pull/744) on Jan 17, 2022 | | Meta-Learning-based framework & DDG-DA | :chart_with_upwards_trend: :hammer: [Released](https://github.com/microsoft/qlib/pull/743) on Jan 10, 2022 | | Planning-based portfolio optimization | :hammer: [Released](https://github.com/microsoft/qlib/pull/754) on Dec 28, 2021 | | Release Qlib v0.8.0 | :octocat: [Released](https://github.com/microsoft/qlib/releases/tag/v0.8.0) on Dec 8, 2021 | | ADD model | :chart_with_upwards_trend: [Released](https://github.com/microsoft/qlib/pull/704) on Nov 22, 2021 | | ADARNN model | :chart_with_upwards_trend: [Released](https://github.com/microsoft/qlib/pull/689) on Nov 14, 2021 | | TCN model | :chart_with_upwards_trend: [Released](https://github.com/microsoft/qlib/pull/668) on Nov 4, 2021 | | Nested Decision Framework | :hammer: [Released](https://github.com/microsoft/qlib/pull/438) on Oct 1, 2021. [Example](https://github.com/microsoft/qlib/blob/main/examples/nested_decision_execution/workflow.py) and [Doc](https://qlib.readthedocs.io/en/latest/component/highfreq.html) | | Temporal Routing Adaptor (TRA) | :chart_with_upwards_trend: [Released](https://github.com/microsoft/qlib/pull/531) on July 30, 2021 | | Transformer & Localformer | :chart_with_upwards_trend: [Released](https://github.com/microsoft/qlib/pull/508) on July 22, 2021 | | Release Qlib v0.7.0 | :octocat: [Released](https://github.com/microsoft/qlib/releases/tag/v0.7.0) on July 12, 2021 | | TCTS Model | :chart_with_upwards_trend: [Released](https://github.com/microsoft/qlib/pull/491) on July 1, 2021 | | Online serving and automatic model rolling | :hammer: [Released](https://github.com/microsoft/qlib/pull/290) on May 17, 2021 | | DoubleEnsemble Model | :chart_with_upwards_trend: [Released](https://github.com/microsoft/qlib/pull/286) on Mar 2, 2021 | | High-frequency data processing example | :hammer: [Released](https://github.com/microsoft/qlib/pull/257) on Feb 5, 2021 | | High-frequency trading example | :chart_with_upwards_trend: [Part of code released](https://github.com/microsoft/qlib/pull/227) on Jan 28, 2021 | | High-frequency data(1min) | :rice: [Released](https://github.com/microsoft/qlib/pull/221) on Jan 27, 2021 | | Tabnet Model | :chart_with_upwards_trend: [Released](https://github.com/microsoft/qlib/pull/205) on Jan 22, 2021 | Features released before 2021 are not listed here. <p align="center"> <img src="docs/_static/img/logo/1.png" /> </p> Qlib is an open-source, AI-oriented quantitative investment platform that aims to realize the potential, empower research, and create value using AI technologies in quantitative investment, from exploring ideas to implementing productions. Qlib supports diverse machine learning modeling paradigms, including supervised learning, market dynamics modeling, and reinforcement learning. An increasing number of SOTA Quant research works/papers in diverse paradigms are being released in Qlib to collaboratively solve key challenges in quantitative investment. For example, 1) using supervised learning to mine the market's complex non-linear patterns from rich and heterogeneous financial data, 2) modeling the dynamic nature of the financial market using adaptive concept drift technology, and 3) using reinforcement learning to model continuous investment decisions and assist investors in optimizing their trading strategies. It contains the full ML pipeline of data processing, model training, back-testing; and covers the entire chain of quantitative investment: alpha seeking, risk modeling, portfolio optimization, and order execution. For more details, please refer to our paper ["Qlib: An AI-oriented Quantitative Investment Platform"](https://arxiv.org/abs/2009.11189). <table> <tbody> <tr> <th>Frameworks, Tutorial, Data & DevOps</th> <th>Main Challenges & Solutions in Quant Research</th> </tr> <tr> <td> <li><a href="#plans"><strong>Plans</strong></a></li> <li><a href="#framework-of-qlib">Framework of Qlib</a></li> <li><a href="#quick-start">Quick Start</a></li> <ul dir="auto"> <li type="circle"><a href="#installation">Installation</a> </li> <li type="circle"><a href="#data-preparation">Data Preparation</a></li> <li type="circle"><a href="#auto-quant-research-workflow">Auto Quant Research Workflow</a></li> <li type="circle"><a href="#building-customized-quant-research-workflow-by-code">Building Customized Quant Research Workflow by Code</a></li></ul> <li><a href="#quant-dataset-zoo"><strong>Quant Dataset Zoo</strong></a></li> <li><a href="#learning-framework">Learning Framework</a></li> <li><a href="#more-about-qlib">More About Qlib</a></li> <li><a href="#offline-mode-and-online-mode">Offline Mode and Online Mode</a> <ul> <li type="circle"><a href="#performance-of-qlib-data-server">Performance of Qlib Data Server</a></li></ul> <li><a href="#related-reports">Related Reports</a></li> <li><a href="#contact-us">Contact Us</a></li> <li><a href="#contributing">Contributing</a></li> </td> <td valign="baseline"> <li><a href="#main-challenges--solutions-in-quant-research">Main Challenges &amp; Solutions in Quant Research</a> <ul> <li type="circle"><a href="#forecasting-finding-valuable-signalspatterns">Forecasting: Finding Valuable Signals/Patterns</a> <ul> <li type="disc"><a href="#quant-model-paper-zoo"><strong>Quant Model (Paper) Zoo</strong></a> <ul> <li type="circle"><a href="#run-a-single-model">Run a Single Model</a></li> <li type="circle"><a href="#run-multiple-models">Run Multiple Models</a></li> </ul> </li> </ul> </li> <li type="circle"><a href="#adapting-to-market-dynamics">Adapting to Market Dynamics</a></li> <li type="circle"><a href="#reinforcement-learning-modeling-continuous-decisions">Reinforcement Learning: modeling continuous decisions</a></li> </ul> </li> </td> </tr> </tbody> </table> # Plans New features under development(order by estimated release time). Your feedbacks about the features are very important. <!-- | Feature | Status | --> <!-- | -- | ------ | --> # Framework of Qlib <div style="align: center"> <img src="docs/_static/img/framework-abstract.jpg" /> </div> The high-level framework of Qlib can be found above(users can find the [detailed framework](https://qlib.readthedocs.io/en/latest/introduction/introduction.html#framework) of Qlib's design when getting into nitty gritty). The components are designed as loose-coupled modules, and each component could be used stand-alone. Qlib provides a strong infrastructure to support Quant research. [Data](https://qlib.readthedocs.io/en/latest/component/data.html) is always an important part. A strong learning framework is designed to support diverse learning paradigms (e.g. [reinforcement learning](https://qlib.readthedocs.io/en/latest/component/rl.html), [supervised learning](https://qlib.readthedocs.io/en/latest/component/workflow.html#model-section)) and patterns at different levels(e.g. [market dynamic modeling](https://qlib.readthedocs.io/en/latest/component/meta.html)). By modeling the market, [trading strategies](https://qlib.readthedocs.io/en/latest/component/strategy.html) will generate trade decisions that will be executed. Multiple trading strategies and executors in different levels or granularities can be [nested to be optimized and run together](https://qlib.readthedocs.io/en/latest/component/highfreq.html). At last, a comprehensive [analysis](https://qlib.readthedocs.io/en/latest/component/report.html) will be provided and the model can be [served online](https://qlib.readthedocs.io/en/latest/component/online.html) in a low cost. # Quick Start This quick start guide tries to demonstrate 1. It's very easy to build a complete Quant research workflow and try your ideas with _Qlib_. 2. Though with *public data* and *simple models*, machine learning technologies **work very well** in practical Quant investment. Here is a quick **[demo](https://terminalizer.com/view/3f24561a4470)** shows how to install ``Qlib``, and run LightGBM with ``qrun``. **But**, please make sure you have already prepared the data following the [instruction](#data-preparation). ## Installation This table demonstrates the supported Python version of `Qlib`: | | install with pip | install from source | plot | | ------------- |:---------------------:|:--------------------:|:------------------:| | Python 3.8 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | Python 3.9 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | Python 3.10 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | Python 3.11 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | Python 3.12 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | **Note**: 1. **Conda** is suggested for managing your Python environment. In some cases, using Python outside of a `conda` environment may result in missing header files, causing the installation failure of certain packages. 2. Please pay attention that installing cython in Python 3.6 will raise some error when installing ``Qlib`` from source. If users use Python 3.6 on their machines, it is recommended to *upgrade* Python to version 3.8 or higher, or use `conda`'s Python to install ``Qlib`` from source. ### Install with pip Users can easily install ``Qlib`` by pip according to the following command. ```bash pip install pyqlib ``` **Note**: pip will install the latest stable qlib. However, the main branch of qlib is in active development. If you want to test the latest scripts or functions in the main branch. Please install qlib with the methods below. ### Install from source Also, users can install the latest dev version ``Qlib`` by the source code according to the following steps: * Before installing ``Qlib`` from source, users need to install some dependencies: ```bash pip install numpy pip install --upgrade cython ``` * Clone the repository and install ``Qlib`` as follows. ```bash git clone https://github.com/microsoft/qlib.git && cd qlib pip install . # `pip install -e .[dev]` is recommended for development. check details in docs/developer/code_standard_and_dev_guide.rst ``` **Tips**: If you fail to install `Qlib` or run the examples in your environment, comparing your steps and the [CI workflow](.github/workflows/test_qlib_from_source.yml) may help you find the problem. **Tips for Mac**: If you are using Mac with M1, you might encounter issues in building the wheel for LightGBM, which is due to missing dependencies from OpenMP. To solve the problem, install openmp first with ``brew install libomp`` and then run ``pip install .`` to build it successfully. ## Data Preparation ❗ Due to more restrict data security policy. The official dataset is disabled temporarily. You can try [this data source](https://github.com/chenditc/investment_data/releases) contributed by the community. Here is an example to download the latest data. ```bash wget https://github.com/chenditc/investment_data/releases/latest/download/qlib_bin.tar.gz mkdir -p ~/.qlib/qlib_data/cn_data tar -zxvf qlib_bin.tar.gz -C ~/.qlib/qlib_data/cn_data --strip-components=1 rm -f qlib_bin.tar.gz ``` The official dataset below will resume in short future. ---- Load and prepare data by running the following code: ### Get with module ```bash # get 1d data python -m qlib.cli.data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn # get 1min data python -m qlib.cli.data qlib_data --target_dir ~/.qlib/qlib_data/cn_data_1min --region cn --interval 1min ``` ### Get from source ```bash # get 1d data python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn # get 1min data python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data_1min --region cn --interval 1min ``` This dataset is created by public data collected by [crawler scripts](scripts/data_collector/), which have been released in the same repository. Users could create the same dataset with it. [Description of dataset](https://github.com/microsoft/qlib/tree/main/scripts/data_collector#description-of-dataset) *Please pay **ATTENTION** that the data is collected from [Yahoo Finance](https://finance.yahoo.com/lookup), and the data might not be perfect. We recommend users to prepare their own data if they have a high-quality dataset. For more information, users can refer to the [related document](https://qlib.readthedocs.io/en/latest/component/data.html#converting-csv-format-into-qlib-format)*. ### Automatic update of daily frequency data (from yahoo finance) > This step is *Optional* if users only want to try their models and strategies on history data. > > It is recommended that users update the data manually once (--trading_date 2021-05-25) and then set it to update automatically. > > **NOTE**: Users can't incrementally update data based on the offline data provided by Qlib(some fields are removed to reduce the data size). Users should use [yahoo collector](https://github.com/microsoft/qlib/tree/main/scripts/data_collector/yahoo#automatic-update-of-daily-frequency-datafrom-yahoo-finance) to download Yahoo data from scratch and then incrementally update it. > > For more information, please refer to: [yahoo collector](https://github.com/microsoft/qlib/tree/main/scripts/data_collector/yahoo#automatic-update-of-daily-frequency-datafrom-yahoo-finance) * Automatic update of data to the "qlib" directory each trading day(Linux) * use *crontab*: `crontab -e` * set up timed tasks: ``` * * * * 1-5 python <script path> update_data_to_bin --qlib_data_1d_dir <user data dir> ``` * **script path**: *scripts/data_collector/yahoo/collector.py* * Manual update of data ``` python scripts/data_collector/yahoo/collector.py update_data_to_bin --qlib_data_1d_dir <user data dir> --trading_date <start date> --end_date <end date> ``` * *trading_date*: start of trading day * *end_date*: end of trading day(not included) ### Checking the health of the data * We provide a script to check the health of the data, you can run the following commands to check whether the data is healthy or not. ``` python scripts/check_data_health.py check_data --qlib_dir ~/.qlib/qlib_data/cn_data ``` * Of course, you can also add some parameters to adjust the test results, such as this. ``` python scripts/check_data_health.py check_data --qlib_dir ~/.qlib/qlib_data/cn_data --missing_data_num 30055 --large_step_threshold_volume 94485 --large_step_threshold_price 20 ``` * If you want more information about `check_data_health`, please refer to the [documentation](https://qlib.readthedocs.io/en/latest/component/data.html#checking-the-health-of-the-data). <!-- - Run the initialization code and get stock data: ```python import qlib from qlib.data import D from qlib.constant import REG_CN # Initialization mount_path = "~/.qlib/qlib_data/cn_data" # target_dir qlib.init(mount_path=mount_path, region=REG_CN) # Get stock data by Qlib # Load trading calendar with the given time range and frequency print(D.calendar(start_time='2010-01-01', end_time='2017-12-31', freq='day')[:2]) # Parse a given market name into a stockpool config instruments = D.instruments('csi500') print(D.list_instruments(instruments=instruments, start_time='2010-01-01', end_time='2017-12-31', as_list=True)[:6]) # Load features of certain instruments in given time range instruments = ['SH600000'] fields = ['$close', '$volume', 'Ref($close, 1)', 'Mean($close, 3)', '$high-$low'] print(D.features(instruments, fields, start_time='2010-01-01', end_time='2017-12-31', freq='day').head()) ``` --> ## Docker images 1. Pulling a docker image from a docker hub repository ```bash docker pull pyqlib/qlib_image_stable:stable ``` 2. Start a new Docker container ```bash docker run -it --name <container name> -v <Mounted local directory>:/app pyqlib/qlib_image_stable:stable ``` 3. At this point you are in the docker environment and can run the qlib scripts. An example: ```bash >>> python scripts/get_data.py qlib_data --name qlib_data_simple --target_dir ~/.qlib/qlib_data/cn_data --interval 1d --region cn >>> python qlib/cli/run.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml ``` 4. Exit the container ```bash >>> exit ``` 5. Restart the container ```bash docker start -i -a <container name> ``` 6. Stop the container ```bash docker stop <container name> ``` 7. Delete the container ```bash docker rm <container name> ``` 8. If you want to know more information, please refer to the [documentation](https://qlib.readthedocs.io/en/latest/developer/how_to_build_image.html). ## Auto Quant Research Workflow Qlib provides a tool named `qrun` to run the whole workflow automatically (including building dataset, training models, backtest and evaluation). You can start an auto quant research workflow and have a graphical reports analysis according to the following steps: 1. Quant Research Workflow: Run `qrun` with lightgbm workflow config ([workflow_config_lightgbm_Alpha158.yaml](examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml) as following. ```bash cd examples # Avoid running program under the directory contains `qlib` qrun benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml ``` If users want to use `qrun` under debug mode, please use the following command: ```bash python -m pdb qlib/cli/run.py examples/benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml ``` The result of `qrun` is as follows, please refer to [docs](https://qlib.readthedocs.io/en/latest/component/strategy.html#result) for more explanations about the result. ```bash 'The following are analysis results of the excess return without cost.' risk mean 0.000708 std 0.005626 annualized_return 0.178316 information_ratio 1.996555 max_drawdown -0.081806 'The following are analysis results of the excess return with cost.' risk mean 0.000512 std 0.005626 annualized_return 0.128982 information_ratio 1.444287 max_drawdown -0.091078 ``` Here are detailed documents for `qrun` and [workflow](https://qlib.readthedocs.io/en/latest/component/workflow.html). 2. Graphical Reports Analysis: First, run `python -m pip install .[analysis]` to install the required dependencies. Then run `examples/workflow_by_code.ipynb` with `jupyter notebook` to get graphical reports. - Forecasting signal (model prediction) analysis - Cumulative Return of groups ![Cumulative Return](https://github.com/microsoft/qlib/blob/main/docs/_static/img/analysis/analysis_model_cumulative_return.png) - Return distribution ![long_short](https://github.com/microsoft/qlib/blob/main/docs/_static/img/analysis/analysis_model_long_short.png) - Information Coefficient (IC) ![Information Coefficient](https://github.com/microsoft/qlib/blob/main/docs/_static/img/analysis/analysis_model_IC.png) ![Monthly IC](https://github.com/microsoft/qlib/blob/main/docs/_static/img/analysis/analysis_model_monthly_IC.png) ![IC](https://github.com/microsoft/qlib/blob/main/docs/_static/img/analysis/analysis_model_NDQ.png) - Auto Correlation of forecasting signal (model prediction) ![Auto Correlation](https://github.com/microsoft/qlib/blob/main/docs/_static/img/analysis/analysis_model_auto_correlation.png) - Portfolio analysis - Backtest return ![Report](https://github.com/microsoft/qlib/blob/main/docs/_static/img/analysis/report.png) <!-- - Score IC ![Score IC](docs/_static/img/score_ic.png) - Cumulative Return ![Cumulative Return](docs/_static/img/cumulative_return.png) - Risk Analysis ![Risk Analysis](docs/_static/img/risk_analysis.png) - Rank Label ![Rank Label](docs/_static/img/rank_label.png) --> - [Explanation](https://qlib.readthedocs.io/en/latest/component/report.html) of above results ## Building Customized Quant Research Workflow by Code The automatic workflow may not suit the research workflow of all Quant researchers. To support a flexible Quant research workflow, Qlib also provides a modularized interface to allow researchers to build their own workflow by code. [Here](examples/workflow_by_code.ipynb) is a demo for customized Quant research workflow by code. # Main Challenges & Solutions in Quant Research Quant investment is a very unique scenario with lots of key challenges to be solved. Currently, Qlib provides some solutions for several of them. ## Forecasting: Finding Valuable Signals/Patterns Accurate forecasting of the stock price trend is a very important part to construct profitable portfolios. However, huge amount of data with various formats in the financial market which make it challenging to build forecasting models. An increasing number of SOTA Quant research works/papers, which focus on building forecasting models to mine valuable signals/patterns in complex financial data, are released in `Qlib` ### [Quant Model (Paper) Zoo](examples/benchmarks) Here is a list of models built on `Qlib`. - [GBDT based on XGBoost (Tianqi Chen, et al. KDD 2016)](examples/benchmarks/XGBoost/) - [GBDT based on LightGBM (Guolin Ke, et al. NIPS 2017)](examples/benchmarks/LightGBM/) - [GBDT based on Catboost (Liudmila Prokhorenkova, et al. NIPS 2018)](examples/benchmarks/CatBoost/) - [MLP based on pytorch](examples/benchmarks/MLP/) - [LSTM based on pytorch (Sepp Hochreiter, et al. Neural computation 1997)](examples/benchmarks/LSTM/) - [GRU based on pytorch (Kyunghyun Cho, et al. 2014)](examples/benchmarks/GRU/) - [ALSTM based on pytorch (Yao Qin, et al. IJCAI 2017)](examples/benchmarks/ALSTM) - [GATs based on pytorch (Petar Velickovic, et al. 2017)](examples/benchmarks/GATs/) - [SFM based on pytorch (Liheng Zhang, et al. KDD 2017)](examples/benchmarks/SFM/) - [TFT based on tensorflow (Bryan Lim, et al. International Journal of Forecasting 2019)](examples/benchmarks/TFT/) - [TabNet based on pytorch (Sercan O. Arik, et al. AAAI 2019)](examples/benchmarks/TabNet/) - [DoubleEnsemble based on LightGBM (Chuheng Zhang, et al. ICDM 2020)](examples/benchmarks/DoubleEnsemble/) - [TCTS based on pytorch (Xueqing Wu, et al. ICML 2021)](examples/benchmarks/TCTS/) - [Transformer based on pytorch (Ashish Vaswani, et al. NeurIPS 2017)](examples/benchmarks/Transformer/) - [Localformer based on pytorch (Juyong Jiang, et al.)](examples/benchmarks/Localformer/) - [TRA based on pytorch (Hengxu, Dong, et al. KDD 2021)](examples/benchmarks/TRA/) - [TCN based on pytorch (Shaojie Bai, et al. 2018)](examples/benchmarks/TCN/) - [ADARNN based on pytorch (YunTao Du, et al. 2021)](examples/benchmarks/ADARNN/) - [ADD based on pytorch (Hongshun Tang, et al.2020)](examples/benchmarks/ADD/) - [IGMTF based on pytorch (Wentao Xu, et al.2021)](examples/benchmarks/IGMTF/) - [HIST based on pytorch (Wentao Xu, et al.2021)](examples/benchmarks/HIST/) - [KRNN based on pytorch](examples/benchmarks/KRNN/) - [Sandwich based on pytorch](examples/benchmarks/Sandwich/) Your PR of new Quant models is highly welcomed. The performance of each model on the `Alpha158` and `Alpha360` datasets can be found [here](examples/benchmarks/README.md). ### Run a single model All the models listed above are runnable with ``Qlib``. Users can find the config files we provide and some details about the model through the [benchmarks](examples/benchmarks) folder. More information can be retrieved at the model files listed above. `Qlib` provides three different ways to run a single model, users can pick the one that fits their cases best: - Users can use the tool `qrun` mentioned above to run a model's workflow based from a config file. - Users can create a `workflow_by_code` python script based on the [one](examples/workflow_by_code.py) listed in the `examples` folder. - Users can use the script [`run_all_model.py`](examples/run_all_model.py) listed in the `examples` folder to run a model. Here is an example of the specific shell command to be used: `python run_all_model.py run --models=lightgbm`, where the `--models` arguments can take any number of models listed above(the available models can be found in [benchmarks](examples/benchmarks/)). For more use cases, please refer to the file's [docstrings](examples/run_all_model.py). - **NOTE**: Each baseline has different environment dependencies, please make sure that your python version aligns with the requirements(e.g. TFT only supports Python 3.6~3.7 due to the limitation of `tensorflow==1.15.0`) ### Run multiple models `Qlib` also provides a script [`run_all_model.py`](examples/run_all_model.py) which can run multiple models for several iterations. (**Note**: the script only support *Linux* for now. Other OS will be supported in the future. Besides, it doesn't support parallel running the same model for multiple times as well, and this will be fixed in the future development too.) The script will create a unique virtual environment for each model, and delete the environments after training. Thus, only experiment results such as `IC` and `backtest` results will be generated and stored. Here is an example of running all the models for 10 iterations: ```python python run_all_model.py run 10 ``` It also provides the API to run specific models at once. For more use cases, please refer to the file's [docstrings](examples/run_all_model.py). ### Break change In `pandas`, `group_key` is one of the parameters of the `groupby` method. From version 1.5 to 2.0 of `pandas`, the default value of `group_key` has been changed from `no default` to `True`, which will cause qlib to report an error during operation. So we set `group_key=False`, but it doesn't guarantee that some programmes will run correctly, including: * qlib\examples\rl_order_execution\scripts\gen_training_orders.py * qlib\examples\benchmarks\TRA\src\dataset.MTSDatasetH.py * qlib\examples\benchmarks\TFT\tft.py ## [Adapting to Market Dynamics](examples/benchmarks_dynamic) Due to the non-stationary nature of the environment of the financial market, the data distribution may change in different periods, which makes the performance of models build on training data decays in the future test data. So adapting the forecasting models/strategies to market dynamics is very important to the model/strategies' performance. Here is a list of solutions built on `Qlib`. - [Rolling Retraining](examples/benchmarks_dynamic/baseline/) - [DDG-DA on pytorch (Wendi, et al. AAAI 2022)](examples/benchmarks_dynamic/DDG-DA/) ## Reinforcement Learning: modeling continuous decisions Qlib now supports reinforcement learning, a feature designed to model continuous investment decisions. This functionality assists investors in optimizing their trading strategies by learning from interactions with the environment to maximize some notion of cumulative reward. Here is a list of solutions built on `Qlib` categorized by scenarios. ### [RL for order execution](examples/rl_order_execution) [Here](https://qlib.readthedocs.io/en/latest/component/rl/overall.html#order-execution) is the introduction of this scenario. All the methods below are compared [here](examples/rl_order_execution). - [TWAP](examples/rl_order_execution/exp_configs/backtest_twap.yml) - [PPO: "An End-to-End Optimal Trade Execution Framework based on Proximal Policy Optimization", IJCAL 2020](examples/rl_order_execution/exp_configs/backtest_ppo.yml) - [OPDS: "Universal Trading for Order Execution with Oracle Policy Distillation", AAAI 2021](examples/rl_order_execution/exp_configs/backtest_opds.yml) # Quant Dataset Zoo Dataset plays a very important role in Quant. Here is a list of the datasets built on `Qlib`: | Dataset | US Market | China Market | | -- | -- | -- | | [Alpha360](./qlib/contrib/data/handler.py) | √ | √ | | [Alpha158](./qlib/contrib/data/handler.py) | √ | √ | [Here](https://qlib.readthedocs.io/en/latest/advanced/alpha.html) is a tutorial to build dataset with `Qlib`. Your PR to build new Quant dataset is highly welcomed. # Learning Framework Qlib is high customizable and a lot of its components are learnable. The learnable components are instances of `Forecast Model` and `Trading Agent`. They are learned based on the `Learning Framework` layer and then applied to multiple scenarios in `Workflow` layer. The learning framework leverages the `Workflow` layer as well(e.g. sharing `Information Extractor`, creating environments based on `Execution Env`). Based on learning paradigms, they can be categorized into reinforcement learning and supervised learning. - For supervised learning, the detailed docs can be found [here](https://qlib.readthedocs.io/en/latest/component/model.html). - For reinforcement learning, the detailed docs can be found [here](https://qlib.readthedocs.io/en/latest/component/rl.html). Qlib's RL learning framework leverages `Execution Env` in `Workflow` layer to create environments. It's worth noting that `NestedExecutor` is supported as well. This empowers users to optimize different level of strategies/models/agents together (e.g. optimizing an order execution strategy for a specific portfolio management strategy). # More About Qlib If you want to have a quick glance at the most frequently used components of qlib, you can try notebooks [here](examples/tutorial/). The detailed documents are organized in [docs](docs/). [Sphinx](http://www.sphinx-doc.org) and the readthedocs theme is required to build the documentation in html formats. ```bash cd docs/ conda install sphinx sphinx_rtd_theme -y # Otherwise, you can install them with pip # pip install sphinx sphinx_rtd_theme make html ``` You can also view the [latest document](http://qlib.readthedocs.io/) online directly. Qlib is in active and continuing development. Our plan is in the roadmap, which is managed as a [github project](https://github.com/microsoft/qlib/projects/1). # Offline Mode and Online Mode The data server of Qlib can either deployed as `Offline` mode or `Online` mode. The default mode is offline mode. Under `Offline` mode, the data will be deployed locally. Under `Online` mode, the data will be deployed as a shared data service. The data and their cache will be shared by all the clients. The data retrieval performance is expected to be improved due to a higher rate of cache hits. It will consume less disk space, too. The documents of the online mode can be found in [Qlib-Server](https://qlib-server.readthedocs.io/). The online mode can be deployed automatically with [Azure CLI based scripts](https://qlib-server.readthedocs.io/en/latest/build.html#one-click-deployment-in-azure). The source code of online data server can be found in [Qlib-Server repository](https://github.com/microsoft/qlib-server). ## Performance of Qlib Data Server The performance of data processing is important to data-driven methods like AI technologies. As an AI-oriented platform, Qlib provides a solution for data storage and data processing. To demonstrate the performance of Qlib data server, we compare it with several other data storage solutions. We evaluate the performance of several storage solutions by finishing the same task, which creates a dataset (14 features/factors) from the basic OHLCV daily data of a stock market (800 stocks each day from 2007 to 2020). The task involves data queries and processing. | | HDF5 | MySQL | MongoDB | InfluxDB | Qlib -E -D | Qlib +E -D | Qlib +E +D | | -- | ------ | ------ | -------- | --------- | ----------- | ------------ | ----------- | | Total (1CPU) (seconds) | 184.4±3.7 | 365.3±7.5 | 253.6±6.7 | 368.2±3.6 | 147.0±8.8 | 47.6±1.0 | **7.4±0.3** | | Total (64CPU) (seconds) | | | | | 8.8±0.6 | **4.2±0.2** | | * `+(-)E` indicates with (out) `ExpressionCache` * `+(-)D` indicates with (out) `DatasetCache` Most general-purpose databases take too much time to load data. After looking into the underlying implementation, we find that data go through too many layers of interfaces and unnecessary format transformations in general-purpose database solutions. Such overheads greatly slow down the data loading process. Qlib data are stored in a compact format, which is efficient to be combined into arrays for scientific computation. # Related Reports - [Guide To Qlib: Microsoft’s AI Investment Platform](https://analyticsindiamag.com/qlib/) - [微软也搞AI量化平台?还是开源的!](https://mp.weixin.qq.com/s/47bP5YwxfTp2uTHjUBzJQQ) - [微矿Qlib:业内首个AI量化投资开源平台](https://mp.weixin.qq.com/s/vsJv7lsgjEi-ALYUz4CvtQ) # Contact Us - If you have any issues, please create issue [here](https://github.com/microsoft/qlib/issues/new/choose) or send messages in [gitter](https://gitter.im/Microsoft/qlib). - If you want to make contributions to `Qlib`, please [create pull requests](https://github.com/microsoft/qlib/compare). - For other reasons, you are welcome to contact us by email([[email protected]](mailto:[email protected])). - We are recruiting new members(both FTEs and interns), your resumes are welcome! Join IM discussion groups: |[Gitter](https://gitter.im/Microsoft/qlib)| |----| |![image](https://github.com/microsoft/qlib/blob/main/docs/_static/img/qrcode/gitter_qr.png)| # Contributing We appreciate all contributions and thank all the contributors! <a href="https://github.com/microsoft/qlib/graphs/contributors"><img src="https://contrib.rocks/image?repo=microsoft/qlib" /></a> Before we released Qlib as an open-source project on Github in Sep 2020, Qlib is an internal project in our group. Unfortunately, the internal commit history is not kept. A lot of members in our group have also contributed a lot to Qlib, which includes Ruihua Wang, Yinda Zhang, Haisu Yu, Shuyu Wang, Bochen Pang, and [Dong Zhou](https://github.com/evanzd/evanzd). Especially thanks to [Dong Zhou](https://github.com/evanzd/evanzd) due to his initial version of Qlib. ## Guidance This project welcomes contributions and suggestions. **Here are some [code standards and development guidance](docs/developer/code_standard_and_dev_guide.rst) for submiting a pull request.** Making contributions is not a hard thing. Solving an issue(maybe just answering a question raised in [issues list](https://github.com/microsoft/qlib/issues) or [gitter](https://gitter.im/Microsoft/qlib)), fixing/issuing a bug, improving the documents and even fixing a typo are important contributions to Qlib. For example, if you want to contribute to Qlib's document/code, you can follow the steps in the figure below. <p align="center"> <img src="https://github.com/demon143/qlib/blob/main/docs/_static/img/change%20doc.gif" /> </p> If you don't know how to start to contribute, you can refer to the following examples. | Type | Examples | | -- | -- | | Solving issues | [Answer a question](https://github.com/microsoft/qlib/issues/749); [issuing](https://github.com/microsoft/qlib/issues/765) or [fixing](https://github.com/microsoft/qlib/pull/792) a bug | | Docs | [Improve docs quality](https://github.com/microsoft/qlib/pull/797/files) ; [Fix a typo](https://github.com/microsoft/qlib/pull/774) | | Feature | Implement a [requested feature](https://github.com/microsoft/qlib/projects) like [this](https://github.com/microsoft/qlib/pull/754); [Refactor interfaces](https://github.com/microsoft/qlib/pull/539/files) | | Dataset | [Add a dataset](https://github.com/microsoft/qlib/pull/733) | | Models | [Implement a new model](https://github.com/microsoft/qlib/pull/689), [some instructions to contribute models](https://github.com/microsoft/qlib/tree/main/examples/benchmarks#contributing) | [Good first issues](https://github.com/microsoft/qlib/labels/good%20first%20issue) are labelled to indicate that they are easy to start your contributions. You can find some impefect implementation in Qlib by `rg 'TODO|FIXME' qlib` If you would like to become one of Qlib's maintainers to contribute more (e.g. help merge PR, triage issues), please contact us by email([[email protected]](mailto:[email protected])). We are glad to help to upgrade your permission. ## License 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 right 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.

ML Frameworks
44.2K Github Stars
onnxruntime
Open Source

onnxruntime

<p align="center"><img width="50%" src="docs/images/ONNX_Runtime_logo_dark.png" /></p> **ONNX Runtime is a cross-platform inference and training machine-learning accelerator**. **ONNX Runtime inference** can enable faster customer experiences and lower costs, supporting models from deep learning frameworks such as PyTorch and TensorFlow/Keras as well as classical machine learning libraries such as scikit-learn, LightGBM, XGBoost, etc. ONNX Runtime is compatible with different hardware, drivers, and operating systems, and provides optimal performance by leveraging hardware accelerators where applicable alongside graph optimizations and transforms. [Learn more &rarr;](https://www.onnxruntime.ai/docs/#onnx-runtime-for-inferencing) **ONNX Runtime training** can accelerate the model training time on multi-node NVIDIA GPUs for transformer models with a one-line addition for existing PyTorch training scripts. [Learn more &rarr;](https://www.onnxruntime.ai/docs/#onnx-runtime-for-training) ## Get Started & Resources * **General Information**: [onnxruntime.ai](https://onnxruntime.ai) * **Usage documentation and tutorials**: [onnxruntime.ai/docs](https://onnxruntime.ai/docs) * **YouTube video tutorials**: [youtube.com/@ONNXRuntime](https://www.youtube.com/@ONNXRuntime) * [**Upcoming Release Roadmap**](https://onnxruntime.ai/roadmap) * **Companion sample repositories**: - ONNX Runtime Inferencing: [microsoft/onnxruntime-inference-examples](https://github.com/microsoft/onnxruntime-inference-examples) - ONNX Runtime Training: [microsoft/onnxruntime-training-examples](https://github.com/microsoft/onnxruntime-training-examples) * **Plugin EP repositories**: - ONNX Runtime QNN Plugin EP: [onnxruntime/onnxruntime-qnn](https://github.com/onnxruntime/onnxruntime-qnn) ## Releases The current release and past releases can be found here: https://github.com/microsoft/onnxruntime/releases. For details on the upcoming release, including release dates, announcements, features, and guidance on submitting feature requests, please visit the release roadmap: https://onnxruntime.ai/roadmap. ## Data/Telemetry Windows distributions of this project may collect usage data and send it to Microsoft to help improve our products and services. See the [privacy statement](docs/Privacy.md) for more details. ## Contributions and Feedback We welcome contributions! Please see the [contribution guidelines](CONTRIBUTING.md). For feature requests or bug reports, please file a [GitHub Issue](https://github.com/Microsoft/onnxruntime/issues). For general discussion or questions, please use [GitHub Discussions](https://github.com/microsoft/onnxruntime/discussions). ## Code of Conduct 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. ## License This project is licensed under the [MIT License](LICENSE).

LLM Tools & Chat UIs
20.8K Github Stars
computervision-recipes
Open Source

computervision-recipes

<img src="scenarios/media/logo_cvbp.png" align="right" alt="" width="300"/> ```diff + Update July: Added support for action recognition and tracking + in the new release v1.2. ``` # Computer Vision In recent years, we've see an extra-ordinary growth in Computer Vision, with applications in face recognition, image understanding, search, drones, mapping, semi-autonomous and autonomous vehicles. A key part to many of these applications are visual recognition tasks such as image classification, object detection and image similarity. This repository provides examples and best practice guidelines for building computer vision systems. The goal of this repository is to build a comprehensive set of tools and examples that leverage recent advances in Computer Vision algorithms, neural architectures, and operationalizing such systems. Rather than creating implementations from scratch, we draw from existing state-of-the-art libraries and build additional utility around loading image data, optimizing and evaluating models, and scaling up to the cloud. In addition, having worked in this space for many years, we aim to answer common questions, point out frequently observed pitfalls, and show how to use the cloud for training and deployment. We hope that these examples and utilities can significantly reduce the “time to market” by simplifying the experience from defining the business problem to development of solution by orders of magnitude. In addition, the example notebooks would serve as guidelines and showcase best practices and usage of the tools in a wide variety of languages. These examples are provided as [Jupyter notebooks](scenarios) and common [utility functions](utils_cv). All examples use PyTorch as the underlying deep learning library. ## Examples This repository supports various Computer Vision scenarios which either operate on a single image: <p align="center"> <img src="./scenarios/media/cv_overview.jpg" height="350" alt="Some supported CV scenarios"/> </p> As well as scenarios such as action recognition which take a video sequence as input: <p align="center"> <img src=/scenarios/action_recognition/media/action_recognition2.gif "Example of action recognition"/> </p> ## Target Audience Our target audience for this repository includes data scientists and machine learning engineers with varying levels of Computer Vision knowledge as our content is source-only and targets custom machine learning modelling. The utilities and examples provided are intended to be solution accelerators for real-world vision problems. ## Getting Started To get started, navigate to the [Setup Guide](SETUP.md), which lists instructions on how to setup the compute environment and dependencies needed to run the notebooks in this repo. Once your environment is setup, navigate to the [Scenarios](scenarios) folder and start exploring the notebooks. We recommend to start with the *image classification* notebooks, since this introduces concepts which are also used by the other scenarios (e.g. pre-training on ImageNet). Alternatively, we support Binder [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/PatrickBue/computervision-recipes/master?filepath=scenarios%2Fclassification%2F01_training_introduction_BINDER.ipynb) which makes it easy to try one of our notebooks in a web-browser simply by following this link. However, Binder is free, and as a result only comes with limited CPU compute power and without GPU support. Expect the notebook to run very slowly (this is somewhat improved by reducing image resolution to e.g. 60 pixels but at the cost of low accuracies). ## Scenarios The following is a summary of commonly used Computer Vision scenarios that are covered in this repository. For each of the main scenarios ("base"), we provide the tools to effectively build your own model. This includes simple tasks such as fine-tuning your own model on your own data, to more complex tasks such as hard-negative mining and even model deployment. | Scenario | Support | Description | | -------- | ----------- | ----------- | | [Classification](scenarios/classification) | Base | Image Classification is a supervised machine learning technique to learn and predict the category of a given image. | | [Similarity](scenarios/similarity) | Base | Image Similarity is a way to compute a similarity score given a pair of images. Given an image, it allows you to identify the most similar image in a given dataset. | | [Detection](scenarios/detection) | Base | Object Detection is a technique that allows you to detect the bounding box of an object within an image. | | [Keypoints](scenarios/keypoints) | Base | Keypoint detection can be used to detect specific points on an object. A pre-trained model is provided to detect body joints for human pose estimation. | | [Segmentation](scenarios/segmentation) | Base | Image Segmentation assigns a category to each pixel in an image. | | [Action recognition](scenarios/action_recognition) | Base | Action recognition to identify in video/webcam footage what actions are performed (e.g. "running", "opening a bottle") and at what respective start/end times. We also implemented the i3d implementation of action recognition that can be found under (contrib)[contrib]. | | [Tracking](scenarios/tracking) | Base | Tracking allows to detect and track multiple objects in a video sequence over time. | | [Crowd counting](contrib/crowd_counting) | Contrib | Counting the number of people in low-crowd-density (e.g. less than 10 people) and high-crowd-density (e.g. thousands of people) scenarios.| We separate the supported CV scenarios into two locations: (i) **base**: code and notebooks within the "utils_cv" and "scenarios" folders which follow strict coding guidelines, are well tested and maintained; (ii) **contrib**: code and other assets within the "contrib" folder, mainly covering less common CV scenarios using bleeding edge state-of-the-art approaches. Code in "contrib" is not regularly tested or maintained. ## Computer Vision on Azure Note that for certain computer vision problems, you may not need to build your own models. Instead, pre-built or easily customizable solutions exist on Azure which do not require any custom coding or machine learning expertise. We strongly recommend evaluating if these can sufficiently solve your problem. If these solutions are not applicable, or the accuracy of these solutions is not sufficient, then resorting to more complex and time-consuming custom approaches may be necessary. The following Microsoft services offer simple solutions to address common computer vision tasks: - [Vision Services](https://docs.microsoft.com/en-us/azure/cognitive-services/computer-vision/) are a set of pre-trained REST APIs which can be called for image tagging, face recognition, OCR, video analytics, and more. These APIs work out of the box and require minimal expertise in machine learning, but have limited customization capabilities. See the various demos available to get a feel for the functionality (e.g. [Computer Vision](https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/#analyze)). The service can be used through API calls or through SDKs (available in .NET, Python, Java, Node and Go languages) - [Custom Vision](https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/home) is a SaaS service to train and deploy a model as a REST API given a user-provided training set. All steps including image upload, annotation, and model deployment can be performed using an intuitive UI or through SDKs (available in .NEt, Python, Java, Node and Go languages). Training image classification or object detection models can be achieved with minimal machine learning expertise. The Custom Vision offers more flexibility than using the pre-trained cognitive services APIs, but requires the user to bring and annotate their own data. If you need to train your own model, the following services and links provide additional information that is likely useful. - [Azure Machine Learning service (AzureML)](https://docs.microsoft.com/azure/machine-learning/?WT.mc_id=computervision-github-azureai) is a service that helps users accelerate the training and deploying of machine learning models. While not specific for computer vision workloads, the AzureML Python SDK can be used for scalable and reliable training and deployment of machine learning solutions to the cloud. We leverage Azure Machine Learning in several of the notebooks within this repository (e.g. [deployment to Azure Kubernetes Service](https://github.com/microsoft/computervision-recipes/blob/master/scenarios/classification/22_deployment_on_azure_kubernetes_service.ipynb)) - [Azure AI Reference architectures](https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/ai/training-python-models/?WT.mc_id=computervision-github-azureai) provide a set of examples (backed by code) of how to build common AI-oriented workloads that leverage multiple cloud components. While not computer vision specific, these reference architectures cover several machine learning workloads such as model deployment or batch scoring. ## Build Status ### AzureML Testing | Build Type | Branch | Status | | Branch | Status | | --- | --- | --- | --- | --- | --- | | **Linux GPU** | master | [![Build Status](https://dev.azure.com/best-practices/computervision/_apis/build/status/AzureML/AML-unit-test-linux-gpu?branchName=master)](https://dev.azure.com/best-practices/computervision/_build/latest?definitionId=41&branchName=master) | | staging | [![Build Status](https://dev.azure.com/best-practices/computervision/_apis/build/status/AzureML/AML-unit-test-linux-gpu?branchName=staging)](https://dev.azure.com/best-practices/computervision/_build/latest?definitionId=41&branchName=staging) | | **Linux CPU** | master | [![Build Status](https://dev.azure.com/best-practices/computervision/_apis/build/status/AzureML/AML-unit-test-linux-cpu?branchName=master)](https://dev.azure.com/best-practices/computervision/_build/latest?definitionId=37&branchName=master) | | staging | [![Build Status](https://dev.azure.com/best-practices/computervision/_apis/build/status/AzureML/AML-unit-test-linux-cpu?branchName=staging)](https://dev.azure.com/best-practices/computervision/_build/latest?definitionId=37&branchName=staging) | | **Notebook unit GPU** | master | [![Build Status](https://dev.azure.com/best-practices/computervision/_apis/build/status/AzureML/AML-unit-test-linux-nb-gpu?branchName=master)](https://dev.azure.com/best-practices/computervision/_build/latest?definitionId=42&branchName=master) | | staging | [![Build Status](https://dev.azure.com/best-practices/computervision/_apis/build/status/AzureML/AML-unit-test-linux-nb-gpu?branchName=staging)](https://dev.azure.com/best-practices/computervision/_build/latest?definitionId=42&branchName=staging) | ## Contributing This project welcomes contributions and suggestions. Please see our [contribution guidelines](CONTRIBUTING.md).

ML Frameworks
9.9K Github Stars
SynapseML
Open Source

SynapseML

![SynapseML](https://mmlspark.azureedge.net/icons/mmlspark.svg) # Synapse Machine Learning SynapseML (previously known as MMLSpark), is an open-source library that simplifies the creation of massively scalable machine learning (ML) pipelines. SynapseML provides simple, composable, and distributed APIs for a wide variety of different machine learning tasks such as text analytics, vision, anomaly detection, and many others. SynapseML is built on the [Apache Spark distributed computing framework](https://spark.apache.org/) and shares the same API as the [SparkML/MLLib library](https://spark.apache.org/mllib/), allowing you to seamlessly embed SynapseML models into existing Apache Spark workflows. With SynapseML, you can build scalable and intelligent systems to solve challenges in domains such as anomaly detection, computer vision, deep learning, text analytics, and others. SynapseML can train and evaluate models on single-node, multi-node, and elastically resizable clusters of computers. This lets you scale your work without wasting resources. SynapseML is usable across Python, R, Scala, Java, and .NET. Furthermore, its API abstracts over a wide variety of databases, file systems, and cloud data stores to simplify experiments no matter where data is located. SynapseML requires Scala 2.12, Spark 3.4+, and Python 3.8+. | Topics | Links | | :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Build | [![Build Status](https://msdata.visualstudio.com/A365/_apis/build/status/microsoft.SynapseML?branchName=master)](https://msdata.visualstudio.com/A365/_build/latest?definitionId=17563&branchName=master) [![codecov](https://codecov.io/gh/Microsoft/SynapseML/branch/master/graph/badge.svg)](https://codecov.io/gh/Microsoft/SynapseML) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) | | Version | [![Version](https://img.shields.io/badge/version-1.1.3-blue)](https://github.com/Microsoft/SynapseML/releases) [![Release Notes](https://img.shields.io/badge/release-notes-blue)](https://github.com/Microsoft/SynapseML/releases) [![Snapshot Version](https://mmlspark.blob.core.windows.net/icons/badges/master_version3.svg)](#sbt) | | Docs | [![Website](https://img.shields.io/badge/SynapseML-Website-blue)](https://aka.ms/spark) [![Scala Docs](https://img.shields.io/static/v1?label=api%20docs&message=scala&color=blue&logo=scala)](https://mmlspark.blob.core.windows.net/docs/1.1.3/scala/index.html#package) [![PySpark Docs](https://img.shields.io/static/v1?label=api%20docs&message=python&color=blue&logo=python)](https://mmlspark.blob.core.windows.net/docs/1.1.3/pyspark/index.html) [![Academic Paper](https://img.shields.io/badge/academic-paper-7fdcf7)](https://arxiv.org/abs/1810.08744) | | Support | [![Gitter](https://badges.gitter.im/Microsoft/MMLSpark.svg)](https://gitter.im/Microsoft/MMLSpark?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Mail](https://img.shields.io/badge/mail-synapseml--support-brightgreen)](mailto:[email protected]) | | Binder | [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/microsoft/SynapseML/v1.1.3?labpath=notebooks%2Ffeatures) | | Usage | [![Downloads](https://static.pepy.tech/badge/synapseml)](https://pepy.tech/project/synapseml) | <!-- markdownlint-disable MD033 --> <details open> <summary> <strong><em>Table of Contents</em></strong> </summary> - [Synapse Machine Learning](#synapse-machine-learning) - [Features](#features) - [Documentation and Examples](#documentation-and-examples) - [Setup and installation](#setup-and-installation) - [Microsoft Fabric](#microsoft-fabric) - [Synapse Analytics](#synapse-analytics) - [Databricks](#databricks) - [Python Standalone](#python-standalone) - [Spark Submit](#spark-submit) - [SBT](#sbt) - [Apache Livy and HDInsight](#apache-livy-and-hdinsight) - [Docker](#docker) - [R](#r) - [Building from source](#building-from-source) - [Papers](#papers) - [Learn More](#learn-more) - [Contributing \& feedback](#contributing--feedback) - [Other relevant projects](#other-relevant-projects) </details> <!-- markdownlint-enable MD033 --> ## Features <!-- markdownlint-disable MD033 --> | <img width="800" src="https://mmlspark.blob.core.windows.net/graphics/Readme/vw-blue-dark-orange.svg"> | <img width="800" src="https://mmlspark.blob.core.windows.net/graphics/Readme/cog_services_on_spark_2.svg"> | <img width="800" src="https://mmlspark.blob.core.windows.net/graphics/Readme/decision_tree_recolor.png"> | <img width="800" src="https://mmlspark.blob.core.windows.net/graphics/Readme/mmlspark_serving_recolor.svg"> | | :----------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | | [**Vowpal Wabbit on Spark**](https://microsoft.github.io/SynapseML/docs/Explore%20Algorithms/Vowpal%20Wabbit/Overview/) | [**The Cognitive Services for Big Data**](https://microsoft.github.io/SynapseML/docs/Explore%20Algorithms/AI%20Services/Overview/) | [**LightGBM on Spark**](https://microsoft.github.io/SynapseML/docs/Explore%20Algorithms/LightGBM/Overview/) | [**Spark Serving**](https://microsoft.github.io/SynapseML/docs/Deploy%20Models/Overview/) | | Fast, Sparse, and Effective Text Analytics | Leverage the Microsoft Cognitive Services at Unprecedented Scales in your existing SparkML pipelines | Train Gradient Boosted Machines with LightGBM | Serve any Spark Computation as a Web Service with Sub-Millisecond Latency | | <img width="800" src="https://mmlspark.blob.core.windows.net/graphics/Readme/microservice_recolor.png"> | <img width="800" src="https://mmlspark.blob.core.windows.net/graphics/emails/onnxai-ar21_crop.svg"> | <img width="800" src="https://mmlspark.blob.core.windows.net/graphics/emails/scales.svg"> | <img width="800" src="https://mmlspark.blob.core.windows.net/graphics/Readme/bindings.png"> | | :----------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------: |:-----------------------------------------------------------------------------------------------------------------------:| | [**HTTP on Spark**](https://microsoft.github.io/SynapseML/docs/Explore%20Algorithms/AI%20Services/Overview/#arbitrary-web-apis) | [**ONNX on Spark**](https://microsoft.github.io/SynapseML/docs/Explore%20Algorithms/Deep%20Learning/ONNX/) | [**Responsible AI**](https://microsoft.github.io/SynapseML/docs/Explore%20Algorithms/Responsible%20AI/Interpreting%20Model%20Predictions/) | [**Spark Binding Autogeneration**](https://microsoft.github.io/SynapseML/docs/Reference/Developer%20Setup/#packagepython) | | An Integration Between Spark and the HTTP Protocol, enabling Distributed Microservice Orchestration | Distributed and Hardware Accelerated Model Inference on Spark | Understand Opaque-box Models and Measure Dataset Biases | Automatically Generate Spark bindings for PySpark and SparklyR | | <img width="150" src="https://mmlspark.blob.core.windows.net/graphics/emails/isolation forest 3.svg"> | <img width="150" src="https://mmlspark.blob.core.windows.net/graphics/emails/cyberml.svg"> | <img width="150" src="https://mmlspark.blob.core.windows.net/graphics/emails/conditional_knn.svg"> | | :-----------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------: | | [**Isolation Forest on Spark**](https://microsoft.github.io/SynapseML/docs/Explore%20Algorithms/Anomaly%20Detection/Quickstart%20-%20Isolation%20Forests/) | [**CyberML**](https://microsoft.github.io/SynapseML/docs/Explore%20Algorithms/Other%20Algorithms/Cyber%20ML/) | [**Conditional KNN**](https://microsoft.github.io/SynapseML/docs/Explore%20Algorithms/Other%20Algorithms/Quickstart%20-%20Exploring%20Art%20Across%20Cultures/) | | Distributed Nonlinear Outlier Detection | Machine Learning Tools for Cyber Security | Scalable KNN Models with Conditional Queries | <!-- markdownlint-enable MD033 --> ## Documentation and Examples For quickstarts, documentation, demos, and examples please see our [website](https://aka.ms/spark). ## Setup and installation First select the correct platform that you are installing SynapseML into: <!--ts--> - [Synapse Machine Learning](#synapse-machine-learning) - [Features](#features) - [Documentation and Examples](#documentation-and-examples) - [Setup and installation](#setup-and-installation) - [Microsoft Fabric](#microsoft-fabric) - [Synapse Analytics](#synapse-analytics) - [Databricks](#databricks) - [Python Standalone](#python-standalone) - [Spark Submit](#spark-submit) - [SBT](#sbt) - [Apache Livy and HDInsight](#apache-livy-and-hdinsight) - [Docker](#docker) - [R](#r) - [Building from source](#building-from-source) - [Papers](#papers) - [Learn More](#learn-more) - [Contributing \& feedback](#contributing--feedback) - [Other relevant projects](#other-relevant-projects) <!--te--> ### Microsoft Fabric In Microsoft Fabric notebooks SynapseML is already installed. To change the version please place the following in the first cell of your notebook. ```bash %%configure -f { "name": "synapseml", "conf": { "spark.jars.packages": "com.microsoft.azure:synapseml_2.12:<THE_SYNAPSEML_VERSION_YOU_WANT>", "spark.jars.repositories": "https://mmlspark.azureedge.net/maven", "spark.jars.excludes": "org.scala-lang:scala-reflect,org.apache.spark:spark-tags_2.12,org.scalactic:scalactic_2.12,org.scalatest:scalatest_2.12,com.fasterxml.jackson.core:jackson-databind", "spark.yarn.user.classpath.first": "true", "spark.sql.parquet.enableVectorizedReader": "false" } } ``` ### Synapse Analytics In Azure Synapse notebooks please place the following in the first cell of your notebook. - For Spark 3.5 Pools: ```bash %%configure -f { "name": "synapseml", "conf": { "spark.jars.packages": "com.microsoft.azure:synapseml_2.12:1.1.3", "spark.jars.repositories": "https://mmlspark.azureedge.net/maven", "spark.jars.excludes": "org.scala-lang:scala-reflect,org.apache.spark:spark-tags_2.12,org.scalactic:scalactic_2.12,org.scalatest:scalatest_2.12,com.fasterxml.jackson.core:jackson-databind", "spark.yarn.user.classpath.first": "true", "spark.sql.parquet.enableVectorizedReader": "false" } } ``` - For Spark 3.4 Pools: ```bash %%configure -f { "name": "synapseml", "conf": { "spark.jars.packages": "com.microsoft.azure:synapseml_2.12:1.0.15", "spark.jars.repositories": "https://mmlspark.azureedge.net/maven", "spark.jars.excludes": "org.scala-lang:scala-reflect,org.apache.spark:spark-tags_2.12,org.scalactic:scalactic_2.12,org.scalatest:scalatest_2.12,com.fasterxml.jackson.core:jackson-databind", "spark.yarn.user.classpath.first": "true", "spark.sql.parquet.enableVectorizedReader": "false" } } ``` - For Spark 3.3 Pools: ```bash %%configure -f { "name": "synapseml", "conf": { "spark.jars.packages": "com.microsoft.azure:synapseml_2.12:0.11.4-spark3.3", "spark.jars.repositories": "https://mmlspark.azureedge.net/maven", "spark.jars.excludes": "org.scala-lang:scala-reflect,org.apache.spark:spark-tags_2.12,org.scalactic:scalactic_2.12,org.scalatest:scalatest_2.12,com.fasterxml.jackson.core:jackson-databind", "spark.yarn.user.classpath.first": "true", "spark.sql.parquet.enableVectorizedReader": "false" } } ``` To install at the pool level instead of the notebook level [add the spark properties listed above to the pool configuration](https://techcommunity.microsoft.com/t5/azure-synapse-analytics-blog/how-to-set-spark-pyspark-custom-configs-in-synapse-workspace/ba-p/2114434). ### Databricks To install SynapseML on the [Databricks cloud](http://community.cloud.databricks.com), create a new [library from Maven coordinates](https://docs.databricks.com/user-guide/libraries.html#libraries-from-maven-pypi-or-spark-packages) in your workspace. For the coordinates use: `com.microsoft.azure:synapseml_2.12:1.1.3` with the resolver: `https://mmlspark.azureedge.net/maven`. Ensure this library is attached to your target cluster(s). Finally, ensure that your Spark cluster has at least Spark 3.2 and Scala 2.12. If you encounter Netty dependency issues please use DBR 10.1. You can use SynapseML in both your Scala and PySpark notebooks. To get started with our example notebooks import the following databricks archive: `https://mmlspark.blob.core.windows.net/dbcs/SynapseMLExamplesv1.1.3.dbc` ### Python Standalone To try out SynapseML on a Python (or Conda) installation you can get Spark installed via pip with `pip install pyspark`. You can then use `pyspark` as in the above example, or from python: ```python import pyspark spark = pyspark.sql.SparkSession.builder.appName("MyApp") \ .config("spark.jars.packages", "com.microsoft.azure:synapseml_2.12:1.1.3") \ .getOrCreate() import synapse.ml ``` ### Spark Submit SynapseML can be conveniently installed on existing Spark clusters via the `--packages` option, examples: ```bash spark-shell --packages com.microsoft.azure:synapseml_2.12:1.1.3 pyspark --packages com.microsoft.azure:synapseml_2.12:1.1.3 spark-submit --packages com.microsoft.azure:synapseml_2.12:1.1.3 MyApp.jar ``` ### SBT If you are building a Spark application in Scala, add the following lines to your `build.sbt`: ```scala libraryDependencies += "com.microsoft.azure" % "synapseml_2.12" % "1.1.3" ``` ### Apache Livy and HDInsight To install SynapseML from within a Jupyter notebook served by Apache Livy the following configure magic can be used. You will need to start a new session after this configure cell is executed. Excluding certain packages from the library may be necessary due to current issues with Livy 0.5. ```bash %%configure -f { "name": "synapseml", "conf": { "spark.jars.packages": "com.microsoft.azure:synapseml_2.12:1.1.3", "spark.jars.excludes": "org.scala-lang:scala-reflect,org.apache.spark:spark-tags_2.12,org.scalactic:scalactic_2.12,org.scalatest:scalatest_2.12,com.fasterxml.jackson.core:jackson-databind" } } ``` ### Docker The easiest way to evaluate SynapseML is via our pre-built Docker container. To do so, run the following command: ```bash docker run -it -p 8888:8888 -e ACCEPT_EULA=yes mcr.microsoft.com/mmlspark/release jupyter notebook ``` Navigate to <http://localhost:8888/> in your web browser to run the sample notebooks. See the [documentation](https://microsoft.github.io/SynapseML/docs/Reference/Docker%20Setup/) for more on Docker use. > To read the EULA for using the docker image, run `docker run -it -p 8888:8888 mcr.microsoft.com/mmlspark/release eula` ### R To try out SynapseML using the R autogenerated wrappers [see our instructions](https://microsoft.github.io/SynapseML/docs/Reference/R%20Setup/). Note: This feature is still under development and some necessary custom wrappers may be missing. ### Building from source SynapseML has recently transitioned to a new build infrastructure. For detailed developer docs please see the [Developer Readme](https://microsoft.github.io/SynapseML/docs/Reference/Developer%20Setup/) If you are an existing synapsemldeveloper, you will need to reconfigure your development setup. We now support platform independent development and better integrate with intellij and SBT. If you encounter issues please reach out to our support email! ## Papers - [Large Scale Intelligent Microservices](https://arxiv.org/abs/2009.08044) - [Conditional Image Retrieval](https://arxiv.org/abs/2007.07177) - [MMLSpark: Unifying Machine Learning Ecosystems at Massive Scales](https://arxiv.org/abs/1810.08744) - [Flexible and Scalable Deep Learning with SynapseML](https://arxiv.org/abs/1804.04031) - [Large-Scale Automatic Audiobook Creation](https://arxiv.org/abs/2309.03926) ## Learn More - Visit our [website]. - Watch our keynote demos at [the Spark+AI Summit 2019], [the Spark+AI European Summit 2018], [the Spark+AI Summit 2018] and [SynapseML at the Spark Summit]. - See how SynapseML is used to [help endangered species]. - Explore generative adversarial artwork in [our collaboration with The MET and MIT]. - Explore [our collaboration with Apache Spark] on image analysis. [website]: https://microsoft.github.io/SynapseML/ "aka.ms/spark" [the Spark+AI Summit 2018]: https://databricks.com/sparkaisummit/north-america/spark-summit-2018-keynotes#Intelligent-cloud "Developing for the Intelligent Cloud and Intelligent Edge" [the Spark+AI Summit 2019]: https://youtu.be/T_fs4C0aqD0?t=425 [the Spark+AI European Summit 2018]: https://youtu.be/N3ozCZXeOeU?t=472 [help endangered species]: https://www.microsoft.com/en-us/ai/ai-lab-stories?activetab=pivot1:primaryr3 "Identifying snow leopards with AI" [our collaboration with The MET and MIT]: https://www.microsoft.com/en-us/ai/ai-lab-stories?activetab=pivot1:primaryr4 "Generative art at the MET" [our collaboration with Apache Spark]: https://blogs.technet.microsoft.com/machinelearning/2018/03/05/image-data-support-in-apache-spark/ "Image Data Support in Apache Spark" [SynapseML at the Spark Summit]: https://databricks.com/session/mmlspark-lessons-from-building-a-sparkml-compatible-machine-learning-library-for-apache-spark "MMLSpark: Lessons from Building a SparkML-Compatible Machine Learning Library for Apache Spark" ## Contributing & feedback This project has adopted the [Microsoft Open Source Code of Conduct]. For more information see the [Code of Conduct FAQ] or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. [Microsoft Open Source Code of Conduct]: https://opensource.microsoft.com/codeofconduct/ [Code of Conduct FAQ]: https://opensource.microsoft.com/codeofconduct/faq/ See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines. To give feedback and/or report an issue, open a [GitHub Issue](https://help.github.com/articles/creating-an-issue/). ## Other relevant projects - [Vowpal Wabbit](https://github.com/VowpalWabbit/vowpal_wabbit) - [LightGBM](https://github.com/lightgbm-org/LightGBM) - [DMTK: Microsoft Distributed Machine Learning Toolkit](https://github.com/Microsoft/DMTK) - [Recommenders](https://github.com/recommenders-team/Recommenders) - [JPMML-SparkML plugin for converting SynapseML LightGBM models to PMML](https://github.com/alipay/jpmml-sparkml-lightgbm) - [Microsoft Cognitive Toolkit](https://github.com/Microsoft/CNTK) _Apache®, Apache Spark, and Spark® are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries._

ML Frameworks Data Pipelines & ETL
5.2K Github Stars
FLAML
Open Source

FLAML

[![PyPI version](https://badge.fury.io/py/FLAML.svg)](https://badge.fury.io/py/FLAML) ![Conda version](https://img.shields.io/conda/vn/conda-forge/flaml) [![Build](https://github.com/microsoft/FLAML/actions/workflows/python-package.yml/badge.svg)](https://github.com/microsoft/FLAML/actions/workflows/python-package.yml) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/FLAML)](https://pypi.org/project/FLAML/) [![Downloads](https://pepy.tech/badge/flaml)](https://pepy.tech/project/flaml) [![](https://img.shields.io/discord/1025786666260111483?logo=discord&style=flat)](https://discord.gg/Cppx2vSPVP) <!-- [![Join the chat at https://gitter.im/FLAMLer/community](https://badges.gitter.im/FLAMLer/community.svg)](https://gitter.im/FLAMLer/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) --> # A Fast Library for Automated Machine Learning & Tuning <p align="center"> <img src="https://github.com/microsoft/FLAML/blob/main/website/static/img/flaml.svg" width=200> <br> </p> :fire: FLAML supports AutoML and Hyperparameter Tuning in [Microsoft Fabric Data Science](https://learn.microsoft.com/en-us/fabric/data-science/automated-machine-learning-fabric). In addition, we've introduced Python 3.11+ support, along with a range of new estimators, and comprehensive integration with MLflow—thanks to contributions from the Microsoft Fabric product team. :fire: Heads-up: [AutoGen](https://microsoft.github.io/autogen/) has moved to a dedicated [GitHub repository](https://github.com/microsoft/autogen). FLAML no longer includes the `autogen` module—please use AutoGen directly. ## What is FLAML FLAML is a lightweight Python library for efficient automation of machine learning and AI operations. It automates workflow based on large language models, machine learning models, etc. and optimizes their performance. - FLAML enables economical automation and tuning for ML/AI workflows, including model selection and hyperparameter optimization under resource constraints. - For common machine learning tasks like classification and regression, it quickly finds quality models for user-provided data with low computational resources. It is easy to customize or extend. Users can find their desired customizability from a smooth range. - It supports fast and economical automatic tuning (e.g., inference hyperparameters for foundation models, configurations in MLOps/LMOps workflows, pipelines, mathematical/statistical models, algorithms, computing experiments, software configurations), capable of handling large search space with heterogeneous evaluation cost and complex constraints/guidance/early stopping. FLAML is powered by a series of [research studies](https://microsoft.github.io/FLAML/docs/Research/) from Microsoft Research and collaborators such as Penn State University, Stevens Institute of Technology, University of Washington, and University of Waterloo. FLAML has a .NET implementation in [ML.NET](http://dot.net/ml), an open-source, cross-platform machine learning framework for .NET. ## Installation The latest version of FLAML requires **Python >= 3.10 and < 3.14**. While other Python versions may work for core components, full model support is not guaranteed. FLAML can be installed via `pip`: ```bash pip install flaml ``` Minimal dependencies are installed without extra options. You can install extra options based on the feature you need. For example, use the following to install the dependencies needed by the [`automl`](https://microsoft.github.io/FLAML/docs/Use-Cases/Task-Oriented-AutoML) module. ```bash pip install "flaml[automl]" ``` Find more options in [Installation](https://microsoft.github.io/FLAML/docs/Installation). Each of the [`notebook examples`](https://github.com/microsoft/FLAML/tree/main/notebook) may require a specific option to be installed. ## Quickstart - With three lines of code, you can start using this economical and fast AutoML engine as a [scikit-learn style estimator](https://microsoft.github.io/FLAML/docs/Use-Cases/Task-Oriented-AutoML). ```python from flaml import AutoML automl = AutoML() automl.fit(X_train, y_train, task="classification") ``` - You can restrict the learners and use FLAML as a fast hyperparameter tuning tool for XGBoost, LightGBM, Random Forest etc. or a [customized learner](https://microsoft.github.io/FLAML/docs/Use-Cases/Task-Oriented-AutoML#estimator-and-search-space). ```python automl.fit(X_train, y_train, task="classification", estimator_list=["lgbm"]) ``` - You can also run generic hyperparameter tuning for a [custom function](https://microsoft.github.io/FLAML/docs/Use-Cases/Tune-User-Defined-Function). ```python from flaml import tune tune.run( evaluation_function, config={…}, low_cost_partial_config={…}, time_budget_s=3600 ) ``` - [Zero-shot AutoML](https://microsoft.github.io/FLAML/docs/Use-Cases/Zero-Shot-AutoML) allows using the existing training API from lightgbm, xgboost etc. while getting the benefit of AutoML in choosing high-performance hyperparameter configurations per task. ```python from flaml.default import LGBMRegressor # Use LGBMRegressor in the same way as you use lightgbm.LGBMRegressor. estimator = LGBMRegressor() # The hyperparameters are automatically set according to the training data. estimator.fit(X_train, y_train) ``` ## Documentation You can find a detailed documentation about FLAML [here](https://microsoft.github.io/FLAML/). In addition, you can find: - [Research](https://microsoft.github.io/FLAML/docs/Research) and [blogposts](https://microsoft.github.io/FLAML/blog) around FLAML. - [Discord](https://discord.gg/Cppx2vSPVP). - [Contributing guide](https://microsoft.github.io/FLAML/docs/Contribute). - ML.NET documentation and tutorials for [Model Builder](https://learn.microsoft.com/dotnet/machine-learning/tutorials/predict-prices-with-model-builder), [ML.NET CLI](https://learn.microsoft.com/dotnet/machine-learning/tutorials/sentiment-analysis-cli), and [AutoML API](https://learn.microsoft.com/dotnet/machine-learning/how-to-guides/how-to-use-the-automl-api). ## 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>. If you are new to GitHub [here](https://help.github.com/categories/collaborating-with-issues-and-pull-requests/) is a detailed help source on getting involved with development on GitHub. 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. ## Contributors Wall <a href="https://github.com/microsoft/flaml/graphs/contributors"> <img src="https://contrib.rocks/image?repo=microsoft/flaml&max=204" /> </a>

AI & Machine Learning ML Frameworks
4.4K Github Stars
muzic
Open Source

muzic

<br/> <a href="https://github.com/microsoft/muzic"><img src="img/logo_gradient.png" height="70"> </a> <br/> <br/> **Muzic** is a research project on AI music that empowers music understanding and generation with deep learning and artificial intelligence. Muzic is pronounced as [ˈmjuːzeik]. Besides the logo in image version (see above), Muzic also has a logo in video version (you can click here to watch <a href="https://ai-muzic.github.io/muzic_logo/"><img src="img/muzic_video_logo.PNG" title="Muzic Video Logo" height="15"/></a>). Muzic was started by [some researchers](https://www.microsoft.com/en-us/research/project/ai-music/) from [Microsoft Research Asia](https://www.microsoft.com/en-us/research/lab/microsoft-research-asia/) and also contributed by outside collaborators. <!-- [![Muzic Video Logo](img/muzic_video_logo.PNG)](https://ai-muzic.github.io/muzic_logo/ "Muzic Video Logo") --> <br/> We summarize the scope of our Muzic project in the following figure: <br/><br/> <p align="center"> <a href="https://github.com/microsoft/muzic"> <img src="img/concept_map_new.png" height="350"/> </a> </p> <br/> The current work in [Muzic](https://www.microsoft.com/en-us/research/project/ai-music/) includes: * Music Understanding + Symbolic Music Understanding: [MusicBERT](https://arxiv.org/abs/2106.05630) + Automatic Lyrics Transcription: [PDAugment](https://arxiv.org/abs/2109.07940) + Contrastive Language-Music Pre-training: [CLaMP](https://arxiv.org/abs/2304.11029) * Music Generation + Song Writing + Lyric-to-Melody and Melody-to-Lyric: [SongMASS](https://arxiv.org/abs/2012.05168) + Lyric Generation: [DeepRapper](https://arxiv.org/abs/2107.01875) + Lyric-to-Melody Generation: [TeleMelody](https://arxiv.org/abs/2109.09617), [ReLyMe](https://arxiv.org/abs/2207.05688), [Re-creation of Creations (ROC)](https://arxiv.org/abs/2208.05697) + Music Form/Structure Generation + Music Form Generation: [MeloForm](https://arxiv.org/abs/2208.14345) + Long/Short Structure Modeling: [Museformer](https://arxiv.org/abs/2210.10349) + Multi-Track Generation + Accompaniment Generation: [PopMAG](https://arxiv.org/abs/2008.07703) + Any Track Music Generation: [GETMusic](https://arxiv.org/abs/2305.10841) + Text-to-Music Generation: [MuseCoco](https://arxiv.org/abs/2306.00110) + Singing Voice Synthesis: [HiFiSinger](https://arxiv.org/abs/2009.01776) * AI Agent + [MusicAgent](https://arxiv.org/abs/2310.11954) You can find some music samples generated by our systems on this page: https://ai-muzic.github.io/. <br> For more speech related research, you can find from this page: https://speechresearch.github.io/ and https://github.com/microsoft/NeuralSpeech. ### We are hiring! We are hiring both research FTEs and research interns on **Speech/Audio/Music/Video and LLMs**. Please get in touch with Xu Tan ([email protected]) if you are interested. ### What is New? + [CLaMP](https://arxiv.org/abs/2304.11029) has won the Best Student Paper Award at ISMIR 2023! + We release [MusicAgent](https://arxiv.org/abs/2310.11954), an AI agent for versatile music processing using large language models. + We release [MuseCoco](https://arxiv.org/abs/2306.00110), a music composition copilot to generate symbolic music from text. + We release [GETMusic](https://arxiv.org/abs/2305.10841), a versatile music copliot with a universal representation and diffusion framework to generate any music tracks. + We release the first model for cross-modal symbolic MIR: [CLaMP](https://arxiv.org/abs/2304.11029). + We release two new research work on music structure modeling: [MeloForm](https://arxiv.org/abs/2208.14345) and [Museformer](https://arxiv.org/abs/2210.10349). + We give a tutorial on [AI Music Composition](https://www.microsoft.com/en-us/research/uploads/prod/2021/10/[email protected]) at [ACM Multimedia 2021](https://2021.acmmm.org/). ## Requirements The operating system is Linux. We test on Ubuntu 16.04.6 LTS, CUDA 10, with Python 3.6.12. The requirements for running Muzic are listed in `requirements.txt`. To install the requirements, run: ```bash pip install -r requirements.txt ``` We release the code of several research work: [MusicBERT](musicbert), [PDAugment](pdaugment), [CLaMP](clamp), [DeepRapper](deeprapper), [SongMASS](songmass), [TeleMelody](telemelody), [ReLyMe](relyme), [Re-creation of Creations (ROC)](roc), [MeloForm](meloform), [Museformer](museformer), [GETMusic](getmusic), [MuseCoco](musecoco), and [MusicAgent](musicagent). You can find the README in the corresponding folder for detailed instructions on how to use. ## Reference If you find the Muzic project useful in your work, you can cite the papers as follows: * [1] ***MusicBERT**: Symbolic Music Understanding with Large-Scale Pre-Training*, Mingliang Zeng, Xu Tan, Rui Wang, Zeqian Ju, Tao Qin, Tie-Yan Liu, **ACL 2021**. * [2] ***PDAugment**: Data Augmentation by Pitch and Duration Adjustments for Automatic Lyrics Transcription*, Chen Zhang, Jiaxing Yu, Luchin Chang, Xu Tan, Jiawei Chen, Tao Qin, Kejun Zhang, **ISMIR 2022**. * [3] ***DeepRapper**: Neural Rap Generation with Rhyme and Rhythm Modeling*, Lanqing Xue, Kaitao Song, Duocai Wu, Xu Tan, Nevin L. Zhang, Tao Qin, Wei-Qiang Zhang, Tie-Yan Liu, **ACL 2021**. * [4] ***SongMASS**: Automatic Song Writing with Pre-training and Alignment Constraint*, Zhonghao Sheng, Kaitao Song, Xu Tan, Yi Ren, Wei Ye, Shikun Zhang, Tao Qin, **AAAI 2021**. * [5] ***TeleMelody**: Lyric-to-Melody Generation with a Template-Based Two-Stage Method*, Zeqian Ju, Peiling Lu, Xu Tan, Rui Wang, Chen Zhang, Songruoyao Wu, Kejun Zhang, Xiangyang Li, Tao Qin, Tie-Yan Liu, **EMNLP 2022**. * [6] ***ReLyMe**: Improving Lyric-to-Melody Generation by Incorporating Lyric-Melody Relationships*, Chen Zhang, LuChin Chang, Songruoyao Wu, Xu Tan, Tao Qin, Tie-Yan Liu, Kejun Zhang, **ACM Multimedia 2022**. * [7] ***Re-creation of Creations**: A New Paradigm for Lyric-to-Melody Generation*, Ang Lv, Xu Tan, Tao Qin, Tie-Yan Liu, Rui Yan, arXiv 2022. * [8] ***MeloForm**: Generating Melody with Musical Form based on Expert Systems and Neural Networks*, Peiling Lu, Xu Tan, Botao Yu, Tao Qin, Sheng Zhao, Tie-Yan Liu, **ISMIR 2022**. * [9] ***Museformer**: Transformer with Fine- and Coarse-Grained Attention for Music Generation*, Botao Yu, Peiling Lu, Rui Wang, Wei Hu, Xu Tan, Wei Ye, Shikun Zhang, Tao Qin, Tie-Yan Liu, **NeurIPS 2022**. * [10] ***PopMAG**: Pop Music Accompaniment Generation*, Yi Ren, Jinzheng He, Xu Tan, Tao Qin, Zhou Zhao, Tie-Yan Liu, **ACM Multimedia 2020**. * [11] ***HiFiSinger**: Towards High-Fidelity Neural Singing Voice Synthesis*, Jiawei Chen, Xu Tan, Jian Luan, Tao Qin, Tie-Yan Liu, arXiv 2020. * [12] ***CLaMP**: Contrastive Language-Music Pre-training for Cross-Modal Symbolic Music Information Retrieval*, Shangda Wu, Dingyao Yu, Xu Tan, Maosong Sun, **ISMIR 2023**, ***Best Student Paper Award***. * [13] ***GETMusic**: Generating Any Music Tracks with a Unified Representation and Diffusion Framework*, Ang Lv, Xu Tan, Peiling Lu, Wei Ye, Shikun Zhang, Jiang Bian, Rui Yan, arXiv 2023. * [14] ***MuseCoco**: Generating Symbolic Music from Text*, Peiling Lu, Xin Xu, Chenfei Kang, Botao Yu, Chengyi Xing, Xu Tan, Jiang Bian, arXiv 2023. * [15] ***MusicAgent**: An AI Agent for Music Understanding and Generation with Large Language Models*, Dingyao Yu, Kaitao Song, Peiling Lu, Tianyu He, Xu Tan, Wei Ye, Shikun Zhang, Jiang Bian, **EMNLP 2023 Demo**. ## 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. ## 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). 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.

ML Frameworks Audio Editing & DAW
4.9K Github Stars
presidio
Open Source

presidio

# Presidio - Data Protection and De-identification SDK **Context aware, pluggable and customizable PII de-identification service for text and images.** --- [![Build Status](https://github.com/microsoft/presidio/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/microsoft/presidio/actions/workflows/ci.yml) [![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT) ![Release](https://img.shields.io/github/release/Microsoft/presidio.svg) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/6076/badge)](https://www.bestpractices.dev/projects/6076) [![PyPI pyversions](https://img.shields.io/pypi/pyversions/presidio-analyzer.svg)](https://pypi.python.org/pypi/presidio-analyzer/) | Component | Downloads | Coverage | |-----------|-----------|----------| | Presidio Analyzer | [![Pypi Downloads](https://img.shields.io/pypi/dm/presidio-analyzer.svg)](https://pypi.python.org/pypi/presidio-analyzer/) | [![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/microsoft/presidio/coverage-data-presidio-analyzer/endpoint.json)](https://github.com/microsoft/presidio/tree/coverage-data-presidio-analyzer) | | Presidio Anonymizer | [![Pypi Downloads](https://img.shields.io/pypi/dm/presidio-anonymizer.svg)](https://pypi.python.org/pypi/presidio-anonymizer/) | [![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/microsoft/presidio/coverage-data-presidio-anonymizer/endpoint.json)](https://github.com/microsoft/presidio/tree/coverage-data-presidio-anonymizer) | | Presidio Image-Redactor | [![Pypi Downloads](https://img.shields.io/pypi/dm/presidio-image-redactor.svg)](https://pypi.python.org/pypi/presidio-image-redactor/) | [![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/microsoft/presidio/coverage-data-presidio-image-redactor/endpoint.json)](https://github.com/microsoft/presidio/tree/coverage-data-presidio-image-redactor) | | Presidio Structured | [![Pypi Downloads](https://img.shields.io/pypi/dm/presidio-structured.svg)](https://pypi.python.org/pypi/presidio-structured/) | [![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/microsoft/presidio/coverage-data-presidio-structured/endpoint.json)](https://github.com/microsoft/presidio/tree/coverage-data-presidio-structured) | ## What is Presidio Presidio _(Origin from Latin praesidium ‘protection, garrison’)_ helps to ensure sensitive data is properly managed and governed. It provides fast **_identification_** and **_anonymization_** modules for private entities in text such as credit card numbers, names, locations, social security numbers, bitcoin wallets, US phone numbers, financial data and more. ![Presidio demo gif](docs/assets/changing_text.gif) --- ### :blue_book: [Full documentation](https://microsoft.github.io/presidio) ### :question: [Frequently Asked Questions](docs/faq.md) ### :thought_balloon: [Demo](https://aka.ms/presidio-demo) ### :flight_departure: [Examples](https://microsoft.github.io/presidio/samples/) --- ### Goals - Allow organizations to preserve privacy in a simpler way by democratizing de-identification technologies and introducing transparency in decisions. - Embrace extensibility and customizability to a specific business need. - Facilitate both fully automated and semi-automated PII de-identification flows on multiple platforms. ### Main features 1. **Predefined** or **custom PII recognizers** leveraging _Named Entity Recognition_, _regular expressions_, _rule based logic_ and _checksum_ with relevant context in multiple languages. 2. Options for connecting to external PII detection models. 3. Multiple usage options, **from Python or PySpark workloads through Docker to Kubernetes**. 4. **Customizability** in PII identification and de-identification. 5. Module for **redacting PII text in images** (standard image types and DICOM medical images). :warning: Presidio can help identify sensitive/PII data in un/structured text. However, because it is using automated detection mechanisms, there is no guarantee that Presidio will find all sensitive information. Consequently, additional systems and protections should be employed. ## Installing Presidio 1. [Using pip](https://microsoft.github.io/presidio/installation/#using-pip) 2. [Using Docker](https://microsoft.github.io/presidio/installation/#using-docker) 3. [From source](https://microsoft.github.io/presidio/installation/#install-from-source) 4. [Migrating from V1 to V2](./docs/presidio_V2.md) ## Running Presidio 1. [Getting started](https://microsoft.github.io/presidio/getting_started) 2. [Setting up a development environment](https://microsoft.github.io/presidio/development) 3. [PII de-identification in text](https://microsoft.github.io/presidio/text_anonymization) 4. [PII de-identification in images](https://microsoft.github.io/presidio/image-redactor) 5. [Usage samples and example deployments](https://microsoft.github.io/presidio/samples) --- ## Support - Before you submit an issue, please go over the [documentation](https://microsoft.github.io/presidio/). - For general discussions, please use the [GitHub repo's discussion board](https://github.com/microsoft/presidio/discussions). - If you have a usage question, found a bug or have a suggestion for improvement, please file a [GitHub issue](https://github.com/microsoft/presidio/issues). - For other matters, please email [[email protected]](mailto:[email protected]). ## Contributing For details on contributing to this repository, see the [contributing guide](CONTRIBUTING.md). 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.microsoft.com](https://cla.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., label, 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. ## Contributors <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <!-- markdownlint-restore --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END --> <a href="https://github.com/microsoft/presidio/graphs/contributors"> <img src="https://contrib.rocks/image?repo=microsoft/presidio" /> </a>

Security ML Frameworks
8.5K Github Stars
ai-dev-gallery
Open Source

ai-dev-gallery

![WindowsAI hero image](docs/images/header.png) <h1 align="center"> AI Dev Gallery (Preview) </h1> > [!IMPORTANT] > The AI Dev Gallery is currently in public preview, and we’d love your feedback! Share your thoughts by creating an [issue](https://github.com/microsoft/ai-dev-gallery/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen). Designed for Windows developers, the AI Dev Gallery helps integrate AI capabilities into apps and projects. It includes: - **Explore over 25 interactive samples powered by local AI models** - **Easily browse, download, and run models from Hugging Face and GitHub** - **View the C# source code and export standalone Visual Studio projects with a single click** <p align="center"> <img src="docs/images/HeroImage1.png" alt="AI Dev Gallery" width="600"/> </p> <p align="center"> <a href="http://aka.ms/ai-dev-gallery-store"> <img alt="Store badge" src="docs/images/storeBadge.png" width="200"/> </a> </p> ## 🚀 Getting started Download [AI Dev Gallery from the Microsoft Store](http://aka.ms/ai-dev-gallery-store) or follow these steps to install it manually: ### 1. Set up the environment >**⚠️ Note**: AI Dev Gallery requires [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) or later for building and Windows 10 or newer to run. If you're new to building apps with WinUI and the Windows App SDK, follow the [installation instructions](https://learn.microsoft.com/windows/apps/get-started/start-here). **Required [Visual Studio components](https://learn.microsoft.com/windows/apps/get-started/start-here?tabs=vs-2022-17-10#required-workloads-and-components):** - Windows application development ### 2. Clone the repository ```shell git clone https://github.com/microsoft/AI-Dev-Gallery.git ``` ### 3. Open AIDevGallery.sln with Visual Studio! Ensure that the `AIDevGallery` project is set as the startup project in Visual Studio. Press <kbd>F5</kbd> to run AI Dev Gallery! >**⚠️ Note**: On ARM64-based Copilot+ PCs, make sure to build and run the solution as `ARM64` (and not as `x64`). This is required especially when running the samples that communicate with models such as Phi Silica. >**⚠️ Note**: Having issues installing the app on your machine? Let us know by <a href="https://github.com/microsoft/AI-Dev-Gallery/issues">opening an issue </a> and our team will do our best to help! <br/> ## 💻 Device requirements - **Minimum OS version**: Windows 10, version 1809 (10.0; Build 17763) - **Architecture**: x64, ARM64 - **Memory**: At least 16 GB is recommended - **Disk space**: At least 20GB free space is recommended - **GPU**: 8GB of VRAM is recommended for running samples on the GPU ## 👏 Contribute to AI Dev Gallery Any samples or docs improvements you'd like to see? We're always looking for a helping hand. Feel free to <a href="https://github.com/microsoft/AI-Dev-Gallery/issues">open an issue </a> to start the discussion, or even better, create a PR with the change you'd like to see! <br/> ## ❓ FAQs - **Q: Is a Microsoft account necessary to use the app?** - **A:** No, the app does NOT require a Microsoft account for use. - **Q: Can I use the app without an internet connection?** - **A:** Yes, the app works offline since the AI models are downloaded locally. However, you will need to be online to download additional AI models from Hugging Face or GitHub. - **Q: What AI models are available in the app?** - **A:** The app features popular open source models and APIs from the <a href="https://learn.microsoft.com/windows/ai/overview">Microsoft Foundry on Windows</a>. When executing a sample, you can select which model you want to use. - **Q: Is the app's source code accessible? Can I contribute new samples?** - **A:** Yes, the app is completely open-source, and its code is accessible on [GitHub](https://github.com/microsoft/AI-Dev-Gallery). Feel free to contribute by <a href="https://github.com/microsoft/AI-Dev-Gallery/issues">filing an issue</a>, or submitting a PR and one of our moderators will review it. - **Q: Where can I provide feedback?** - **A:** Feel free to give us feedback or [open an issue](https://github.com/microsoft/AI-Dev-Gallery/issues/new) on our GitHub repository. - **Q: Do I need to run the app just to try a single sample?** - **A:** Yes, the app is required to run any sample. However, once you've downloaded a model for a sample via the app, you can export the sample as a Visual Studio project and run it independently from there. <br/> ## ✨ 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. <br/> ## 📚 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). 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. <br/> ## 🔔 Code of Conduct This project has adopted the <a href="https://github.com/microsoft/AI-Dev-Gallery/blob/main/CODE_OF_CONDUCT.md"> Microsoft Open Source Code of Conduct</a>. <br/> ## 📢 Privacy Statement The application logs basic telemetry. Please read the <a href="http://go.microsoft.com/fwlink/?LinkId=521839"> Microsoft privacy statement</a> for more information.

AI Tools
1.5K Github Stars
PIKE-RAG
Open Source

PIKE-RAG

<p align="center"> <img src="./docs/source/images/logo/PIKE-RAG_horizontal_black-font.svg" alt="PIKE-RAG" style="width: 80%; max-width: 100%; height: auto;"> </p> <p align="center"> <a href="https://pike-rag.azurewebsites.net/">🌐Online Demo</a> <a href="https://arxiv.org/abs/2501.11551">📊Technical Report</a> <a href="https://openreview.net/pdf?id=PAjCdkkNaU">📑ICML 2025 Paper</a> </p> [![License](https://img.shields.io/github/license/microsoft/PIKE-RAG)](https://github.com/microsoft/PIKE-RAG/blob/main/LICENSE) [![CodeQL](https://github.com/microsoft/PIKE-RAG/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/microsoft/PIKE-RAG/actions/workflows/github-code-scanning/codeql) [![Release](https://img.shields.io/github/v/release/microsoft/PIKE-RAG)](https://github.com/microsoft/PIKE-RAG/releases) [![ReleaseDate](https://img.shields.io/github/release-date-pre/microsoft/PIKE-RAG)](https://github.com/microsoft/PIKE-RAG/releases) [![Commits](https://img.shields.io/github/commits-since/microsoft/PIKE-RAG/latest/main)](https://github.com/microsoft/PIKE-RAG/commits/main) [![Pull Requests](https://img.shields.io/github/issues-pr/microsoft/PIKE-RAG)](https://github.com/microsoft/PIKE-RAG/pulls) [![Issues](https://img.shields.io/github/issues/microsoft/PIKE-RAG)](https://github.com/microsoft/PIKE-RAG/issues) # PIKE-RAG: sPecIalized KnowledgE and Rationale Augmented Generation ## Why PIKE-RAG? In recent years, Retrieval Augmented Generation (RAG) systems have made significant progress in extending the capabilities of Large Language Models (LLM) through external retrieval. However, these systems still face challenges in meeting the complex and diverse needs of real-world industrial applications. Relying solely on direct retrieval is insufficient for extracting deep domain-specific knowledge from professional corpora and performing logical reasoning. To address this issue, we propose the PIKE-RAG (sPecIalized KnowledgE and Rationale Augmented Generation) method, which focuses on extracting, understanding, and applying domain-specific knowledge while building coherent reasoning logic to gradually guide LLMs toward accurate responses. <p align="center"> <img src="docs/source/images/readme/pipeline.png" alt="Overview of PIKE-RAG Framework" style="width: 80%; max-width: 100%; height: auto;"> </p> PIKE-RAG framework mainly consists of several basic modules, including document parsing, knowledge extraction, knowledge storage, knowledge retrieval, knowledge organization, knowledge-centric reasoning, and task decomposition and coordination. By adjusting the submodules within the main modules, it is possible to achieve RAG systems that focus on different capabilities to meet the diverse needs of real-world scenarios. For example, in case *patient's historical medical records searching*, it focuses on the *factual information retrieval capability*. The main challenges are that (1) the understanding and extraction of knowledge are often hindered by inappropriate knowledge segmentation, disrupting semantic coherence, leading to a complex and inefficient retrieval process; (2) commonly used embedding-based knowledge retrieval is limited by embedding models' ability to align professional terms and aliases, reducing system accuracy. With PIKE-RAG, we can improve the accuracy of knowledge extraction and retrieval by using context-aware segmentation techniques, automatic term label alignment techniques, and multi-granularity knowledge extraction methods during the knowledge extraction process, thereby enhancing factual information retrieval capability, as shown in the pipeline below. <p align="center"> <img src="docs/source/images/readme/L1_pipeline.png" alt="A Pipeline Focusing on Factual Information Retrieval" style="width: 80%; max-width: 100%; height: auto;"> </p> For complex task like *reasonable treatment plans and coping measures suggestions for patients*, it requires more advanced capabilities: strong domain-specific knowledge are required to accurately understand the task and sometimes reasonably decompose it; advanced data retrieval, processing and organization techniques are also required for potential tendency prediction; while multi-agents planning will also be useful to take considerations of both creativity and reliance. In such case, a richer pipeline below can be initialized to achieve this. <p align="center"> <img src="docs/source/images/readme/L4_pipeline.png" alt="A Pipeline Focusing on Fact-based Innovation and Generation" style="width: 80%; max-width: 100%; height: auto;"> </p> In public benchmark tests, PIKE-RAG demonstrated excellent performance on several multi-hop question answering datasets such as HotpotQA, 2WikiMultiHopQA, and MuSiQue. Compared to existing benchmark methods, PIKE-RAG excelled in metrics like accuracy and F1 score. On the HotpotQA dataset, PIKE-RAG achieved an accuracy of 87.6%, on 2WikiMultiHopQA it reached 82.0%, and on the more challenging MuSiQue dataset, it achieved 59.6%. These results indicate that PIKE-RAG has significant advantages in handling complex reasoning tasks, especially in scenarios that require integrating multi-source information and performing multi-step reasoning. PIKE-RAG has been tested and significantly improved question answering accuracy in fields such as industrial manufacturing, mining, and pharmaceuticals. In the future, we will continue to explore its application in more fields. Additionally, we will continue to explore other forms of knowledge and logic and their optimal adaptation to specific scenarios. ## For More Details - 📊 [Technical Report](https://arxiv.org/abs/2501.11551) will illustrate the industrial RAG problem classification, introduce the main components in PIKE-RAG, and show some experimental results in public benchmarks. - 🌐 [Online Demo](https://pike-rag.azurewebsites.net/) is a show-case of our Knowledge-Aware decomposition pipeline for L2 RAG task. - 📑 [ICML 2025 Paper](https://openreview.net/pdf?id=PAjCdkkNaU) From Complex to Atomic: Enhancing Augmented Generation via Knowledge-Aware Dual Rewriting and Reasoning. ## Quick Start 1. Clone this repo and set up the Python environment, refer to [this document](docs/guides/environment.md); 2. Create a `.env` file to save your endpoint information (and some other environment variables if needed), refer to [this document](docs/guides/env_file.md); 3. Modify the *yaml config* files and try the scripts under *examples/*, refer to [this document](docs/guides/examples.md); 4. Build up your own pipeline and/or add your own components! 🚀 Document ready [here](docs/guides/musique_example.md) for quick re-producing experiments on MuSiQue as shown in the technical report! ## 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. ## 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). 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.

ML Frameworks Knowledge Bases & RAG
2.4K Github Stars
kernel-memory
Open Source

kernel-memory

> [!CAUTION] > This is an archived research project. The code serves as a learning resource, not production software. Use it with caution, and at your own risk. No support is provided. Kernel Memory ============= [![License: MIT](https://img.shields.io/github/license/microsoft/kernel-memory)](https://github.com/microsoft/kernel-memory/blob/main/LICENSE) This repository presents best practices and a reference implementation for Memory in specific AI and LLMs application scenarios. Please note that **the code provided serves as a demonstration** and is **not an officially supported** Microsoft offering. **Kernel Memory** (KM) is a **multi-modal [AI Service](service/Service/README.md)** specialized in the efficient indexing of datasets through custom continuous data hybrid pipelines, with support for **[Retrieval Augmented Generation](https://en.wikipedia.org/wiki/Prompt_engineering#Retrieval-augmented_generation)** (RAG), synthetic memory, prompt engineering, and custom semantic memory processing. KM is available as a **Web Service**, as a **[Docker container](https://hub.docker.com/r/kernelmemory/service)**, a **[Plugin](https://learn.microsoft.com/copilot/plugins/overview)** for ChatGPT/Copilot/Semantic Kernel, and as a .NET library for embedded applications. Utilizing advanced embeddings and LLMs, the system enables Natural Language querying for obtaining answers from the indexed data, complete with citations and links to the original sources. Kernel Memory is designed for seamless integration as a Plugin with [Semantic Kernel](https://github.com/microsoft/semantic-kernel), Microsoft Copilot and ChatGPT. ![image](docs/img/kernel-memory-lambda-architecture.png) Kernel Memory Service on Azure ============================== Kernel Memory can be deployed in various configurations, including as a **Service** in Azure. To learn more about deploying Kernel Memory in Azure, please refer to the [Azure deployment guide](https://microsoft.github.io/kernel-memory/azure). For detailed instructions on deploying to Azure, you can check the [infrastructure documentation](/infra/README.md). If you are already familiar with these resources, you can quickly deploy by clicking the following button. [![Deploy to Azure](docs/azure-button.png)](https://aka.ms/KernelMemoryDeploy2Azure) 🔗 See also: [Kernel Memory via Docker](#kernel-memory-docker-image) and [Serverless Kernel Memory with Azure services example](examples/007-dotnet-serverless-azure). ## Running Kernel Memory with Aspire Kernel Memory can be easily run and imported in other projects also via .NET Aspire. For example: ```csharp var builder = DistributedApplication.CreateBuilder(); builder.AddContainer("kernel-memory", "kernelmemory/service") .WithEnvironment("KernelMemory__TextGeneratorType", "OpenAI") .WithEnvironment("KernelMemory__DataIngestion__EmbeddingGeneratorTypes__0", "OpenAI") .WithEnvironment("KernelMemory__Retrieval__EmbeddingGeneratorType", "OpenAI") .WithEnvironment("KernelMemory__Services__OpenAI__APIKey", "...your OpenAI key..."); builder.Build().Run(); ``` [![Run with .NET Aspire](docs/aspire-button.png)](examples/303-dotnet-aspire/Program.cs) Data Ingestion using Kernel Memory OpenAPI Web Service ====================================================== The example show the default documents ingestion pipeline: 1. Extract text: automatically recognize the file format and extract the information 2. Partition the text in small chunks, ready for search and RAG prompts 3. Extract embeddings using any LLM embedding generator 4. Save embeddings into a vector index such as [Azure AI Search](https://learn.microsoft.com/azure/search/vector-search-overview), [Qdrant](https://qdrant.tech/) or other DBs. The example shows how to **safeguard private information** specifying who owns each document, and how to **organize data** for search and faceted navigation, using **Tags**. ## C# > ```csharp > #r "nuget: Microsoft.KernelMemory.WebClient" > > var memory = new MemoryWebClient("http://127.0.0.1:9001"); // <== URL of KM web service > > // Import a file > await memory.ImportDocumentAsync("meeting-transcript.docx"); > > // Import a file specifying Document ID and Tags > await memory.ImportDocumentAsync("business-plan.docx", > new Document("doc01") > .AddTag("user", "[email protected]") > .AddTag("collection", "business") > .AddTag("collection", "plans") > .AddTag("fiscalYear", "2025")); > ``` ## Python > ```python > import requests > > # Files to import > files = { > "file1": ("business-plan.docx", open("business-plan.docx", "rb")), > } > > # Tags to apply, used by queries to filter memory > data = { "documentId": "doc01", > "tags": [ "user:[email protected]", > "collection:business", > "collection:plans", > "fiscalYear:2025" ] > } > > response = requests.post("http://127.0.0.1:9001/upload", files=files, data=data) > ``` Direct Data Ingestion using embedded Serverless .NET component ============================================================== > ```csharp > var memory = new KernelMemoryBuilder() > .WithOpenAIDefaults(Environment.GetEnvironmentVariable("OPENAI_API_KEY")) > .Build<MemoryServerless>(); > > // Import a file > await memory.ImportDocumentAsync("meeting-transcript.docx"); > > // Import a file specifying Document ID and Tags > await memory.ImportDocumentAsync("business-plan.docx", > new Document("doc01") > .AddTag("collection", "business") > .AddTag("collection", "plans") > .AddTag("fiscalYear", "2025")); > ``` Memory retrieval and RAG ======================== Asking questions, running RAG prompts, and filtering by user and other criteria is simple, with answers including citations and all the information needed to verify their accuracy, pointing to which documents ground the response. ## C# > ### Asking questions: > Questions can be asked targeting the entire memory set, or a subset using filters, > e.g. to implement security filters. > ```csharp > var answer1 = await memory.AskAsync("How many people attended the meeting?"); > > var answer2 = await memory.AskAsync("what's the project timeline?", > filter: MemoryFilters.ByTag("user", "[email protected]")); > ``` > ### Token usage: > When generating answers with LLMs, the result includes a token usage report. > ```csharp > foreach (var report in tokenUsage) > { > Console.WriteLine($"{report.ServiceType}: {report.ModelName} ({report.ModelType})"); > Console.WriteLine($"- Input : {report.ServiceTokensIn}"); > Console.WriteLine($"- Output: {report.ServiceTokensOut}"); > } > ``` > #### Output: > > Azure OpenAI: gpt-4o (TextGeneration) > > - Input : 24356 tokens > > - Output: 103 tokens ![km-stream-token-usage](https://github.com/user-attachments/assets/71abf161-106c-47cc-af06-66f810314687) > ### Data lineage, citations, referencing sources: > > ```csharp > await memory.ImportFileAsync("NASA-news.pdf"); > > var answer = await memory.AskAsync("Any news from NASA about Orion?"); > > Console.WriteLine(answer.Result + "/n"); > > foreach (var x in answer.RelevantSources) > { > Console.WriteLine($" * {x.SourceName} -- {x.Partitions.First().LastUpdate:D}"); > } > ``` > > > Yes, there is news from NASA about the Orion spacecraft. NASA has invited the > > media to see a new test version [......] For more information about the Artemis program, > > you can visit the NASA website. > > > > - **NASA-news.pdf -- Tuesday, August 1, 2023** ## Python > ### Asking questions: > > ```python > import requests > import json > > data = { > "question": "what's the project timeline?", > "filters": [ {"user": ["[email protected]"]} ] > } > > response = requests.post( > "http://127.0.0.1:9001/ask", > headers={"Content-Type": "application/json"}, > data=json.dumps(data), > ).json() > > print(response["text"]) > ``` ## OpenAPI > ``` > curl http://127.0.0.1:9001/ask -d'{"query":"Any news from NASA about Orion?"}' -H 'Content-Type: application/json' > ``` > > ```json > { > "Query": "Any news from NASA about Orion?", > "Text": "Yes, there is news from NASA about the Orion spacecraft. NASA has invited the media to see a new test version [......] For more information about the Artemis program, you can visit the NASA website.", > "RelevantSources": [ > { > "Link": "...", > "SourceContentType": "application/pdf", > "SourceName": "file5-NASA-news.pdf", > "Partitions": [ > { > "Text": "Skip to main content\nJul 28, 2023\nMEDIA ADVISORY M23-095\nNASA Invites Media to See Recovery Craft for\nArtemis Moon Mission\n(/sites/default/files/thumbnails/image/ksc-20230725-ph-fmx01_0003orig.jpg)\nAboard the [......] to Mars (/topics/moon-to-\nmars/),Orion Spacecraft (/exploration/systems/orion/index.html)\nNASA Invites Media to See Recovery Craft for Artemis Moon Miss... https://www.nasa.gov/press-release/nasa-invites-media-to-see-recov...\n2 of 3 7/28/23, 4:51 PM", > "Relevance": 0.8430657, > "SizeInTokens": 863, > "LastUpdate": "2023-08-01T08:15:02-07:00" > } > ] > } > ] > } > ``` The OpenAPI schema ("swagger") is available at http://127.0.0.1:9001/swagger/index.html when running the service locally with OpenAPI enabled. [Here's a copy](https://editor.swagger.io/?url=https://raw.githubusercontent.com/microsoft/kernel-memory/refs/heads/main/swagger.json). 🔗 See also: - [Full example with ingestion, search and RAG queries](https://github.com/microsoft/kernel-memory/tree/main/examples/001-dotnet-WebClient). - [Full example using serverless .NET component](https://github.com/microsoft/kernel-memory/blob/main/examples/002-dotnet-Serverless). Kernel Memory Docker image ========================== If you want to give the service a quick test, use the following command to **start the Kernel Memory Service** using OpenAI: ```shell docker run -e OPENAI_API_KEY="..." -it --rm -p 9001:9001 kernelmemory/service ``` If you prefer using custom settings and services such as Azure OpenAI, Azure Document Intelligence, etc., you should create an `appsettings.Development.json` file overriding the default values set in `appsettings.json`, or using the configuration wizard included: cd service/Service dotnet run setup Then run this command to start the [Docker image](https://hub.docker.com/r/kernelmemory/service) with the configuration just created: on Windows: docker run --volume .\appsettings.Development.json:/app/appsettings.Production.json -it --rm -p 9001:9001 kernelmemory/service on Linux / macOS: docker run --volume ./appsettings.Development.json:/app/appsettings.Production.json -it --rm -p 9001:9001 kernelmemory/service 🔗 See also: * [How to configure KM service](https://github.com/microsoft/kernel-memory/blob/main/service/Service/README.md#%EF%B8%8F-configuration) * [Deploy Kernel Memory to Azure](#kernel-memory-service-on-azure). Memory as a Service: Data Ingestion Pipelines + RAG Web Service =============================================================== Depending on your scenarios, you might want to run all the code **remotely through an asynchronous and scalable service, or locally inside your process.** ![image](docs/img/kernel-memory-as-a-service.png) If you're importing small files, and use only .NET and can block the application process while importing documents, then local-in-process execution can be fine, using the **MemoryServerless** described below. However, if you are in one of these scenarios: - My app is written in **TypeScript, Java, Rust, or some other language** - I'd just like a web service to import data and send questions to answer - I'm importing **big documents that can require minutes to process**, and I don't want to block the user interface - I need memory import to **run independently, supporting failures and retry logic** - I want to define **custom pipelines mixing multiple languages** like Python, TypeScript, etc then you're likely looking for a **Memory Service**, and you can deploy Kernel Memory as a backend service, using the default ingestion logic, or your custom workflow including steps coded in Python/TypeScript/Java/etc., leveraging the asynchronous non-blocking memory encoding process, uploading documents and asking questions using the **MemoryWebClient**. ![image](docs/img/kernel-memory-client.png) [Here](service/Service/README.md) you can find a complete set of instruction about [how to run the Kernel Memory service](service/Service/README.md). ## Embedded Memory Component (aka "serverless") Kernel Memory works and scales at best when running as an asynchronous **Web Service**, allowing to ingest thousands of documents and information without blocking your app. However, Kernel Memory can also run in serverless mode, embedding `MemoryServerless` class instance in .NET backend/console/desktop apps in synchronous mode. Each request is processed immediately, although calling clients are responsible for handling transient errors. ![image](docs/img/kernel-memory-embedded-serverless.png) Extensions ========== Kernel Memory relies on external services to run stateful pipelines, store data, handle embeddings, and generate text responses. The project includes extensions that allow customization of file storage, queues, vector stores, and LLMs to fit specific requirements. - **AI**: Azure OpenAI, OpenAI, ONNX, Ollama, Anthropic, Azure AI Document Intelligence, Azure AI Content Safety - **Vector Store**: Azure AI Search, Postgres, SQL Server, Elasticsearch, Qdrant, Redis, MongoDB Atlas, In memory store - **File Storage**: Azure Blob storage, AWS S3, MongoDB Atlas, Local disk, In memory storage - **Ingestion pipelines**: Azure Queues, RabbitMQ, In memory queues Custom memory ingestion pipelines =================================== Document ingestion operates as a stateful pipeline, executing steps in a defined sequence. By default, Kernel Memory employs a pipeline to **extract** text, **chunk** content, **vectorize**, and **store** data. If you need a custom data pipeline, you can modify the sequence, add new steps, or replace existing ones by providing custom “handlers” for each desired stage. This allows complete flexibility in defining how data is processed. For example: ```csharp // Memory setup, e.g. how to calculate and where to store embeddings var memoryBuilder = new KernelMemoryBuilder() .WithoutDefaultHandlers() .WithOpenAIDefaults(Environment.GetEnvironmentVariable("OPENAI_API_KEY")); var memory = memoryBuilder.Build(); // Plug in custom .NET handlers memory.Orchestrator.AddHandler<MyHandler1>("step1"); memory.Orchestrator.AddHandler<MyHandler2>("step2"); memory.Orchestrator.AddHandler<MyHandler3>("step3"); // Use the custom handlers with the memory object await memory.ImportDocumentAsync( new Document("mytest001") .AddFile("file1.docx") .AddFile("file2.pdf"), steps: new[] { "step1", "step2", "step3" }); ``` ![image](docs/img/kernel-memory-pipelines.png) Kernel Memory (KM) and Semantic Kernel (SK) =========================================== **Semantic Kernel is an SDK for C#, Python, and Java** used to develop solutions with AI. SK includes libraries that wrap direct calls to databases, supporting vector search. Semantic Kernel is maintained in three languages, while the list of supported storage engines (known as "connectors") varies across languages. **Kernel Memory (KM) is a SERVICE** built on Semantic Kernel, with additional features developed for RAG, Security, and Cloud deployment. As a service, **KM can be used from any language, tool, or platform, e.g. browser extensions and ChatGPT assistants.** Kernel Memory provides several features out of the scope of Semantic Kernel, that would usually be developed manually, such as storing files, extracting text from documents, providing a framework to secure users' data, content moderation etc. Kernel Memory has also been leveraged to explore new AI patterns, which were backported to Semantic Kernel and Microsoft libraries, for instance vector stores, flexible schemas, advanced filtering, and authentications. Here's comparison table: | Feature | Kernel Memory | Semantic Kernel | |------------------|-----------------------------------------------------------------------|--------------------| | Runtime | Memory as a Service, Web service | SDK packages | | Data formats | Web pages, PDF, Images, Word, PowerPoint, Excel, Markdown, Text, JSON | Text only | | Language support | Any language | .NET, Python, Java | | RAG | Yes | - | | Cloud deployment | Yes | - | Examples and Tools ================== ## Examples 1. [Collection of Jupyter notebooks with various scenarios](examples/000-notebooks) 2. [Using Kernel Memory web service to upload documents and answer questions](examples/001-dotnet-WebClient) 3. [Importing files and asking question without running the service (serverless mode)](examples/002-dotnet-Serverless) 4. [Kernel Memory RAG with Azure services](examples/007-dotnet-serverless-azure) 5. [Kernel Memory with .NET Aspire](examples/303-dotnet-aspire) 6. [Using KM Plugin for Semantic Kernel](examples/003-dotnet-SemanticKernel-plugin) 7. Customizations * [Processing files with custom logic (custom handlers) in serverless mode](examples/004-dotnet-serverless-custom-pipeline) * [Processing files with custom logic (custom handlers) in asynchronous mode](examples/005-dotnet-AsyncMemoryCustomPipeline) * [Customizing RAG and summarization prompts](examples/101-dotnet-custom-Prompts) * [Custom partitioning/text chunking options](examples/102-dotnet-custom-partitioning-options) * [Using a custom embedding/vector generator](examples/103-dotnet-custom-EmbeddingGenerator) * [Using custom content decoders](examples/108-dotnet-custom-content-decoders) * [Using a custom web scraper to fetch web pages](examples/109-dotnet-custom-webscraper) * [Writing and using a custom ingestion handler](examples/201-dotnet-serverless-custom-handler) * [Using Context Parameters to customize RAG prompt during a request](examples/209-dotnet-using-context-overrides) 8. Local models and external connectors * [Using custom LLMs](examples/104-dotnet-custom-LLM) * [Using local LLMs with Ollama](examples/212-dotnet-ollama) * [Using local LLMs with llama.cpp via LlamaSharp](examples/105-dotnet-serverless-llamasharp) * [Using local models with LM Studio](examples/208-dotnet-lmstudio) * [Using Semantic Kernel LLM connectors](examples/107-dotnet-SemanticKernel-TextCompletion) * [Generating answers with Anthropic LLMs](examples/110-dotnet-anthropic) 9. [Upload files and ask questions from command line using curl](examples/006-curl-calling-webservice) 10. [Summarizing documents, using synthetic memories](examples/106-dotnet-retrieve-synthetics) 11. [Hybrid Search with Azure AI Search](examples/111-dotnet-azure-ai-hybrid-search) 12. [Running a single asynchronous pipeline handler as a standalone service](examples/202-dotnet-custom-handler-as-a-service) 13. [Integrating Memory with ASP.NET applications and controllers](examples/204-dotnet-ASP.NET-MVC-integration) 14. [Sample code showing how to extract text from files](examples/205-dotnet-extract-text-from-docs) 15. [.NET configuration and logging](examples/206-dotnet-configuration-and-logging) 16. [Expanding chunks retrieving adjacent partitions](examples/207-dotnet-expanding-chunks-on-retrieval) 17. [Creating a Memory instance without KernelMemoryBuilder](examples/210-KM-without-builder) 18. [Intent Detection](examples/211-dotnet-WebClient-Intent-Detection) 19. [Fetching data from Discord](examples/301-discord-test-application) 20. [Test project using KM package from nuget.org](examples/203-dotnet-using-KM-nuget) ## Tools 1. [.NET appsettings.json generator](tools/InteractiveSetup) 2. [Curl script to upload files](tools/km-cli/upload-file.sh) 3. [Curl script to ask questions](tools/km-cli/ask.sh) 4. [Curl script to search documents](tools/km-cli/search.sh) 5. [Script to start Qdrant for development tasks](tools/run-qdrant.sh) 6. [Script to start Elasticsearch for development tasks](tools/run-elasticsearch.sh) 7. [Script to start MS SQL Server for development tasks](tools/run-mssql.sh) 8. [Script to start Redis for development tasks](tools/run-redis.sh) 9. [Script to start RabbitMQ for development tasks](tools/run-rabbitmq.sh) 10. [Script to start MongoDB Atlas for development tasks](tools/run-mongodb-atlas.sh) ## .NET packages (retired) - **Microsoft.KernelMemory.WebClient:** .NET web client to call a running instance of Kernel Memory web service. [![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.WebClient)](https://www.nuget.org/packages/Microsoft.KernelMemory.WebClient/) [![Example code](https://img.shields.io/badge/example-code-blue)](examples/001-dotnet-WebClient) - **Microsoft.KernelMemory:** Kernel Memory library including all extensions and clients, it can be used to build custom pipelines and handlers. It contains also the serverless client to use memory in a synchronous way without the web service. [![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.Core)](https://www.nuget.org/packages/Microsoft.KernelMemory.Core/) [![Serverless example](https://img.shields.io/badge/example-code-blue)](examples/002-dotnet-Serverless) [![Custom pipeline example](https://img.shields.io/badge/example-code-blue)](examples/004-dotnet-serverless-custom-pipeline) [![Custom pipeline example](https://img.shields.io/badge/example-code-blue)](examples/005-dotnet-async-memory-custom-pipeline) - **Microsoft.KernelMemory.Service.AspNetCore:** an extension to load Kernel Memory into your ASP.NET apps. [![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.Service.AspNetCore)](https://www.nuget.org/packages/Microsoft.KernelMemory.Service.AspNetCore/) [![Example code](https://img.shields.io/badge/example-code-blue)](examples/204-dotnet-ASP.NET-MVC-integration) - **Microsoft.KernelMemory.SemanticKernelPlugin:** a Memory plugin for Semantic Kernel, replacing the original Semantic Memory available in SK. [![Nuget package](https://img.shields.io/nuget/vpre/Microsoft.KernelMemory.SemanticKernelPlugin)](https://www.nuget.org/packages/Microsoft.KernelMemory.SemanticKernelPlugin/) [![Example code](https://img.shields.io/badge/example-code-blue)](examples/003-dotnet-SemanticKernel-plugin) - [**Microsoft.KernelMemory.\*** packages](https://www.nuget.org/packages?q=microsoft.kernelmemory): Kernel Memory Core and all KM extensions split into distinct packages. ### Packages for Python, Java and other languages Kernel Memory service offers a **Web API** out of the box, including the [**OpenAPI swagger**](https://editor.swagger.io/?url=https://github.com/microsoft/kernel-memory/blob/main/archived/km-v1/swagger.json) documentation that you can leverage to test the API and create custom web clients. For instance, after starting the service locally, see http://127.0.0.1:9001/swagger/index.html. A .NET Web Client and a Semantic Kernel plugin are available, see the nugets packages above. For Python, TypeScript, Java and other languages we recommend leveraging the Web Service. Contributors ============ <!-- gh api repos/:owner/:repo/contributors --paginate --jq ' [ .[] | { login: .login, id: .id, url: .html_url, avatar: "https://avatars.githubusercontent.com/u/\(.id)?v=4&s=110" } ] as $list | ( "| " + ($list[0:6] | map("<img alt=\"\(.login)\" src=\"\(.avatar)\" width=\"110\">") | join(" | ")) + " |\n" + "|:---:|:---:|:---:|:---:|:---:|:---:|\n" + "| " + ($list[0:6] | map("[\(.login)](\(.url))") | join(" | ")) + " |\n" + ( reduce range(6; ($list | length); 6) as $i ( ""; . + "| " + ($list[$i:$i+6] | map("<img alt=\"\(.login)\" src=\"\(.avatar)\" width=\"110\">") | join(" | ")) + " |\n" + "| " + ($list[$i:$i+6] | map("[\(.login)](\(.url))") | join(" | ")) + " |\n" ) ) ) ' --> | <img alt="dluc" src="https://avatars.githubusercontent.com/u/371009?v=4&s=110" width="110"> | <img alt="marcominerva" src="https://avatars.githubusercontent.com/u/3522534?v=4&s=110" width="110"> | <img alt="anthonypuppo" src="https://avatars.githubusercontent.com/u/6828951?v=4&s=110" width="110"> | <img alt="crickman" src="https://avatars.githubusercontent.com/u/66376200?v=4&s=110" width="110"> | <img alt="TaoChenOSU" src="https://avatars.githubusercontent.com/u/12570346?v=4&s=110" width="110"> | <img alt="cherchyk" src="https://avatars.githubusercontent.com/u/1703275?v=4&s=110" width="110"> | |:---:|:---:|:---:|:---:|:---:|:---:| | [dluc](https://github.com/dluc) | [marcominerva](https://github.com/marcominerva) | [anthonypuppo](https://github.com/anthonypuppo) | [crickman](https://github.com/crickman) | [TaoChenOSU](https://github.com/TaoChenOSU) | [cherchyk](https://github.com/cherchyk) | | <img alt="kbeaugrand" src="https://avatars.githubusercontent.com/u/9513635?v=4&s=110" width="110"> | <img alt="alexmg" src="https://avatars.githubusercontent.com/u/131293?v=4&s=110" width="110"> | <img alt="alkampfergit" src="https://avatars.githubusercontent.com/u/358545?v=4&s=110" width="110"> | <img alt="dependabot[bot]" src="https://avatars.githubusercontent.com/u/49699333?v=4&s=110" width="110"> | <img alt="slorello89" src="https://avatars.githubusercontent.com/u/42971704?v=4&s=110" width="110"> | <img alt="xbotter" src="https://avatars.githubusercontent.com/u/3634877?v=4&s=110" width="110"> | | [kbeaugrand](https://github.com/kbeaugrand) | [alexmg](https://github.com/alexmg) | [alkampfergit](https://github.com/alkampfergit) | [dependabot[bot]](https://github.com/apps/dependabot) | [slorello89](https://github.com/slorello89) | [xbotter](https://github.com/xbotter) | | <img alt="westdavidr" src="https://avatars.githubusercontent.com/u/669668?v=4&s=110" width="110"> | <img alt="luismanez" src="https://avatars.githubusercontent.com/u/9392197?v=4&s=110" width="110"> | <img alt="afederici75" src="https://avatars.githubusercontent.com/u/13766049?v=4&s=110" width="110"> | <img alt="koteus" src="https://avatars.githubusercontent.com/u/428201?v=4&s=110" width="110"> | <img alt="amomra" src="https://avatars.githubusercontent.com/u/11981363?v=4&s=110" width="110"> | <img alt="lecramr" src="https://avatars.githubusercontent.com/u/20584823?v=4&s=110" width="110"> | | [westdavidr](https://github.com/westdavidr) | [luismanez](https://github.com/luismanez) | [afederici75](https://github.com/afederici75) | [koteus](https://github.com/koteus) | [amomra](https://github.com/amomra) | [lecramr](https://github.com/lecramr) | | <img alt="chaelli" src="https://avatars.githubusercontent.com/u/878151?v=4&s=110" width="110"> | <img alt="pawarsum12" src="https://avatars.githubusercontent.com/u/136417839?v=4&s=110" width="110"> | <img alt="aaronpowell" src="https://avatars.githubusercontent.com/u/434140?v=4&s=110" width="110"> | <img alt="alexibraimov" src="https://avatars.githubusercontent.com/u/59023460?v=4&s=110" width="110"> | <img alt="akordowski" src="https://avatars.githubusercontent.com/u/9746197?v=4&s=110" width="110"> | <img alt="coryisakson" src="https://avatars.githubusercontent.com/u/303811?v=4&s=110" width="110"> | | [chaelli](https://github.com/chaelli) | [pawarsum12](https://github.com/pawarsum12) | [aaronpowell](https://github.com/aaronpowell) | [alexibraimov](https://github.com/alexibraimov) | [akordowski](https://github.com/akordowski) | [coryisakson](https://github.com/coryisakson) | | <img alt="DM-98" src="https://avatars.githubusercontent.com/u/10290906?v=4&s=110" width="110"> | <img alt="EelcoKoster" src="https://avatars.githubusercontent.com/u/3356003?v=4&s=110" width="110"> | <img alt="GraemeJones104" src="https://avatars.githubusercontent.com/u/79144786?v=4&s=110" width="110"> | <img alt="imranshams" src="https://avatars.githubusercontent.com/u/15226209?v=4&s=110" width="110"> | <img alt="jurepurgar" src="https://avatars.githubusercontent.com/u/6506920?v=4&s=110" width="110"> | <img alt="JustinRidings" src="https://avatars.githubusercontent.com/u/49916830?v=4&s=110" width="110"> | | [DM-98](https://github.com/DM-98) | [EelcoKoster](https://github.com/EelcoKoster) | [GraemeJones104](https://github.com/GraemeJones104) | [imranshams](https://github.com/imranshams) | [jurepurgar](https://github.com/jurepurgar) | [JustinRidings](https://github.com/JustinRidings) | | <img alt="Foorcee" src="https://avatars.githubusercontent.com/u/5587062?v=4&s=110" width="110"> | <img alt="v-msamovendyuk" src="https://avatars.githubusercontent.com/u/61688766?v=4&s=110" width="110"> | <img alt="qihangnet" src="https://avatars.githubusercontent.com/u/1784873?v=4&s=110" width="110"> | <img alt="neel015" src="https://avatars.githubusercontent.com/u/34688460?v=4&s=110" width="110"> | <img alt="pascalberger" src="https://avatars.githubusercontent.com/u/2190718?v=4&s=110" width="110"> | <img alt="pradeepr-roboticist" src="https://avatars.githubusercontent.com/u/6598307?v=4&s=110" width="110"> | | [Foorcee](https://github.com/Foorcee) | [v-msamovendyuk](https://github.com/v-msamovendyuk) | [qihangnet](https://github.com/qihangnet) | [neel015](https://github.com/neel015) | [pascalberger](https://github.com/pascalberger) | [pradeepr-roboticist](https://github.com/pradeepr-roboticist) | | <img alt="setuc" src="https://avatars.githubusercontent.com/u/9305355?v=4&s=110" width="110"> | <img alt="slapointe" src="https://avatars.githubusercontent.com/u/1054412?v=4&s=110" width="110"> | <img alt="spenavajr" src="https://avatars.githubusercontent.com/u/96045491?v=4&s=110" width="110"> | <img alt="tarekgh" src="https://avatars.githubusercontent.com/u/10833894?v=4&s=110" width="110"> | <img alt="teresaqhoang" src="https://avatars.githubusercontent.com/u/125500434?v=4&s=110" width="110"> | <img alt="tomasz-skarzynski" src="https://avatars.githubusercontent.com/u/119002478?v=4&s=110" width="110"> | | [setuc](https://github.com/setuc) | [slapointe](https://github.com/slapointe) | [spenavajr](https://github.com/spenavajr) | [tarekgh](https://github.com/tarekgh) | [teresaqhoang](https://github.com/teresaqhoang) | [tomasz-skarzynski](https://github.com/tomasz-skarzynski) | | <img alt="Valkozaur" src="https://avatars.githubusercontent.com/u/58659526?v=4&s=110" width="110"> | <img alt="vicperdana" src="https://avatars.githubusercontent.com/u/7114832?v=4&s=110" width="110"> | <img alt="walexee" src="https://avatars.githubusercontent.com/u/12895846?v=4&s=110" width="110"> | <img alt="aportillo83" src="https://avatars.githubusercontent.com/u/72951744?v=4&s=110" width="110"> | <img alt="carlodek" src="https://avatars.githubusercontent.com/u/56030624?v=4&s=110" width="110"> | <img alt="KSemenenko" src="https://avatars.githubusercontent.com/u/4385716?v=4&s=110" width="110"> | | [Valkozaur](https://github.com/Valkozaur) | [vicperdana](https://github.com/vicperdana) | [walexee](https://github.com/walexee) | [aportillo83](https://github.com/aportillo83) | [carlodek](https://github.com/carlodek) | [KSemenenko](https://github.com/KSemenenko) | | <img alt="roldengarm" src="https://avatars.githubusercontent.com/u/37638588?v=4&s=110" width="110"> | <img alt="snakex64" src="https://avatars.githubusercontent.com/u/39806655?v=4&s=110" width="110"> | | [roldengarm](https://github.com/roldengarm) | [snakex64](https://github.com/snakex64) |

ML Frameworks Knowledge Bases & RAG
2.2K Github Stars
rag-time
Open Source

rag-time

# RAG Time: Ultimate Guide to Mastering RAG ![RAG Time Banner](./images/agenda-content.png) [![Calendar blockers](https://img.shields.io/badge/%F0%9F%93%86-add%20to%20calendar-blue?style=for-the-badge)](https://aka.ms/rag-time/calendar) [![GitHub watchers](https://img.shields.io/github/watchers/microsoft/rag-time.svg?style=social&label=Watch)](https://GitHub.com/microsoft/rag-time/watchers) [![GitHub forks](https://img.shields.io/github/forks/microsoft/rag-time.svg?style=social&label=Fork)](https://github.com/microsoft/rag-time/fork) [![GitHub stars](https://img.shields.io/github/stars/microsoft/rag-time?style=social&label=Star)](https://GitHub.com/microsoft/rag-time/stargazers) [![Azure AI Community Discord](https://dcbadge.vercel.app/api/server/ByRwuEEgH4)](https://discord.gg/REmjGvvFpW) [![Azure AI Foundry Developer Forum](https://img.shields.io/badge/GitHub-Azure_AI_Foundry_Developer_Forum-blue?style=for-the-badge&logo=github&color=000000&logoColor=fff)](https://aka.ms/foundry/forum) 🚀 Master RAG with RAG Time! Learn how to build smarter AI applications with Retrieval-Augmented Generation. This repo includes step-by-step guides, live coding samples, and expert insights—everything you need to go from beginner to RAG pro! **📺 All episodes of RAG Time are live! [Watch the full series now on YouTube.](https://aka.ms/rag-time/journeys)** ## 🤔 Why Learn RAG with RAG Time? - **Expert-Led** – Learn directly from AI & Microsoft experts. - **Future-Proof Your AI Skills** – Stay ahead with cutting-edge retrieval techniques. - **Exclusive Video Content** – Interviews with AI leaders, in-depth tech talks, and practical demonstrations. - **Sample Code** – Follow along with ready-to-use implementations and best practices. - **Doodles & Visual Explanations** – Complex concepts made simple with engaging visuals. ## 🚀 Get Started in 3 Easy Steps 1. [Fork](https://github.com/microsoft/rag-time/fork) the repository. 2. Clone the repository to your local machine: ```bash git clone https://github.com/your-org/rag-time.git cd rag-time ``` 3. Navigate to the Journey of your choice and follow the README Instructions. ## Learning Journeys RAG Time runs every **Wednesday at 9AM PT** from **March 5th to April 2nd**. Each journey covers unique topics with leadership insights, tech talks, and code samples | **Journey Page** | **Description** | **Video** | **Code Sample** | **Blog** | |------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------| | [RAG and Knowledge Retrieval Fundamentals](./Journey%201%20-%20RAG%20and%20Knowledge%20Retrieval%20Fundamentals/README.md) | Understand the strategic importance of RAG and knowledge retrieval | [Watch now](https://aka.ms/rag-time/journey1) | [Sample](./Journey%201%20-%20RAG%20and%20Knowledge%20Retrieval%20Fundamentals/sample/1-RAG-Fundamentals.ipynb) | [Journey 1](https://aka.ms/rag-time/journey1-blog) | | [Build the Ultimate Retrieval System](./Journey%202%20-%20Build%20the%20Ultimate%20Retrieval%20System%20for%20RAG/README.md) | Explore how Azure AI Search powers retrieval system | [Watch now](https://aka.ms/rag-time/journey2) | [Sample](./Journey%202%20-%20Build%20the%20Ultimate%20Retrieval%20System%20for%20RAG/sample/2-Build-The-Ultimate-Retrieval-System-For-RAG.ipynb) | [Journey 2](https://aka.ms/rag-time/journey2-blog) | | [Optimize Your Vector Index at Scale](./Journey%203%20-%20Optimize%20your%20Vector%20Index%20for%20Scale/README.md) | Learn real-world optimization techniques for scaling vector indexes | [Watch now](https://aka.ms/rag-time/journey3) | [Sample](./Journey%203%20-%20Optimize%20your%20Vector%20Index%20for%20Scale/sample/3-Vector-Compression.ipynb) | [Journey 3](https://aka.ms/rag-time/journey3-blog) | | [RAG for All Your Data](./Journey%204%20-%20RAG%20for%20All%20your%20Data%20Multimodal%20and%20Beyond/README.md) | Discover how multimodal data can be indexed and retrieved | [Watch now](https://aka.ms/rag-time/journey4) | [Sample](./Journey%204%20-%20RAG%20for%20All%20your%20Data%20Multimodal%20and%20Beyond/sample/README.md) | [Journey 4](https://aka.ms/rag-time/journey4-blog) | | [Hero Use-Cases for RAG](./Journey%205%20-%20Hero%20use%20cases%20for%20RAG/README.md) | Get inspired by hero use cases of RAG in action | [Watch now](https://aka.ms/rag-time/journey5) | [Sample](./Journey%205%20-%20Hero%20use%20cases%20for%20RAG/sample/README.md) | [Journey 5](https://aka.ms/rag-time/journey5-blog) | | [Agentic RAG](./Journey%20Bonus%20-%20Agentic%20RAG/README.md) | Learn about Agentic RAG an build your first Agentic RAG solution | [Ask your questions on Discord!](https://aka.ms/rag-time/discord) | [Sample](./Journey%20Bonus%20-%20Agentic%20RAG/sample/README.md) | [Bonus Journey](http://aka.ms/rag-time/bonusjourney-blog) | ### Content Release Schedule ![journeys weekly](./images/journeys-weekly.png) ## 🙏 Get Involved We'd love to see you contributing to our repo and engaging with the experts with your questions! - 🤔 Do you have suggestions or have you found spelling or code errors? [Raise an issue](https://github.com/microsoft/rag-time/issues) or [Create a pull request](https://github.com/microsoft/rag-time/pulls). - 🚀 If you get stuck or have any questions about RAG, join our [Azure AI Community Discord](https://discord.com/channels/1113626258182504448/1343540943533637663). ## Meet the RAG Time Speakers ![The Experts Behind RAG Time](./images/speakers.png) ## 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. ## 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). 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 is subject to those third parties' policies.

ML Frameworks Knowledge Bases & RAG
890 Github Stars
sql-ai-datathon
Open Source

sql-ai-datathon

The SQL AI Datathon Starter Repository is a guided learning platform designed to equip developers with skills for building AI-powered applications using Microsoft SQL. This comprehensive training program consists of four structured missions that progress from foundational concepts to full-stack application development. Participants will learn to create vector embeddings, implement semantic and hybrid search capabilities, deploy Data API Builder endpoints, and orchestrate Retrieval Augmented Generation agents using C or Python. The curriculum covers essential technologies such as SQL Server 2025 AI features, Azure SQL Database free tier resources, and intelligent application patterns. After mastering the four core missions, users are invited to submit an Open Hack project for evaluation by experts. Judging criteria include problem understanding, innovation, technical execution, and real-world impact. Successful completion and competition entry can qualify participants for awards including a ticket to SQLCon 20

Analytics & BI Vector Databases
24 Github Stars
AirSim
Open Source

AirSim

## Project AirSim announcement Microsoft and IAMAI collaborated to advance high-fidelity autonomy simulations through Project AirSim—the evolution of AirSim— released under the MIT license as part of a DARPA-supported initiative. IAMAI is proud to have contributed to these efforts and has published its version of the Project AirSim repository at [github.com/iamaisim/ProjectAirSim](https://github.com/iamaisim/ProjectAirSim). ## AirSim announcement: This repository will be archived in the coming year In 2017 Microsoft Research created AirSim as a simulation platform for AI research and experimentation. Over the span of five years, this research project has served its purpose—and gained a lot of ground—as a common way to share research code and test new ideas around aerial AI development and simulation. Additionally, time has yielded advancements in the way we apply technology to the real world, particularly through aerial mobility and autonomous systems. For example, drone delivery is no longer a sci-fi storyline—it’s a business reality, which means there are new needs to be met. We’ve learned a lot in the process, and we want to thank this community for your engagement along the way. In the spirit of forward momentum, we will be releasing a new simulation platform in the coming year and subsequently archiving the original 2017 AirSim. Users will still have access to the original AirSim code beyond that point, but no further updates will be made, effective immediately. Instead, we will focus our efforts on a new product, Microsoft Project AirSim, to meet the growing needs of the aerospace industry. Project AirSim will provide an end-to-end platform for safely developing and testing aerial autonomy through simulation. Users will benefit from the safety, code review, testing, advanced simulation, and AI capabilities that are uniquely available in a commercial product. As we get closer to the release of Project AirSim, there will be learning tools and features available to help you migrate to the new platform and to guide you through the product. To learn more about building aerial autonomy with the new Project AirSim, visit [https://aka.ms/projectairsim](https://aka.ms/projectairsim). # Welcome to AirSim AirSim is a simulator for drones, cars and more, built on [Unreal Engine](https://www.unrealengine.com/) (we now also have an experimental [Unity](https://unity3d.com/) release). It is open-source, cross platform, and supports software-in-the-loop simulation with popular flight controllers such as PX4 & ArduPilot and hardware-in-loop with PX4 for physically and visually realistic simulations. It is developed as an Unreal plugin that can simply be dropped into any Unreal environment. Similarly, we have an experimental release for a Unity plugin. Our goal is to develop AirSim as a platform for AI research to experiment with deep learning, computer vision and reinforcement learning algorithms for autonomous vehicles. For this purpose, AirSim also exposes APIs to retrieve data and control vehicles in a platform independent way. **Check out the quick 1.5 minute demo** Drones in AirSim [![AirSim Drone Demo Video](docs/images/demo_video.png)](https://youtu.be/-WfTr1-OBGQ) Cars in AirSim [![AirSim Car Demo Video](docs/images/car_demo_video.png)](https://youtu.be/gnz1X3UNM5Y) ## How to Get It ### Windows [![Build Status](https://github.com/microsoft/AirSim/actions/workflows/test_windows.yml/badge.svg)](https://github.com/microsoft/AirSim/actions/workflows/test_windows.yml) * [Download binaries](https://github.com/Microsoft/AirSim/releases) * [Build it](https://microsoft.github.io/AirSim/build_windows) ### Linux [![Build Status](https://github.com/microsoft/AirSim/actions/workflows/test_ubuntu.yml/badge.svg)](https://github.com/microsoft/AirSim/actions/workflows/test_ubuntu.yml) * [Download binaries](https://github.com/Microsoft/AirSim/releases) * [Build it](https://microsoft.github.io/AirSim/build_linux) ### macOS [![Build Status](https://github.com/microsoft/AirSim/actions/workflows/test_macos.yml/badge.svg)](https://github.com/microsoft/AirSim/actions/workflows/test_macos.yml) * [Build it](https://microsoft.github.io/AirSim/build_macos) For more details, see the [use precompiled binaries](docs/use_precompiled.md) document. ## How to Use It ### Documentation View our [detailed documentation](https://microsoft.github.io/AirSim/) on all aspects of AirSim. ### Manual drive If you have remote control (RC) as shown below, you can manually control the drone in the simulator. For cars, you can use arrow keys to drive manually. [More details](https://microsoft.github.io/AirSim/remote_control) ![record screenshot](docs/images/AirSimDroneManual.gif) ![record screenshot](docs/images/AirSimCarManual.gif) ### Programmatic control AirSim exposes APIs so you can interact with the vehicle in the simulation programmatically. You can use these APIs to retrieve images, get state, control the vehicle and so on. The APIs are exposed through the RPC, and are accessible via a variety of languages, including C++, Python, C# and Java. These APIs are also available as part of a separate, independent cross-platform library, so you can deploy them on a companion computer on your vehicle. This way you can write and test your code in the simulator, and later execute it on the real vehicles. Transfer learning and related research is one of our focus areas. Note that you can use [SimMode setting](https://microsoft.github.io/AirSim/settings#simmode) to specify the default vehicle or the new [ComputerVision mode](https://microsoft.github.io/AirSim/image_apis#computer-vision-mode-1) so you don't get prompted each time you start AirSim. [More details](https://microsoft.github.io/AirSim/apis) ### Gathering training data There are two ways you can generate training data from AirSim for deep learning. The easiest way is to simply press the record button in the lower right corner. This will start writing pose and images for each frame. The data logging code is pretty simple and you can modify it to your heart's content. ![record screenshot](docs/images/record_data.png) A better way to generate training data exactly the way you want is by accessing the APIs. This allows you to be in full control of how, what, where and when you want to log data. ### Computer Vision mode Yet another way to use AirSim is the so-called "Computer Vision" mode. In this mode, you don't have vehicles or physics. You can use the keyboard to move around the scene, or use APIs to position available cameras in any arbitrary pose, and collect images such as depth, disparity, surface normals or object segmentation. [More details](https://microsoft.github.io/AirSim/image_apis) ### Weather Effects Press F10 to see various options available for weather effects. You can also control the weather using [APIs](https://microsoft.github.io/AirSim/apis#weather-apis). Press F1 to see other options available. ![record screenshot](docs/images/weather_menu.png) ## Tutorials - [Video - Setting up AirSim with Pixhawk Tutorial](https://youtu.be/1oY8Qu5maQQ) by Chris Lovett - [Video - Using AirSim with Pixhawk Tutorial](https://youtu.be/HNWdYrtw3f0) by Chris Lovett - [Video - Using off-the-self environments with AirSim](https://www.youtube.com/watch?v=y09VbdQWvQY) by Jim Piavis - [Webinar - Harnessing high-fidelity simulation for autonomous systems](https://note.microsoft.com/MSR-Webinar-AirSim-Registration-On-Demand.html) by Sai Vemprala - [Reinforcement Learning with AirSim](https://microsoft.github.io/AirSim/reinforcement_learning) by Ashish Kapoor - [The Autonomous Driving Cookbook](https://aka.ms/AutonomousDrivingCookbook) by Microsoft Deep Learning and Robotics Garage Chapter - [Using TensorFlow for simple collision avoidance](https://github.com/simondlevy/AirSimTensorFlow) by Simon Levy and WLU team ## Participate ### Paper More technical details are available in [AirSim paper (FSR 2017 Conference)](https://arxiv.org/abs/1705.05065). Please cite this as: ``` @inproceedings{airsim2017fsr, author = {Shital Shah and Debadeepta Dey and Chris Lovett and Ashish Kapoor}, title = {AirSim: High-Fidelity Visual and Physical Simulation for Autonomous Vehicles}, year = {2017}, booktitle = {Field and Service Robotics}, eprint = {arXiv:1705.05065}, url = {https://arxiv.org/abs/1705.05065} } ``` ### Contribute Please take a look at [open issues](https://github.com/microsoft/airsim/issues) if you are looking for areas to contribute to. * [More on AirSim design](https://microsoft.github.io/AirSim/design) * [More on code structure](https://microsoft.github.io/AirSim/code_structure) * [Contribution Guidelines](CONTRIBUTING.md) ### Who is Using AirSim? We are maintaining a [list](https://microsoft.github.io/AirSim/who_is_using) of a few projects, people and groups that we are aware of. If you would like to be featured in this list please [make a request here](https://github.com/microsoft/airsim/issues). ## Contact Join our [GitHub Discussions group](https://github.com/microsoft/AirSim/discussions) to stay up to date or ask any questions. We also have an AirSim group on [Facebook](https://www.facebook.com/groups/1225832467530667/). ## What's New * [Cinematographic Camera](https://github.com/microsoft/AirSim/pull/3949) * [ROS2 wrapper](https://github.com/microsoft/AirSim/pull/3976) * [API to list all assets](https://github.com/microsoft/AirSim/pull/3940) * [movetoGPS API](https://github.com/microsoft/AirSim/pull/3746) * [Optical flow camera](https://github.com/microsoft/AirSim/pull/3938) * [simSetKinematics API](https://github.com/microsoft/AirSim/pull/4066) * [Dynamically set object textures from existing UE material or texture PNG](https://github.com/microsoft/AirSim/pull/3992) * [Ability to spawn/destroy lights and control light parameters](https://github.com/microsoft/AirSim/pull/3991) * [Support for multiple drones in Unity](https://github.com/microsoft/AirSim/pull/3128) * [Control manual camera speed through the keyboard](https://github.com/microsoft/AirSim/pulls?page=6&q=is%3Apr+is%3Aclosed+sort%3Aupdated-desc#:~:text=1-,Control%20manual%20camera%20speed%20through%20the%20keyboard,-%233221%20by%20saihv) For complete list of changes, view our [Changelog](docs/CHANGELOG.md) ## FAQ If you run into problems, check the [FAQ](https://microsoft.github.io/AirSim/faq) and feel free to post issues in the [AirSim](https://github.com/Microsoft/AirSim/issues) repository. ## Code of Conduct 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. ## License This project is released under the MIT License. Please review the [License file](LICENSE) for more details.

Game Development ML Frameworks
18.2K Github Stars
ailab
Open Source

ailab

# Microsoft AI Lab ## What is [AI Lab?](https://www.ailab.microsoft.com/experiments) AI Lab helps our large fast-growing community of developers get started on AI. You can experience, learn and code the latest and greatest innovations from Microsoft AI here. AI Lab currently houses eight projects that showcase the latest in custom vision, attnGAN, Visual Studio tools for AI, Cognitive Search, Machine Reading Comprehension and more. Each lab gives you access to the experimentation playground, source code on GitHub, a crisp developer-friendly video, and insights into the underlying developer/ organizational challenge and solution. <p align="center"> <img width="560" height="300" src="https://github.com/Microsoft/ailab/blob/master/images/AI Lab.png"> </p> AI Lab is developed in partnership with Microsoft’s AI School and the Microsoft Research (MSR) AI organization. # Microsoft AI Lab Projects - [Spektacom "Power Bat"](https://www.ailab.microsoft.com/experiments/ce508ed3-cea9-41eb-a08e-ab4727556f7b) - [Snip Insights](https://www.ailab.microsoft.com/experiments/32e85f94-3fdd-4a4b-b1ca-9f4cdf47feb6) - [Intelligent Robotics](https://www.ailab.microsoft.com/experiments/f508a96d-3255-474b-a769-d5b2cf2bb9d6) - [Sketch 2 Code](https://www.ailab.microsoft.com/experiments/30c61484-d081-4072-99d6-e132d362b99d) - [Build a bot](https://www.ailab.microsoft.com/experiments/1af37019-42f1-4a74-baa8-0ec847419c02) - [Drawing Bot](https://www.ailab.microsoft.com/experiments/1e9e1eef-2ab1-41f1-b341-0118f414bd78) - [JFK Files](https://www.ailab.microsoft.com/experiments/7d6b0652-51dc-440d-a12a-481f28525143) - [Drones](https://www.ailab.microsoft.com/experiments/92262b36-de2e-444e-86ca-8bcb8bd02454) - [Style Transfer](https://www.ailab.microsoft.com/experiments/99907c05-d487-450b-9ee9-901b40205e81) - [MRC](https://www.ailab.microsoft.com/experiments/ef90706b-e822-4686-bbc4-94fd0bca5fc5) # 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.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. label, 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. # License Licensed under the [MIT](LICENSE) License.

Education & Learning ML Frameworks
7.8K Github Stars
torchscale
Open Source

torchscale

# TorchScale - A Library of Foundation Architectures <p> <a href="https://github.com/microsoft/torchscale/blob/main/LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg" /></a> <a href="https://pypi.org/project/torchscale"><img alt="MIT License" src="https://badge.fury.io/py/torchscale.svg" /></a> </p> TorchScale is a PyTorch library that allows researchers and developers to scale up Transformers efficiently and effectively. Fundamental research to develop new architectures for foundation models and A(G)I, focusing on modeling generality and capability, as well as training stability and efficiency. - Stability - [**DeepNet**](https://arxiv.org/abs/2203.00555): scaling Transformers to 1,000 Layers and beyond - Generality - [**Foundation Transformers (Magneto)**](https://arxiv.org/abs/2210.06423): towards true general-purpose modeling across tasks and modalities (including language, vision, speech, and multimodal) - Capability - A [**Length-Extrapolatable**](https://arxiv.org/abs/2212.10554) Transformer - Efficiency - [**X-MoE**](https://arxiv.org/abs/2204.09179): scalable & finetunable sparse Mixture-of-Experts (MoE) ### The Revolution of Model Architecture - [**BitNet**](https://arxiv.org/abs/2310.11453): 1-bit Transformers for Large Language Models - [**RetNet**](https://arxiv.org/abs/2307.08621): Retentive Network: A Successor to Transformer for Large Language Models - [**LongNet**](https://arxiv.org/abs/2307.02486): Scaling Transformers to 1,000,000,000 Tokens ## News - December, 2023: [LongNet](torchscale/model/LongNet.py) and [LongViT](examples/longvit/README.md) released - October, 2023: Update RMSNorm and SwiGLU as the default module in RetNet - November, 2022: TorchScale 0.1.1 released [[Paper](https://arxiv.org/abs/2211.13184)] [[PyPI](https://pypi.org/project/torchscale/)] ## Installation To install: ``` pip install torchscale ``` Alternatively, you can develop it locally: ``` git clone https://github.com/microsoft/torchscale.git cd torchscale pip install -e . ``` For faster training install [Flash Attention](https://github.com/Dao-AILab/flash-attention) for Turing, Ampere, Ada, or Hopper GPUs: ``` pip install flash-attn ``` or [xFormers](https://github.com/facebookresearch/xformers) for Volta, Turing, Ampere, Ada, or Hopper GPUs: ``` # cuda 11.8 version pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu118 # cuda 12.1 version pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121 ``` ## Getting Started It takes only several lines of code to create a model with the above fundamental research features enabled. Here is how to quickly obtain a BERT-like encoder: ```python >>> from torchscale.architecture.config import EncoderConfig >>> from torchscale.architecture.encoder import Encoder >>> config = EncoderConfig(vocab_size=64000) >>> model = Encoder(config) >>> print(model) ``` We also support the `Decoder` architecture and the `EncoderDecoder` architecture: ```python # Creating a decoder model >>> from torchscale.architecture.config import DecoderConfig >>> from torchscale.architecture.decoder import Decoder >>> config = DecoderConfig(vocab_size=64000) >>> decoder = Decoder(config) >>> print(decoder) # Creating a encoder-decoder model >>> from torchscale.architecture.config import EncoderDecoderConfig >>> from torchscale.architecture.encoder_decoder import EncoderDecoder >>> config = EncoderDecoderConfig(vocab_size=64000) >>> encdec = EncoderDecoder(config) >>> print(encdec) ``` It takes only several lines of code to create a RetNet model: ```python # Creating a RetNet model >>> import torch >>> from torchscale.architecture.config import RetNetConfig >>> from torchscale.architecture.retnet import RetNetDecoder >>> config = RetNetConfig(vocab_size=64000) >>> retnet = RetNetDecoder(config) >>> print(retnet) ``` For LongNet models ([Flash Attention](https://github.com/Dao-AILab/flash-attention) required): ```python >>> import torch >>> from torchscale.architecture.config import EncoderConfig, DecoderConfig >>> from torchscale.model.longnet import LongNetEncoder, LongNetDecoder # Creating a LongNet encoder with the dilated pattern of segment_length=[2048,4096] and dilated_ratio=[1,2] >>> config = EncoderConfig(vocab_size=64000, segment_length='[2048,4096]', dilated_ratio='[1,2]', flash_attention=True) >>> longnet = LongNetEncoder(config) # Creating a LongNet decoder with the dilated pattern of segment_length=[2048,4096] and dilated_ratio=[1,2] >>> config = DecoderConfig(vocab_size=64000, segment_length='[2048,4096]', dilated_ratio='[1,2]', flash_attention=True) >>> longnet = LongNetDecoder(config) ``` ## Key Features - [DeepNorm to improve the training stability of Post-LayerNorm Transformers](https://arxiv.org/abs/2203.00555) * enabled by setting *deepnorm=True* in the `Config` class. * It adjusts both the residual connection and the initialization method according to the model architecture (i.e., encoder, decoder, or encoder-decoder). - [SubLN for the model generality and the training stability](https://arxiv.org/abs/2210.06423) * enabled by *subln=True*. This is enabled by default. * It introduces another LayerNorm to each sublayer and adjusts the initialization according to the model architecture. * Note that SubLN and DeepNorm cannot be used in one single model. - [X-MoE: efficient and finetunable sparse MoE modeling](https://arxiv.org/abs/2204.09179) * enabled by *use_xmoe=True*. * It replaces every *'moe_freq'* `FeedForwardNetwork` layers with the X-MoE layers. - [Multiway architecture for multimodality](https://arxiv.org/abs/2208.10442) * enabled by *multiway=True*. * It provides a pool of Transformer's parameters used for different modalities. - [Extrapolatable position embedding (Xpos)](https://arxiv.org/abs/2212.10554) * enabled by *xpos_rel_pos=True*. - [Relative position bias](https://arxiv.org/abs/1910.10683) * enabled by adjusting *rel_pos_buckets* and *max_rel_pos*. - [SparseClip: improving the gradient clipping for sparse MoE models](https://arxiv.org/abs/2211.13184) * we provide a [sample code](examples/fairseq/utils/sparse_clip.py) that can be easily adapted to the FairSeq (or other) repo. - [Retentive Network: A Successor to Transformer for Large Language Models](https://arxiv.org/abs/2307.08621) * created by `config = RetNetConfig(vocab_size=64000)` and `retnet = RetNetDecoder(config)`. - [LongNet: Scaling Transformers to 1,000,000,000 Tokens](https://arxiv.org/abs/2307.02486) Most of the features above can be used by simply passing the corresponding parameters to the config. For example: ```python >>> from torchscale.architecture.config import EncoderConfig >>> from torchscale.architecture.encoder import Encoder >>> config = EncoderConfig(vocab_size=64000, deepnorm=True, multiway=True) >>> model = Encoder(config) >>> print(model) ``` ## Examples We have examples of how to use TorchScale in the following scenarios/tasks: - Language * [Decoder/GPT](examples/fairseq/README.md#example-gpt-pretraining) * [Encoder-Decoder/Neural Machine Translation](examples/fairseq/README.md#example-machine-translation) * [Encoder/BERT](examples/fairseq/README.md#example-bert-pretraining) - Vision * [LongViT](examples/longvit/README.md) * ViT/BEiT [In progress] - Speech - Multimodal * [Multiway Transformers/BEiT-3](https://github.com/microsoft/unilm/tree/master/beit3) We plan to provide more examples regarding different tasks (e.g. vision pretraining and speech recognition) and various deep learning toolkits (e.g. [DeepSpeed](https://github.com/microsoft/DeepSpeed) and [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)). Any comments or PRs are welcome! ## Acknowledgments Some implementations in TorchScale are either adapted from or inspired by the [FairSeq](https://github.com/facebookresearch/fairseq) repository and the [UniLM](https://github.com/microsoft/unilm) repository. ## Citations If you find this repository useful, please consider citing our work: ``` @article{torchscale, author = {Shuming Ma and Hongyu Wang and Shaohan Huang and Wenhui Wang and Zewen Chi and Li Dong and Alon Benhaim and Barun Patra and Vishrav Chaudhary and Xia Song and Furu Wei}, title = {{TorchScale}: {Transformers} at Scale}, journal = {CoRR}, volume = {abs/2211.13184}, year = {2022} } ``` ``` @article{deepnet, author = {Hongyu Wang and Shuming Ma and Li Dong and Shaohan Huang and Dongdong Zhang and Furu Wei}, title = {{DeepNet}: Scaling {Transformers} to 1,000 Layers}, journal = {CoRR}, volume = {abs/2203.00555}, year = {2022}, } ``` ``` @article{magneto, author = {Hongyu Wang and Shuming Ma and Shaohan Huang and Li Dong and Wenhui Wang and Zhiliang Peng and Yu Wu and Payal Bajaj and Saksham Singhal and Alon Benhaim and Barun Patra and Zhun Liu and Vishrav Chaudhary and Xia Song and Furu Wei}, title = {Foundation {Transformers}}, journal = {CoRR}, volume = {abs/2210.06423}, year = {2022} } ``` ``` @inproceedings{xmoe, title={On the Representation Collapse of Sparse Mixture of Experts}, author={Zewen Chi and Li Dong and Shaohan Huang and Damai Dai and Shuming Ma and Barun Patra and Saksham Singhal and Payal Bajaj and Xia Song and Xian-Ling Mao and Heyan Huang and Furu Wei}, booktitle={Advances in Neural Information Processing Systems}, year={2022}, url={https://openreview.net/forum?id=mWaYC6CZf5} } ``` ``` @article{retnet, author={Yutao Sun and Li Dong and Shaohan Huang and Shuming Ma and Yuqing Xia and Jilong Xue and Jianyong Wang and Furu Wei}, title = {Retentive Network: A Successor to {Transformer} for Large Language Models}, journal = {ArXiv}, volume = {abs/2307.08621}, year = {2023} } ``` ``` @article{longnet, author={Jiayu Ding and Shuming Ma and Li Dong and Xingxing Zhang and Shaohan Huang and Wenhui Wang and Nanning Zheng and Furu Wei}, title = {{LongNet}: Scaling Transformers to 1,000,000,000 Tokens}, journal = {ArXiv}, volume = {abs/2307.02486}, year = {2023} } ``` ``` @article{longvit, title = {When an Image is Worth 1,024 x 1,024 Words: A Case Study in Computational Pathology}, author = {Wenhui Wang and Shuming Ma and Hanwen Xu and Naoto Usuyama and Jiayu Ding and Hoifung Poon and Furu Wei}, journal = {ArXiv}, volume = {abs/2312.03558}, year = {2023} } ``` ## 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 [Furu Wei](mailto:[email protected]) and [Shuming Ma](mailto:[email protected]) with any additional questions or comments. ## 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). 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 is subject to those third-party's policies.

ML Frameworks
3.1K Github Stars
Semi-supervised-learning
Open Source

Semi-supervised-learning

<div id="top"></div> <!-- *** Thanks for checking out the Best-README-Template. If you have a suggestion *** that would make this better, please fork the repo and create a pull request *** or simply open an issue with the tag "enhancement". *** Don't forget to give the project a star! *** Thanks again! Now go create something AMAZING! :D --> <!-- PROJECT SHIELDS --> <!-- *** I'm using markdown "reference style" links for readability. *** Reference links are enclosed in brackets [ ] instead of parentheses ( ). *** See the bottom of this document for the declaration of the reference variables *** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use. *** https://www.markdownguide.org/basic-syntax/#reference-style-links --> [![Contributors][contributors-shield]][contributors-url] [![Forks][forks-shield]][forks-url] [![Stargazers][stars-shield]][stars-url] [![Issues][issues-shield]][issues-url] <!-- ***[![MIT License][license-shield]][license-url] --> <!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/microsoft/Semi-supervised-learning"> <img src="figures/logo.png" alt="Logo" width="400"> </a> <!-- <h3 align="center">USB</h3> --> <p align="center"> <strong>USB</strong>: A Unified Semi-supervised learning Benchmark for CV, NLP, and Audio Classification <!-- <br /> <a href="https://github.com/microsoft/Semi-supervised-learning"><strong>Explore the docs »</strong></a> <br /> --> <br /> <a href="https://arxiv.org/abs/2208.07204">Paper</a> · <a href="https://github.com/microsoft/Semi-supervised-learning/tree/main/results">Benchmark</a> · <a href="https://colab.research.google.com/drive/1lFygK31jWyTH88ktao6Ow-5nny5-B7v5">Demo</a> · <a href="https://usb.readthedocs.io/en/main/">Docs</a> · <a href="https://github.com/microsoft/Semi-supervised-learning/issues">Issue</a> · <a href="https://www.microsoft.com/en-us/research/lab/microsoft-research-asia/articles/pushing-the-limit-of-semi-supervised-learning-with-the-unified-semi-supervised-learning-benchmark/">Blog</a> · <a href="https://medium.com/p/849f42bbc32a">Blog (Pytorch)</a> · <a href="https://zhuanlan.zhihu.com/p/566055279">Blog (Chinese)</a> · <a href="https://nips.cc/virtual/2022/poster/55710">Video</a> · <a href="https://www.bilibili.com/video/av474982872/">Video (Chinese)</a> </p> </div> <!-- TABLE OF CONTENTS --> <details> <summary>Table of Contents</summary> <ol> <li><a href="#news-and-updates">News and Updates</a></li> <li><a href="#intro">Introduction</a></li> <li> <a href="#getting-started">Getting Started</a> <ul> <li><a href="#prerequisites">Prerequisites</a></li> <li><a href="#installation">Installation</a></li> </ul> </li> <li><a href="#usage">Usage</a></li> <li><a href="#benchmark-results">Benchmark Results</a></li> <li><a href="#model-zoo">Model Zoo</a></li> <li><a href="#contributing">Community</a></li> <li><a href="#license">License</a></li> <li><a href="#acknowledgments">Acknowledgments</a></li> </ol> </details> <!-- News and Updates --> ## News and Updates - [03/16/2024] Add [EPASS](https://openaccess.thecvf.com/content/WACV2024/html/Nguyen_Debiasing_Calibrating_and_Improving_Semi-Supervised_Learning_Performance_via_Simple_Ensemble_WACV_2024_paper), [SequenceMatch](https://openaccess.thecvf.com/content/WACV2024/html/Nguyen_SequenceMatch_Revisiting_the_Design_of_Weak-Strong_Augmentations_for_Semi-Supervised_Learning_WACV_2024_paper), and [ReFixMatch](https://openaccess.thecvf.com/content/ICCV2023W/LIMIT/html/Nguyen_Boosting_Semi-Supervised_Learning_by_Bridging_high_and_low-Confidence_Predictions_ICCVW_2023_paper). Fixed some typos. - [07/07/2023] Add [DeFixmatch](https://arxiv.org/abs/2203.07512). Fixed some bugs. Release semilearn=0.3.1/ - [06/01/2023] USB has officially joined the Pytorch ecosystem! [[Pytorch blog](https://medium.com/p/849f42bbc32a)] - [01/30/2023] Update semilearn==0.3.0. Add [FreeMatch](https://arxiv.org/abs/2205.07246) and [SoftMatch](https://arxiv.org/abs/2301.10921). Add imbalanced algorithms. Update results and add wandb support. Refer [CHANGE_LOG](CHANGE_LOG.md) for details. [[Results]](https://github.com/microsoft/Semi-supervised-learning/tree/main/results)[[Logs]](https://drive.google.com/drive/folders/1bRSqrRyyuDafgOI3VAuqqiuzHG6CexHF?usp=sharing)[[Wandb]](https://wandb.ai/usb). Older classic logs can be found here: [[TorchSSL Log]](https://1drv.ms/u/s!AlpW9hcyb0KvmyCfsCjGvhDXG5Nb?e=Xc6amH). - [10/16/2022] Dataset download link and process instructions released! [[Datasets](https://github.com/microsoft/Semi-supervised-learning/tree/main/preprocess)] - [10/13/2022] We have finished the camera ready version with updated [[Results](https://github.com/microsoft/Semi-supervised-learning/tree/main/results)]. [[Openreview](https://openreview.net/forum?id=QeuwINa96C)] - [10/06/2022] Training logs and results of USB has been updated! Available dataset will be uploaded soon. [[Logs](https://drive.google.com/drive/folders/1fg3Fxem_UNWhfN5-4x2lRI3mluGxqD4N?usp=sharing)] [[Results](https://github.com/microsoft/Semi-supervised-learning/tree/main/results)] - [09/17/2022] The USB paper has been accepted by NeurIPS 2022 Dataset and Benchmark Track! [[Openreview](https://openreview.net/forum?id=QeuwINa96C)] - [08/21/2022] USB has been released! <!-- Introduction --> ## Introduction **USB** is a Pytorch-based Python package for Semi-Supervised Learning (SSL). It is easy-to-use/extend, *affordable* to small groups, and comprehensive for developing and evaluating SSL algorithms. USB provides the implementation of 14 SSL algorithms based on Consistency Regularization, and 15 tasks for evaluation from CV, NLP, and Audio domain. ![Code Structure](./figures/code.png) <p align="right">(<a href="#top">back to top</a>)</p> <!-- GETTING STARTED --> ## Getting Started This is an example of how to set up USB locally. To get a local copy up, running follow these simple example steps. ### Prerequisites USB is built on pytorch, with torchvision, torchaudio, and transformers. To install the required packages, you can create a conda environment: ```sh conda create --name usb python=3.8 ``` then use pip to install required packages: ```sh pip install -r requirements.txt ``` From now on, you can start use USB by typing ```sh python train.py --c config/usb_cv/fixmatch/fixmatch_cifar100_200_0.yaml ``` ### Installation We provide a Python package *semilearn* of USB for users who want to start training/testing the supported SSL algorithms on their data quickly: ```sh pip install semilearn ``` <p align="right">(<a href="#top">back to top</a>)</p> ### Development You can also develop your own SSL algorithm and evaluate it by cloning USB: ```sh git clone https://github.com/microsoft/Semi-supervised-learning.git ``` <p align="right">(<a href="#top">back to top</a>)</p> ### Prepare Datasets The detailed instructions for downloading and processing are shown in [Dataset Download](./preprocess/). Please follow it to download datasets before running or developing algorithms. <p align="right">(<a href="#top">back to top</a>)</p> <!-- USAGE EXAMPLES --> ## Usage USB is easy to use and extend. Going through the bellowing examples will help you familiar with USB for quick use, evaluate an existing SSL algorithm on your own dataset, or developing new SSL algorithms. ### Quick Start with USB package <!-- TODO: add quick start example and refer lighting notebook --> Please see [Installation](#installation) to install USB first. We provide colab tutorials for: - [Beginning example](https://colab.research.google.com/drive/1lFygK31jWyTH88ktao6Ow-5nny5-B7v5) - [Customize datasets](https://colab.research.google.com/drive/1zbswPm1sM8j0fndUQOeqX2HADdYq-wOw) ### Start with Docker **Step1: Check your environment** You need to properly install Docker and nvidia driver first. To use GPU in a docker container You also need to install nvidia-docker2 ([Installation Guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker)). Then, Please check your CUDA version via `nvidia-smi` **Step2: Clone the project** ```shell git clone https://github.com/microsoft/Semi-supervised-learning.git ``` **Step3: Build the Docker image** Before building the image, you may modify the [Dockerfile](Dockerfile) according to your CUDA version. The CUDA version we use is 11.6. You can change the base image tag according to [this site](https://hub.docker.com/r/nvidia/cuda/tags). You also need to change the `--extra-index-url` according to your CUDA version in order to install the correct version of Pytorch. You can check the url through [Pytorch website](https://pytorch.org). Use this command to build the image ```shell cd Semi-supervised-learning && docker build -t semilearn . ``` Job done. You can use the image you just built for your own project. Don't forget to use the argument `--gpu` when you want to use GPU in a container. ### Training Here is an example to train FixMatch on CIFAR-100 with 200 labels. Training other supported algorithms (on other datasets with different label settings) can be specified by a config file: ```sh python train.py --c config/usb_cv/fixmatch/fixmatch_cifar100_200_0.yaml ``` ### Evaluation After training, you can check the evaluation performance on training logs, or running evaluation script: ``` python eval.py --dataset cifar100 --num_classes 100 --load_path /PATH/TO/CHECKPOINT ``` ### Develop Check the developing documentation for creating your own SSL algorithm! _For more examples, please refer to the [Documentation](https://example.com)_ <p align="right">(<a href="#top">back to top</a>)</p> <!-- BENCHMARK RESULTS --> ## Benchmark Results Please refer to [Results](./results) for benchmark results on different tasks. <p align="right">(<a href="#top">back to top</a>)</p> <!-- MODEL ZOO --> ## Model Zoo TODO: add pre-trained models. <p align="right">(<a href="#top">back to top</a>)</p> <!-- ROADMAP --> ## TODO - [ ] Finish Readme - [ ] Updating SUPPORT.MD with content about this project's support experience - [ ] Multi-language Support - [ ] Chinese See the [open issues](https://github.com/microsoft/Semi-supervised-learning/issues) for a full list of proposed features (and known issues). <p align="right">(<a href="#top">back to top</a>)</p> <!-- CONTRIBUTING --> ## 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. If you have a suggestion that would make USB better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again! 1. Fork the project 2. Create your branch (`git checkout -b your_name/your_branch`) 3. Commit your changes (`git commit -m 'Add some features'`) 4. Push to the branch (`git push origin your_name/your_branch`) 5. Open a Pull Request <p align="right">(<a href="#top">back to top</a>)</p> <!-- TRADEMARKS --> ## 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&#39;s Trademark &amp; Brand Guidelines](https://www.microsoft.com/en-us/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. <!-- LICENSE --> ## License Distributed under the MIT License. See `LICENSE.txt` for more information. <p align="right">(<a href="#top">back to top</a>)</p> <!-- CONTACT --> ## Community and Contact The USB community is maintained by: - Yidong Wang ([email protected]), Tokyo Institute of Technology - Hao Chen ([email protected]), Carnegie Mellon University - Yue Fan ([email protected]), Max Planck Institute for Informatics - Wenxin Hou ([email protected]), Microsoft STCA - Ran Tao ([email protected]), Carnegie Mellon University - Jindong Wang ([email protected]), Microsoft Research Asia <p align="right">(<a href="#top">back to top</a>)</p> <!-- CITE --> ## Citing USB Please cite us if you fine this project helpful for your project/paper: ``` @inproceedings{usb2022, doi = {10.48550/ARXIV.2208.07204}, url = {https://arxiv.org/abs/2208.07204}, author = {Wang, Yidong and Chen, Hao and Fan, Yue and Sun, Wang and Tao, Ran and Hou, Wenxin and Wang, Renjie and Yang, Linyi and Zhou, Zhi and Guo, Lan-Zhe and Qi, Heli and Wu, Zhen and Li, Yu-Feng and Nakamura, Satoshi and Ye, Wei and Savvides, Marios and Raj, Bhiksha and Shinozaki, Takahiro and Schiele, Bernt and Wang, Jindong and Xie, Xing and Zhang, Yue}, title = {USB: A Unified Semi-supervised Learning Benchmark for Classification}, booktitle = {Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track}, year = {2022} } @article{wang2023freematch, title={FreeMatch: Self-adaptive Thresholding for Semi-supervised Learning}, author={Wang, Yidong and Chen, Hao and Heng, Qiang and Hou, Wenxin and Fan, Yue and and Wu, Zhen and Wang, Jindong and Savvides, Marios and Shinozaki, Takahiro and Raj, Bhiksha and Schiele, Bernt and Xie, Xing}, booktitle={International Conference on Learning Representations (ICLR)}, year={2023} } @article{chen2023softmatch, title={SoftMatch: Addressing the Quantity-Quality Trade-off in Semi-supervised Learning}, author={Chen, Hao and Tao, Ran and Fan, Yue and Wang, Yidong and Wang, Jindong and Schiele, Bernt and Xie, Xing and Raj, Bhiksha and Savvides, Marios}, booktitle={International Conference on Learning Representations (ICLR)}, year={2023} } @article{zhang2021flexmatch, title={FlexMatch: Boosting Semi-supervised Learning with Curriculum Pseudo Labeling}, author={Zhang, Bowen and Wang, Yidong and Hou, Wenxin and Wu, Hao and Wang, Jindong and Okumura, Manabu and Shinozaki, Takahiro}, booktitle={Neural Information Processing Systems (NeurIPS)}, year={2021} } ``` <!-- ACKNOWLEDGMENTS --> ## Acknowledgments We thanks the following projects for reference of creating USB: - [TorchSSL](https://github.com/TorchSSL/TorchSSL) - [FixMatch](https://github.com/google-research/fixmatch) - [CoMatch](https://github.com/salesforce/CoMatch) - [SimMatch](https://github.com/KyleZheng1997/simmatch) - [HuggingFace](https://huggingface.co/docs/transformers/index) - [Pytorch Lighting](https://github.com/Lightning-AI/lightning) - [README Template](https://github.com/othneildrew/Best-README-Template) <p align="right">(<a href="#top">back to top</a>)</p> <!-- MARKDOWN LINKS & IMAGES --> <!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --> [contributors-shield]: https://img.shields.io/github/contributors/microsoft/Semi-supervised-learning.svg?style=for-the-badge [contributors-url]: https://github.com/microsoft/Semi-supervised-learning/graphs/contributors [forks-shield]: https://img.shields.io/github/forks/microsoft/Semi-supervised-learning.svg?style=for-the-badge [forks-url]: https://github.com/microsoft/Semi-supervised-learning/network/members [stars-shield]: https://img.shields.io/github/stars/microsoft/Semi-supervised-learning.svg?style=for-the-badge [stars-url]: https://github.com/microsoft/Semi-supervised-learning/stargazers [issues-shield]: https://img.shields.io/github/issues/microsoft/Semi-supervised-learning.svg?style=for-the-badge [issues-url]: https://github.com/microsoft/Semi-supervised-learning/issues [license-shield]: https://img.shields.io/github/license/microsoft/Semi-supervised-learning.svg?style=for-the-badge [license-url]: https://github.com/microsoft/Semi-supervised-learning/blob/main/LICENSE.txt

ML Frameworks
1.6K Github Stars
Biodiversity
Open Source

Biodiversity

![A colorful banner illustrating various species of animals and plants in a natural environment, symbolizing biodiversity and the use of AI for conservation purposes.](https://zenodo.org/records/20044680/files/Biodiversity_Banner.png) # Microsoft Biodiversity **Open-source AI for biodiversity monitoring and conservation.** Microsoft AI for Good Lab — camera-trap detection, bioacoustic analysis, species classification, field deployment. <div align="center"> <font size="6"> Open-source AI for camera traps, bioacoustics, and wildlife monitoring </font> <br> <hr> <a href="https://github.com/microsoft/Biodiversity/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue" /></a> <a href="https://discord.gg/TeEVxzaYtm"><img src="https://img.shields.io/badge/Discord-Join_us-5865F2?logo=discord&logoColor=white" /></a> <a href="https://microsoft.github.io/Biodiversity/"><img src="https://img.shields.io/badge/Docs-526CFE?logo=MaterialForMkDocs&logoColor=white" /></a> <a href="https://pypi.org/project/PytorchWildlife"><img src="https://static.pepy.tech/badge/pytorchwildlife" /></a> <a href="https://huggingface.co/spaces/ai-for-good-lab/pytorch-wildlife"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Demo-blue" /></a> <a href="https://colab.research.google.com/drive/1rjqHrTMzEHkMualr4vB55dQWCsCKMNXi?usp=sharing"><img src="https://img.shields.io/badge/Colab-Demo-blue?logo=GoogleColab" /></a> <br><br> </div> ## 📣 Announcements ### What we've been up to Our journey started with **MegaDetector** — a camera-trap animal detection model that became a widely adopted tool in the conservation community. Building on that foundation, we created **PyTorch-Wildlife** as a unified platform to host all of our AI for biodiversity work, bringing together detection, classification, and eventually much more. Over time, our scope grew well beyond camera-trap imagery. We now have active work in bioacoustics, overhead animal detection, and edge computing for remote field deployments. As the ecosystem expanded, it became clear that keeping everything inside a single repository was working against us. Code was harder to find, harder to maintain, and harder to extend. So we made a deliberate decision: break the work into focused, dedicated repositories — one per project — where the code in each repo is concentrated, the ownership is clear, and future contributors know exactly where to go. This repository is the hub that ties them together. PyTorch-Wildlife now lives at [microsoft/Pytorch-Wildlife](https://github.com/microsoft/Pytorch-Wildlife), MegaDetector at [microsoft/MegaDetector](https://github.com/microsoft/MegaDetector), and everything else is linked in the table below. #### Previous versions: - [Release notes](https://microsoft.github.io/Biodiversity/releases/release_notes/) ## Projects | Repo | What it is | |---|---| | [microsoft/MegaDetector](https://github.com/microsoft/MegaDetector) | AI model for detecting animals, people, and vehicles in camera-trap imagery — where it all started ([documentation](https://microsoft.github.io/MegaDetector/)) | | [microsoft/MegaDetector-Acoustic](https://github.com/microsoft/MegaDetector-Acoustic) | Bioacoustic AI for biodiversity monitoring — audio classification and species identification from sound | | [microsoft/MegaDetector-Classifier](https://github.com/microsoft/MegaDetector-Classifier) | Camera-trap species classification fine-tuning — adapt classifiers to your own datasets and geographic regions | | [microsoft/MegaDetector-Overhead](https://github.com/microsoft/MegaDetector-Overhead) | Overhead imagery detection — point-based wildlife localization from aerial views | | [microsoft/MegaDetector-Sonar](https://github.com/microsoft/MegaDetector-Sonar) | Sonar-based wildlife detection — processing and feature detection in sidescan sonar imagery | | [microsoft/Pytorch-Wildlife](https://github.com/microsoft/Pytorch-Wildlife) | The collaborative deep learning framework and model zoo for conservation AI | | [microsoft/SPARROW](https://github.com/microsoft/SPARROW) | Solar-Powered Acoustic and Remote Recording Observation Watch — AI edge device for remote field deployments | ## Cite us When citing work that uses any of the repositories under this umbrella, please cite: - **Hernandez et al. 2024** — *Pytorch-Wildlife: A Collaborative Deep Learning Framework for Conservation* — for any use of the PyTorch-Wildlife framework or models accessed through it - **Beery, Morris, Yang 2019** — *Efficient Pipeline for Camera Trap Image Review* — for any use of MegaDetector specifically A `citation.cff` file is included in this repository for automated citation tools. ## Contributing We welcome community contributions. See our [Contribution Guidelines](https://microsoft.github.io/Biodiversity/contribute/#how-to-participate) for how to participate. ## Community Have questions or want to connect with the team? Join us on Discord: [![Discord](https://img.shields.io/badge/Discord-Join_us-5865F2?logo=discord&logoColor=white)](https://discord.gg/TeEVxzaYtm) A list of organizations using MegaDetector across global conservation work — six years of partnerships, from national parks to research universities to NGOs — is maintained on the [microsoft/MegaDetector](https://github.com/microsoft/MegaDetector) repository. >[!IMPORTANT] >If you would like to be added to this list or have any questions regarding MegaDetector and PyTorch-Wildlife, please [email us]([email protected]) or join us in our Discord channel: [![](https://img.shields.io/badge/any_text-Join_us!-blue?logo=discord&label=PytorchWildife)](https://discord.gg/TeEVxzaYtm) ## About Maintained by [Microsoft AI for Good Lab](https://www.microsoft.com/en-us/research/group/ai-for-good-research-lab/).

AI & Machine Learning ML Frameworks
1K Github Stars
MLOpsPython
Open Source

MLOpsPython

--- page_type: sample languages: - python products: - azure - azure-machine-learning-service - azure-devops description: "Code which demonstrates how to set up and operationalize an MLOps flow leveraging Azure Machine Learning and Azure DevOps." --- # MLOps with Azure ML CI: [![Build Status](https://aidemos.visualstudio.com/MLOps/_apis/build/status/Model-Train-Register-CI?branchName=master)](https://aidemos.visualstudio.com/MLOps/_build/latest?definitionId=160&branchName=master) CD: [![Build Status](https://aidemos.visualstudio.com/MLOps/_apis/build/status/microsoft.MLOpsPython-CD?branchName=master)](https://aidemos.visualstudio.com/MLOps/_build/latest?definitionId=161&branchName=master) MLOps will help you to understand how to build a Continuous Integration and Continuous Delivery pipeline for an ML/AI project. We will be using the Azure DevOps Project for build and release/deployment pipelines along with Azure ML services for model retraining pipeline, model management and operationalization. ![ML lifecycle](/docs/images/ml-lifecycle.png) This template contains code and pipeline definitions for a machine learning project that demonstrates how to automate an end to end ML/AI workflow. ## Architecture and Features Architecture Reference: [Machine learning operationalization (MLOps) for Python models using Azure Machine Learning](https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/ai/mlops-python) This reference architecture shows how to implement continuous integration (CI), continuous delivery (CD), and retraining pipeline for an AI application using Azure DevOps and [Azure Machine Learning](/azure/machine-learning/service/overview-what-is-azure-ml). The solution is built on the scikit-learn diabetes dataset but can be easily adapted for any AI scenario and other popular build systems such as Jenkins and Travis. The build pipelines include DevOps tasks for data sanity tests, unit tests, model training on different compute targets, model version management, model evaluation/model selection, model deployment as realtime web service, staged deployment to QA/prod and integration testing. ## Prerequisite - Active Azure subscription - At least contributor access to Azure subscription ## Getting Started To deploy this solution in your subscription, follow the manual instructions in the [getting started](docs/getting_started.md) doc. Then optionally follow the guide for [integrating your own code](docs/custom_model.md) with this repository template. ### Repo Details You can find the details of the code and scripts in the repository [here](/docs/code_description.md) ### References - [Azure Machine Learning (Azure ML) Service Workspace](https://docs.microsoft.com/en-us/azure/machine-learning/service/overview-what-is-azure-ml) - [Azure ML CLI](https://docs.microsoft.com/en-us/azure/machine-learning/service/reference-azure-machine-learning-cli) - [Azure ML Samples](https://docs.microsoft.com/en-us/azure/machine-learning/service/samples-notebooks) - [Azure ML Python SDK Quickstart](https://docs.microsoft.com/en-us/azure/machine-learning/service/quickstart-create-workspace-with-python) - [Azure DevOps](https://docs.microsoft.com/en-us/azure/devops/?view=vsts) ## 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.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., label, 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.

ML Frameworks CI / CD
1.3K Github Stars
genaiops-promptflow-template
Open Source

genaiops-promptflow-template

# LLMOps with Prompt flow (Supports both AI Studio and Azure Machine Learning) - `This template can be used for both Azure AI Studio and Azure Machine Learning.` - `It can be used for both AZURE and LOCAL execution.` - `It supports all types of flow - python Class flows, Function flows and YAML flows.` - `It supports Github, Azure DevOps and Jenkins CI/CD orchestration.` - `It supports pure python based Evaluation as well using promptflow-evals package.` - `It should be used for INNER-LOOP Experimentation and Evaluation.` - `It should be used for OUTER-LOOP Deployment and Inferencing.` `NOTE: A new FAQ section is added to help Engineers, Data Scientist and developers find answers to general questions on configuring and using this template.` [***FAQS HERE***](./docs/faqs.md) Large Language Model Operations, or LLMOps, has become the cornerstone of efficient prompt engineering and LLM induced application development and deployment. As the demand for LLM induced applications continues to soar, organizations find themselves in need of a cohesive and streamlined process to manage their end-to-end lifecycle. The rise of AI and large language models (LLMs) has transformed various industries, enabling the development of innovative applications with human-like text understanding and generation capabilities. This revolution has opened up new possibilities across fields such as customer service, content creation, and data analysis. As LLMs rapidly evolve, the importance of Prompt Engineering becomes increasingly evident. Prompt Engineering plays a crucial role in harnessing the full potential of LLMs by creating effective prompts that cater to specific business scenarios. This process enables developers to create tailored AI solutions, making AI more accessible and useful to a broader audience. It is an experimentation and evaluation framework for Prompt Flow. It is just not CI/CD pipelines for Prompt Flow, although it supports it. It has rich set of features for experimentation, evaluation, deployment and monitoring of Prompt Flow. It is a complete end-to-end solution for Prompt Flow operationalization. The template supports both Azure AI Studio as well as Azure Machine Learning. Depending on the configuration, the template can be used for both Azure AI Studio and Azure Machine Learning. It provides a seamless migration experience for experimentation, evaluation and deployment of Prompt Flow across services. This template supports different types of flows, allowing you to define and execute workflows based on your specific requirements. The two main flow types supported are: - Flexible Flows - Function based flows (python functions) - Class based flows (python classes) - Directed Acyclic Graph (DAG) Flows - YAML based flows One of the powerful features of this project is its ability to automatically detect the flow type and execute the flow accordingly. This allows you to experiment with different flow types and choose the one that best suits your needs. This template supports: - Local invocation and execution of flows for experimentation and evaluation locally. - Local invocation but execution of flows for experimentation and evaluation on Azure. - Pipeline based invocation but execution of flows for experimentation and evaluation on Azure. - Pipeline based invocation and execution of flows for experimentation and evaluation on Build Server. - Deployment of all types of flows to Kubernetes, Azure Web Apps and AML/AI Studio Managed compute. # Challenges in LLMOps - Managing Large Language based flows, from local experimentation to production deployment, has been far from straightforward and isn't a one-size-fits-all task. - Each flow has its unique lifecycle, from initial experimentation to deployment, and each stage presents its own set of challenges. - Organizations often deal with multiple flows concurrently, each with its objectives, requirements, and complexities. This can quickly become overwhelming without proper management tools. - It involves handling multiple flows, their unique lifecycles, experimentation with various configurations, and ensuring smooth deployments. # Context - LLM-infused applications are designed to understand and generate human-like text based on the input they receive. They comprise of prompts that need engineering cadence and rigour. - Prompt flow is a powerful feature that simplifies and streamlines the Prompt Engineering process for LLM-infused applications. It enables users to create, evaluate, and deploy high-quality flows with ease and efficiency. - How do we best augment LLM-infused applications with LLMOps and engineering rigour? This template aims to assist in the development of those types of applications using Prompt flow and LLMOps. - Bringing discipline to the data preparation for LLM app development by following DataOps best practices. # Solution That's where **LLMOps with Prompt flow** comes in. LLMOps with Prompt flow is a "LLMOps template and guidance" to help you build LLM-infused apps using Prompt flow. It provides the following features: - **Centralized Code Hosting:** This repo supports hosting code for multiple flows based on prompt flow, providing a single repository for all your flows. Think of this platform as a single repository where all your prompt flow code resides. It's like a library for your flows, making it easy to find, access, and collaborate on different projects. - **Lifecycle Management:** Each flow enjoys its own lifecycle, allowing for smooth transitions from local experimentation to production deployment. - **Variant and Hyperparameter Experimentation:** Experiment with multiple variants and hyperparameters, evaluating flow variants with ease. Variants and hyperparameters are like ingredients in a recipe. This platform allows you to experiment with different combinations of variants across multiple nodes in a flow. - **A/B Deployment:** Seamlessly implement A/B deployments, enabling you to compare different flow versions effortlessly. Just as in traditional A/B testing for websites, this platform facilitates A/B deployment for prompt flow flows. This means you can effortlessly compare different versions of a flow in a real-world setting to determine which performs best. - **Many-to-many dataset/flow relationships:** Accommodate multiple datasets for each standard and evaluation flow, ensuring versatility in flow test and evaluation. The platform is designed to accommodate multiple datasets for each flow. - **Multiple Deployment Targets:** The repo supports deployment of flows to Kubernetes and Azure Managed computes driven through configuration ensuring that your flows can scale as needed. - **Comprehensive Reporting:** Generate detailed reports for each variant configuration, allowing you to make informed decisions. Provides detailed metric collection for all variant bulk runs and experiments, enabling data-driven decisions in csv as well as HTML files. - Offers BYOF (bring-your-own-flows). A **complete platform** for developing multiple use-cases related to LLM-infused applications. - Offers **configuration** based development. No need to write extensive boiler-plate code. - Provides execution of both **prompt experimentation and evaluation** locally as well on cloud. - Provides **notebooks for local evaluation** of the prompts. Provides library of functions for local experimentation. - Endpoint testing within pipeline after deployment to check its availability and readiness. - Provides optional Human-in-loop to validate prompt metrics before deployment. LLMOps with Prompt flow provides capabilities for both simple as well as complex LLM-infused apps. It is completely customizable to the needs of the application. # Folder structure Each use case (set of Prompt flow standard and evaluation flows) should follow the folder structure as shown here: - .azure-pipelines : It contains the CI and PR related pipelines for Azure DevOps and specific to a use-case - configs : It contains the configuration files for the use-case deployment - data : This folder contains data files related to Prompt flow standard and evaluation flow - environment : It contains a dockerfile used for running containers with flows for inferencing on Azure webapps and env.yml for declaring app specific environment variables. - flows : It should contain minimally two folder - one for standard Prompt flow related files and another for Evaluation flow related file. There can be multiple evaluation flow related folders. - tests : contains unit tests for the flows - data-pipelines : It contains the data pipelines to generate the datasets (experimentation, evaluation etc.) necessary for the flows. This folder will have sub-folders specific to the data engineering tool - Microsoft Fabric, Azure ML etc. Additionally, there is a `experiment.yaml` file that configures the use-case (see file [description](./docs/the_experiment_file.md) and [specs](./docs/experiment.yaml) for more details). There is also a sample-request.json file containing test data for testing endpoints after deployment. - The '.azure-pipelines' folder contains the common Azure DevOps pipelines for the platform and any changes to them will impact execution of all the flows. - The '.github' folder contains the Github workflows for the platform as well as the use-cases. This is bit different than Azure DevOps because all Github workflows should be within this single folder for execution. - The '.jenkins' folder contains the Jenkins declarative pipelines for the platform as well as the use-cases and individual jobs. - The 'docs' folder contains documentation for step-by-step guides for both Azure DevOps, Github Workflow and Jenkins related configuration. - The 'llmops' folder contains all the code related to flow execution, evaluation and deployment. - The 'dataops' folder contains all the code related to data pipeline deployment. - The 'local_execution' folder contains python scripts for executing both the standard and evaluation flow locally. # Use Cases The project includes 6 examples demonstrating different scenarios: - Web Classification (YAML-based) Location: ./web_classification Importance: Demonstrates website content summarization with multiple variants, showcasing the flexibility and customization options available in the template. - Named Entity Recognition (YAML-based) Location: ./named_entity_recognition Importance: Showcases the extraction of named entities from text, which is valuable for various natural language processing tasks and information extraction. - Math Coding (YAML-based) Location: ./math_coding Importance: Showcases the ability to perform mathematical calculations and generate code snippets, highlighting the versatility of the template in handling computational tasks. - Chat with PDF (YAML-based, RAG-based) Location: ./chat_with_pdf Importance: Demonstrates a conversational interface for interacting with PDF documents, leveraging the power of retrieval-augmented generation (RAG) to provide accurate and relevant responses. - Code Generation (Function-based flows) Location: ./function_flows Importance: Demonstrates the generation of code snippets based on user prompts, showcasing the potential for automating code generation tasks. - Chat Application (Class-based flows) Location: ./class_flows Importance: Showcases a chat application built using class-based flows, illustrating the structuring and organization of more complex conversational interfaces. # Documentation - Full documentation on using this repo using Azure DevOps can be found [here](./docs/Azure_devops_how_to_setup.md) - Full documentation on using this repo using Github Workflows can be found [here](./docs/github_workflows_how_to_setup.md) - Full documentation on using this repo using Jenkins can be found [here](./docs/jenkins_how_to_setup.md) - Documentation about adding a new flow is available [here](./docs/how_to_onboard_new_flows.md) - New experiment.yaml configuration [here](./docs/the_experiment_file.md) # Deployment The repo helps in deploying to **Kubernetes, Kubernetes ARC , Azure Web Apps and AzureML Managed compute** along with **A/B deployment** for AzureML Managed compute. ![Deployment](./docs/images/endpoints.png) ![A/B Deployments](./docs/images/abdeployments.png) # Pipeline The pipeline execution consists of multiple stages and jobs in each stage: ![pipeline execution](./docs/images/pipeline.png) # Reports The repo generates multiple reports (experiments-runs and metrics examples are shown) : ![experiments-runs](./docs/images/variants.png) ![metrics](./docs/images/metrics.png) # Local Execution To harness the capabilities of the **local execution**, follow these installation steps: 1. **Clone the Repository**: Begin by cloning the template's repository from its [GitHub repository](https://github.com/microsoft/llmops-promptflow-template.git). ```bash git clone https://github.com/microsoft/llmops-promptflow-template.git ``` 2. **setup env file**: create .env file at top folder level and provide information for items mentioned. Add as many connection names as needed. All the flow examples in this repo uses AzureOpenAI connection named `aoai`. Add a line `aoai={"api_key": "","api_base": "","api_type": "azure","api_version": "2023-03-15-preview"}` with updated values for api_key and api_base. If additional connections with different names are used in your flows, they should be added accordingly. Currently, flow with AzureOpenAI as provider as supported. ```bash experiment_name= connection_name_1={ "api_key": "","api_base": "","api_type": "azure","api_version": "2023-03-15-preview"} connection_name_2={ "api_key": "","api_base": "","api_type": "azure","api_version": "2023-03-15-preview"} ``` 3. Prepare the local conda or virtual environment to install the dependencies. ```bash python -m pip install promptflow promptflow-tools promptflow-sdk jinja2 promptflow[azure] openai promptflow-sdk[builtins] python-dotenv ``` 4. Bring or write your flows into the template based on documentation [here](./docs/how_to_onboard_new_flows.md). 5. Write python scripts similar to the provided examples in local_execution folder. # DataOps DataOps combines aspects of DevOps, agile methodologies, and data management practices to streamline the process of collecting, processing, and analyzing data. DataOps can help to bring discipline in building the datasets (training, experimentation, evaluation etc.) necessary for LLM app development. The data pipelines are kept seperate from the prompt engineering flows. Data pipelines create the datasets and the datasets are registered as data assets in Azure ML for the flows to consume. This approach helps to scale and troubleshoot independently different parts of the system. For details on how to get started with DataOps, please follow this document - [How to Configure DataOps](./docs/how_to_configure_dataops.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. ## 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). 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. ## Code of Conduct 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. ## License Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the [MIT](LICENSE) license.

AI & Machine Learning AI Agents Workflow Automation
359 Github Stars
MLOps_VideoAnomalyDetection
Open Source

MLOps_VideoAnomalyDetection

# Video Anomaly Detection - with Azure ML and MLOps [![Build Status](https://dev.azure.com/aidemos/MLOps/_apis/build/status/Microsoft.MLOps_VideoAnomalyDetection?branchName=master)](https://dev.azure.com/aidemos/MLOps/_build/latest?definitionId=88?branchName=master) The automation of detecting anomalous event sequences in videos is a challenging problem, but also has broad applications across industry verticals. The approach followed in this repository involves self-supervised training deep neural networks to develop an in-depth understanding of the physical and causal rules in the observed scenes. The model effectively learns to predict future frames in the video in a self-supervised fashion. The trained model can then be used to detect anomalies in videos. As the model tries to predict each next frame, one can calculate the error in the model's prediction. If the error is large, it is likely that an anomalous even occurred. The approach can be used both in a supervised and unsupervised fashion, thus enabling the detection of pre-defined anomalies, but also of anomalous events that have never occurred in the past. > Post on [LinkedIn](https://www.linkedin.com/feed/update/urn:li:activity:6512538611181846528) (includes **video**) ## Example scenarios The following snapshots are also links to video demonstrations. **Unsupervised Approach**: [![Video of unsupervised anomaly detection](./video_anom_usup.png)](https://www.youtube.com/watch?v=a966CT7PtHg) **Supervised Approach**: [![Video of unsupervised anomaly detection](./video_anom.PNG)](https://coursematerial.blob.core.windows.net/assets/video_anomaly_detection.mp4) # Learning Goals You will learn: 1. How to adapt an existing neural network architecture to your use-case. 1. How to prepare video data for deep learning. 1. How to perform hyperparameter tuning with [HyperDrive](https://azure.microsoft.com/en-us/blog/experimentation-using-azure-machine-learning/) to improve the performance of your model. 1. How to deploy a deep neural network as a webservice for video processing. 1. How to post-process the output of a Keras model for secondary tasks (here, anomaly detection). 2. How to define a build pipeline for DevOps. # Pre-requisites ## Skills 1. Some familiarity with concepts and frameworks for neural networks: - Framework: [Keras](https://keras.io/) and [Tensorflow](https://www.tensorflow.org/) - Concepts: [convolutional](https://keras.io/layers/convolutional/), [recurrent](https://keras.io/layers/recurrent/), and [pooling](https://keras.io/layers/pooling/) layers. 2. Knowledge of basic data science and machine learning concepts. [Here](https://www.youtube.com/watch?v=gNV9EqwXCpw) and [here](https://www.youtube.com/watch?v=GBDSBInvz08) you'll find short introductory material. 3. Moderate skills in coding with Python and machine learning using Python. A good place to start is [here](https://www.youtube.com/watch?v=-Rf4fZDQ0yw&list=PLjgj6kdf_snaw8QnlhK5f3DzFDFKDU5f4). ## Software Dependencies - Various python modules. We recommend working with a conda environement (see `config/environment.yml` and [Documentation](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)). - We recommend you begin by installing [Miniconda](https://docs.conda.io/en/latest/miniconda.html). - Also consider running the following command to update you conda base image: `conda update -n base -c defaults conda` - Then, you could run: `conda env create -f config/environment.yml` - If you are using a [DSVM](https://azure.microsoft.com/en-us/services/virtual-machines/data-science-virtual-machines/): - We recommend VS code [https://code.visualstudio.com/](https://code.visualstudio.com/) with [ssh - remote](https://code.visualstudio.com/docs/remote/ssh) extension. - We recommend X2Go [https://wiki.x2go.org/doku.php](https://wiki.x2go.org/doku.php) ## Hardware Dependencies A computer with a GPU, for example a Linux Azure VM. Compare VM [sizes](https://docs.microsoft.com/en-us/azure/virtual-machines/sizes-gpu) and [prices](https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/)). If you don't know what to choose, we recommend the Standard NC6, the most affordable VM with a GPU. You could create a VM in the [Azure Portal](https://ms.portal.azure.com/#create/microsoft-dsvm.ubuntu-18041804). ## Dataset [UCSD Anomaly Detection Dataset](http://www.svcl.ucsd.edu/projects/anomaly/dataset.htm) ## Agenda The recommended first step is to clone this repository. ### Getting Started 1. [Data Preparation](./docs/data_preparation.md) - Download and prepare data for training/testing. 1. [Azure ML Configuration](./docs/aml_configuration.md) - Configure your Azure ML workspace. 1. [AML Pipelines](./docs/aml_pipelines.md) - Automate data preparation, training, and re-training. 1. [Deployment](./docs/deployment.md) - How to deploy your anomaly detection as a webservice on AKS. ### Deep-dive 1. [Model Development](./docs/model_development.md) - Understand model architecture and training. 1. [Fine Tuning](./docs/fine_tuning.md) - Perform transfer learning with pretrained model onnew data. 1. [Hyperparameter tuning](./docs/hyperparameter_tuning.md) - Tune hyperparameters with HyperDrive. 1. [Anomaly Detection](./docs/anomaly_detection.md) - Use Model errors for detecting anomalies. ## Contribute We invite contributions to this repository. The preferred method would be to fork this repository and to create a pull request. ## References / Resources - Research Article: [Deep predictive coding networks for video prediction and unsupervised learning](https://arxiv.org/abs/1605.08104) by Lotter, W., Kreiman, G. and Cox, D., 2016. ``` @article{lotter2016deep, title={Deep predictive coding networks for video prediction and unsupervised learning}, author={Lotter, William and Kreiman, Gabriel and Cox, David}, journal={arXiv preprint arXiv:1605.08104}, year={2016} } ``` - Original Prednet implementation is on [github.com](https://coxlab.github.io/prednet/). - Interesting blog post on [Self-Supervised Video Anomaly Detection](https://launchpad.ai/blog/video-anomaly-detection) by [Steve Shimozaki](https://launchpad.ai/blog?author=590f381c3e00bed4273e304b) ## Troubleshooting ### Missing cuda libraries We noticed that tensorflow might be looking for the wrong the of cudatoolkit. You might see the following error: `Could not load dynamic library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory` We found that it helps to look at which version of these libraries you have installed, and pin the version of cudatoolkit to the version that tensorflow is looking for. E.g. above, TF is looking for 10.0, so we pinned the version of the cudatoolkit to 10.0 in `config/environment.yml`.

Health & Fitness AI Agents
137 Github Stars
dstoolkit-mlops-base
Open Source

dstoolkit-mlops-base

![banner](docs/media/banner.jpg) # MLOps Solution Accelerator This repository contains the basic repository structure for machine learning projects based on Azure technologies (Azure Machine Learning and Azure DevOps). The folder names and files are chosen based on personal experience. You can find the principles and ideas behind the structure, which we recommend to follow when customizing your own project and MLOps process. Also, we expect users to be familiar with Azure Machine Learning (AML) concepts and how to use the technology. ## Prerequisites In order to successfully complete your solution, you will need to have access to and or provisioned the following: - Access to an Azure subscription - Access to an Azure Devops subscription - Service Principal ## Getting Started Follow the step below to setup the project in your subscription. 1. **Setting up the Azure infrastructure:** - For general best-practices, we invite you to visit the official [Cloud Adoption Framework](https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/ai-machine-learning-resource-organization?branch=pr-en-us-1541) - if you are starting with MLOps, you will find the necessary Azure Devops pipelines and ARM templates in the folder _infra_ to setup the recommended infrastructure. To deploy the infrastructure have a look at [Infrastructure Setup](./docs/how-to/InfrastructureDesign.md). - if you already have a preferred architecture and Azure resources, you can delete the infrastructure folder. Nevertheless, we invite you to have a look the recommended infrastructure ['AzureDevops'](./docs/how-to/GettingStarted.md#run-the-pipeline). To use this template, you need to create a service principal to [manage identities in ADO](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/connect-to-azure?view=azure-devops), (if needed) [connect Azure KeyVault to ADO](https://docs.microsoft.com/en-us/azure/devops/pipelines/release/azure-key-vault?view=azure-devops), and [add environmental variables to in ADO](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops&tabs=classic). 2. **Creating your CI/CD Pipeline to Azure Devops.** In the folder **./azure-pipelines** you will find the yaml files to setup your CI/CD pipeline in Azure Devops (ADO). To do so, have a look at ['Azure Devops Setup'](./docs/how-to/GettingStarted.md#run-the-pipeline). If you have managed to run the entire example, well done! You can now adapt the same code to your own use case with the exact same infrastructure and CI/CD pipeline. To do so, follow these steps: 1. Add your AML-related variables (model, dataset name, experiment name, pipeline name ...) in the configuration file [configuration-aml.variables.yml](./configuration/configuration-aml.variables.yml). 2. Add your infra-related environment variables (azure environment, ...) in [configuration-infra-*.variables.yml](./configuration/configuration-infra-DEV.variables.yml) in the [**./configuration**](./configuration/) folder. By default, the template provides two yaml files for DEV and PROD environment. 3. Add your core machine learning code (feature engineering, training, scoring, etc) in [**./src**](./src/). We provide the structure of the core scripts. You can fill the core scripts with your own functionality. 4. If needed, adapt the ML operation scripts that handle the core scripts (e.g sending the training script to a compute target, registering a model, creating an azure ml pipeline,etc) in [**./mlops**](./mlops/). We provide some examples to easily setup your experiments and Azure Machine Learning pipelines. The project folders are structured in a way to rapidly move from a notebook experimentation to refactored code ready for deployment as following: ![design folder](docs/media/folder_design.PNG) ## Core MLOps Principles 1. **Continuous Integration**: testing ML systems comes down to testing feature engineering scripts, validating data schema, testing the model and validating the ML infrastructure (access permission, model registries, inference service,...). 2. **Continuous Delivery**: CD in the context of ML is the capacity to automatically deliver artefacts to different environment (i.e DEV/STAGE/PROD). ML artefacts consist of a feature engineering pipeline, a model, and an automated retraining pipeline depending on the use-case. 3. **Continuous Monitoring**: it is mandatory to provide a consistent feedback loop from model prediction results in production. The only real model test is in production where the model is fed live data. Hence, not having a monitoring system in place to enable ML practitioners to review model predictions may have catastrophic consequences. 4. **Continuous Training**: to attain a high level of ML autonomy, the ML systems ought to be able to automatically detect data drifts or be triggered based on business rule to retrain models in production. This principle however can only be applied if a monitoring system is running to ensure that the retraining is activated in pre-defined conditions. ## General Coding Guidelines For more details on the coding guidelines and explanation on the folder structure, please go to [docs/how-to](docs/how-to/GeneralDocumentation.md). 1. Core scripts should receive parameters/config variables only via code arguments and must not contain any hardcoded variables in the code (like dataset names, model names, input/output path, ...). If you want to provide constant variables in those scripts, write default values in the argument parser. 2. Variable values must be stored in **_configuration/configuration.yml_**. These files will be used by the execution scripts (azureml python sdk or azure-cli) to extract the variables and run the core scripts. 3. Two distinct configuration files for environment creation: - (A) for local dev/experimentation: may be stored in the project root folder (requirement.txt or environment.yml). It is required to install the project environment on a different laptop, devops agent, etc. - (B) for remote compute: stored in **_configuration/environments_** contains only the necessary packages to be installed on remote compute targets or AKS. 4. There are only 2 core secrets to handle: the azureml workspace authentication key and a service principal. Depending on your use-case or constraints, these secrets may be required in the core scripts or execution scripts. We provide the logic to retrieve them in a **_aml_utils_** file/module in both **_src_** and **_mlops_**. ## Default Directory Structure ```bash ├───azure-pipelines # folder containing all the azure devops pipelines for CI/CD │ └───templates # any yaml template files ├───configuration # all configuration files │ ├───compute # definitions of computes used for training and inference │ └───environments # definitions of environments used for training and inference ├── docs # documentation folder │   ├── how-to # documents on how to use this template and how to setup the environment │   ├── media # storing images, videos, etc, needed for docs. │   └── references # external resources relevant to the project ├───notebooks # experimentation folder with notebooks, code and other. This code is not part of the operationalized flow. ├───mlops # all the code to orchestrate machine learning operations │ └───tests # for testing your code, data, and outputs ├── src # data science code adapted to the particular use case. ├── .gitignore ├── README.md └── requirements.txt ``` ## Contribution We welcome any contribution to improve the accelerator. For more information, please go through the [contribution guideline](./CONTRIBUTING.md) ## Support & FAQ If you have any questions or new ideas you would like to discuss, you can start a new conversation in the [discussions tab](https://github.com/microsoft/dstoolkit-mlops-base/discussions) Frequently asked questions can be found in [how-to](docs/how-to/FAQ.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). 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.

AI & Machine Learning ML Frameworks
92 Github Stars
MLOpsTemplate
Open Source

MLOpsTemplate

# MLOps Template MLOps Template is a repo created by Microsoft field personnel (CSA, GBB, MTC) that provides several tools and templates to facilitate modern MLOps practices. In addition to a template for an Active Learning implementation, there are also two sets of materials to facilitate an introductory workshop on modern MLOps practices, one, developed by the West Region CSU, using Azure Machine Learning and GitHub Actions, and another featuring Azure Databricks for ML asset development and Azure DevOps for CI/CD pipelines. - [Active Learning template](/src/active_learning_cv/) - [MLOps workshop materials using Azure Machine Learning and GitHub Actions](/src/workshop/) - [MLOps workshop materials using Azure Databricks and Azure DevOps](MLOps-ADO-ADB/src/workshop/) ## 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. ## 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). 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.

AI & Machine Learning ML Frameworks
90 Github Stars
dstoolkit-mlops-databricks
Open Source

dstoolkit-mlops-databricks

![Banner](docs/images/MLOps_for_databricks_Solution_Acclerator_logo.JPG) ## MLOps Gify Visual (Allow 20 Seconds To Load) ![](https://github.com/ciaran28/dstoolkit-mlops-databricks/blob/main/docs/images/Azure_Machine_Learning_GIF.gif) --- <br> # Version History And Updates ## Azure ML Integration Now Live For GitHub Deployment. Development for Azure DevOps Deployment in Progress # MLOps for Databricks with CI/CD (GitHub Actions) --- ## MLOps Architecture ![image](https://user-images.githubusercontent.com/108273509/207945308-14e4794e-e86b-4bee-aa21-088698983703.png) Features to be included in future releases: - Model testing - Metrics & Monitoring --- ## Youtube Demo - Slightly Outdated The deployment instructions for the video are slightly outdated (albeit still usefull). Please follow instructions below instead. The video still provides useful content for concepts outwith the deployment. [![Youtube Demo](docs/images/YoutubeThumbNail.png)](https://youtu.be/g57N3GYXuDI) --- ## About This Repository This Repository contains an Azure Databricks Continuous Deployment _and_ Continuous Development Framework for delivering Data Engineering/Machine Learning projects based on the below Azure Technologies: | Azure Databricks | Azure Log Analytics | Azure Monitor Service | Azure Key Vault | | ---------------- |:-------------------:| ----------------------:| ----------------------:| Azure Databricks is a powerful technology, used by Data Engineers and Scientists ubiquitously. However, operationalizing it within a Continuous Integration and Deployment setup that is fully automated, may prove challenging. The net effect is a disproportionate amount of the Data Scientist/Engineers time contemplating DevOps matters. This Repository's guiding vision is to automate as much of the infrastructure as possible. --- --- ## Prerequisites <details open> <summary>Click Dropdown... </summary> <br> - Github Account - Microsoft Azure Subscription - VS Code - Azure CLI Installed (This Accelerator is tested on version 2.39) </details> --- --- ## Details of The Solution Accelerator - Creation of four environments: - Sandbox - Development - User Acceptance Testing (UAT) - Production - Full CI/CD between environments - Infrastructure-as-Code for interacting with Databricks API and also CLI - Azure Service Principal Authentication - Azure resource deployment using BICEP - Databricks Feature Store + MLFlow Tracking + Model Registry + Model Experiments - DBX by Data Labs for Continuous Deployment of Jobs/Workflows (source code/ parameters files packaged within DBFS) --- # Deployment Instructions ## Create Repository <details open> <summary>Click Dropdown... </summary> <br> - Fork this repository [here](https://github.com/microsoft/dstoolkit-mlops-databricks/fork) - In your Forked Repo, click on 'Actions' and then 'Enable' - Within your VS Code click, "View", then "Command Pallette", "Git: Clone", and finally select your Repo </details> --- ## Login To Azure - All Code Throughout To Go Into VS Code **PowerShell Terminal** ```ps az login # If There Are Multiple Tenants In Your Subscription, Ensure You Specify The Correct Tenant "az login --tenant" # ** Microsoft Employees Use: az login --tenant fdpo.onmicrosoft.com (New Non Prod Tenant ) ``` ## GitHub Account ```ps echo "Enter Your Git Username... " # Example: "Ciaran28" $Git_Configuration = "GitHub_Username" ``` ## GitHub Repos Within Databricks ```ps echo "Enter Your Git Repo Url (this could be any Repository In Your Account )... " # Example: "https://github.com/ciaran28/dstoolkit-mlops-databricks" $Repo_ConfigurationURL = "" ``` ## Updates Parameter Files & Git Push To Remote ```ps echo "From root execute... " ./setup.ps1 ``` --- ## Create Environments Follow the naming convention (case sensitive) <img width="971" alt="image" src="https://user-images.githubusercontent.com/108273509/205917146-a7deb2ae-674a-4ec1-a9b8-4859bcdce25f.png"> ## Secrets **For each environment** create GitHub Secrets entitled **ARM_CLIENT_ID**, **ARM_CLIENT_SECRET** and **ARM_TENANT_ID** using the output in VS Code PowerShell Terminal from previous step. (Note: The Service Principal below was destroyed, and therefore the credentials are useless ) <img width="656" alt="image" src="https://user-images.githubusercontent.com/108273509/194619649-2ef7e325-a6bb-4760-9a82-1e3b4775adbd.png"> In addition generate a GitHub Personal Access Token and use it to create a secret named **PAT_GITHUB**: <img width="883" alt="image" src="https://user-images.githubusercontent.com/108273509/205918329-9592e20f-439b-4e1b-b7c4-983579e295de.png"> --- --- ## Final Snapshot of GitHub Secrets Secrets in GitHub should look exactly like below. The secrets are case sensitive, therefore be very cautious when creating. <img width="587" alt="image" src="https://user-images.githubusercontent.com/108273509/205921220-9ad2116a-7c85-4725-a70c-e178a0af2914.png"> --- --- ## Deploy The Azure Environments - In GitHub you can manually run the pipeline to deploy the environments to Azure using "onDeploy.yaml" found [here](.github/workflows/onDeploy.yaml). Use the instructions below to run the workflow. <img width="893" alt="image" src="https://user-images.githubusercontent.com/108273509/205954210-c123c407-4c83-4952-ab4b-cd6c485efc2f.png"> - Azure Resources created (Production Environment snapshot - For speed I have hashed out all environment deployments except Sandbox. Update onDeploy.yaml to deploy all environments) <img width="1175" alt="image" src="https://user-images.githubusercontent.com/108273509/194638664-fa6e1809-809e-45b2-9655-9312f32f24bb.png"> --- --- ## Running Pipelines - The end to end machine learning pipleine will be pre-configured in the "workflows" section in databricks. This utilises a Job Cluster which will automatically upload the necessary dependencies contained within a python wheel file - If you wish to run the machine learning scripts from the Notebook instead, first upload the dependencies (automatic upload is in development). Simply navigate to python wheel file contained within the dist/ folder. Manually upload the python wheel file to the cluster that you wish to run for the Notebook. --- --- ## Continuous Deployment And Branching Strategy The Branching Strategy I have chosen is configured automatically as part of the accelerator. It follows a GitHub Flow paradigm in order to facilitate rapid Continuous Integration, with some nuances. (see Footnote 1 which contains the SST Git Flow Article written by Willie Ahlers for the Data Science Toolkit - This provides a narrative explaining the numbers below)[^1] The branching strategy is easy to change via updating the "if conditions" within .github/workflows/onRelease.yaml. <img width="805" alt="image" src="https://user-images.githubusercontent.com/108273509/186166011-527144d5-ebc1-4869-a0a6-83c5538b4521.png"> - Pull Request from Feature Branch to Main Branch: C.I Tests - Pull Request approved from Feature Branch to Main Branch: C.D. to Development Environment - Pull Request from Main Branch to Release Branch: C.I. Test - Pull Request approved from Main Branch to Release Branch: C.D. to User Acceptance Testing (UAT) Environment - Tag Version and Push to Release Branch: C.D. to Production Environment - Naming conventions for branches (to ensure the CD pipelines will deploy - onRelease.yaml for more details ): - Feature Branches: "feature/<insertname>" - Main Branch: "main" - Release branch "release/<insertname>" --- --- ## MLOps Paradigm: Deploy Code, not Models In most situations, Databricks recommends that during the ML development process, you promote code, rather than models, from one environment to the next. Moving project assets this way ensures that all code in the ML development process goes through the same code review and integration testing processes. It also ensures that the production version of the model is trained on production code. For a more detailed discussion of the options and trade-offs, see Model deployment patterns. https://learn.microsoft.com/en-us/azure/databricks/machine-learning/mlops/deployment-patterns <img width="427" alt="image" src="https://user-images.githubusercontent.com/108273509/211937862-2aaf118f-85c1-4d98-af75-56628837ffa4.png"> --- --- ## Feature Store Integration In an organization, thousands of features are buried in different scripts and in different formats; they are not captured, organized, or preserved, and thus cannot be reused and leveraged by teams other than those who generated them. Because feature engineering is so important for machine learning models and features cannot be shared, data scientists must duplicate their feature engineering efforts across teams. To solve those problems, a concept called feature store was developed, so that: - Features are centralized in an organization and can be reused - Features can be served in real-time with low latency ![image](https://user-images.githubusercontent.com/108273509/216114586-0c4dea68-a98c-4cf6-938a-ceecf11b12a8.png)

DevOps & Infrastructure ML Frameworks FaaS & Serverless
81 Github Stars
OneLabeler
Open Source

OneLabeler

# OneLabeler OneLabeler is a system for building data labeling tools. It provides visual programming interface where the developer can compose modules into a data labeling tool. Its documentation can be found at <https://microsoft.github.io/OneLabeler-doc>. ⚠️OneLabeler is currently under active development and may not be bug-free. ## Build the Tool Before starting, make sure you have installed [Node.js](https://nodejs.org/). Build the visual programming interface as a website: ```bash cd ./client npm install npm run build ``` This will generate the interface as website in the `./client/dist` folder. Build the visual programming interface as a desktop application: ```bash cd ./client npm install npm run build:electron ``` This will generate the interface as an installer named `one-labeler Setup ${version}.exe` in the `./client/dist_electron` folder. ## Resources - [Introduction](https://microsoft.github.io/OneLabeler-doc/#what-is-onelabeler) - [Examples](https://microsoft.github.io/OneLabeler-doc/gallery.html)

Data Labeling
34 Github Stars
win-dev-skills
Open Source

win-dev-skills

# WinUI agents and skills for Windows app development A GitHub Copilot, Claude Code, and OpenAI Codex plugin for building native Windows apps with **WinUI 3** and the **Windows App SDK** to cover the end-to-end inner loop: scaffold → design → build → run → test → package → ship. <img width="1536" height="1024" alt="image" src="https://github.com/user-attachments/assets/b7d25afc-ba15-4d8a-8dcf-2dd78000f3aa" /> > [!WARNING] > **🚧 Preview · v0.x — expect breaking changes.** Skill names, on-disk layout, agent configuration, analyzer rule IDs, and CLI tool surfaces are all subject to change without notice. There is no SemVer commitment until v1.0. If you need a stable pin, install from a release tag instead of the rolling marketplace (see [Pinning to a release](#pinning-to-a-release)). Outputs are suggestions, not authoritative answers — review them before committing or shipping anything they produce. ## Install The plugin requires **GitHub Copilot** (`winget install GitHub.Copilot`), **Claude Code**, or **OpenAI Codex** installed. **Git** (`winget install Git.Git`) is required for installing pluggins. ### Option A — Just ask Copilot to do it Paste this prompt into a Copilot CLI session. It installs the plugin **and** sets up every prerequisite in one shot: ``` Install the Copilot CLI plugin "winui" from microsoft/win-dev-skills, then set up my machine for WinUI 3 development. Specifically: 1. Run: copilot plugin marketplace add microsoft/win-dev-skills 2. Run: copilot plugin install winui@win-dev-skills 3. Make sure these prerequisites are present (check first; .NET only installs if missing, but WinApp CLI and templates always upgrade to latest): - .NET SDK >= 8.0 (run `dotnet --list-sdks`; if none >= 8.0, `winget install --id Microsoft.DotNet.SDK.10 --exact --silent --accept-package-agreements --accept-source-agreements`) - WinApp CLI: must be >= 0.3 (parse `winapp --version`); if missing or older, `winget install --id Microsoft.WinAppCLI`. THEN regardless run `winget upgrade --id Microsoft.WinAppCLI` to get the latest. - WinUI 3 templates: always run `dotnet new install Microsoft.WindowsAppSDK.WinUI.CSharp.Templates` (after refreshing $env:Path) — it upgrades in place if already installed. - Developer Mode (DWORD HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock\AllowDevelopmentWithoutDevLicense == 1) — ASK ME first before triggering UAC; if I decline, just print the elevated command for me to run later. 4. Print a short summary of what was installed vs already present, then tell me to start a new Copilot CLI, activate the "winui-dev" agent, and to ask it to build an app. ``` ### Option B — Install the plugin yourself, then ask the agent to set up the rest If you'd rather run the plugin commands by hand: <details> <summary><strong>GitHub Copilot CLI</strong></summary> The plugin is listed on **awesome-copilot** and can be installed directly: ```powershell copilot plugin install winui@awesome-copilot ``` Or add this repo as a marketplace and install from there: ```powershell copilot plugin marketplace add microsoft/win-dev-skills copilot plugin install winui@win-dev-skills ``` </details> <details> <summary><strong>Claude Code</strong></summary> ```powershell claude plugin marketplace add microsoft/win-dev-skills claude plugin install winui@win-dev-skills ``` </details> <details> <summary><strong>OpenAI Codex</strong></summary> Add the `microsoft/win-dev-skills` marketplace, then enable the `winui` plugin from the plugin directory. > **Note:** Codex doesn't have an "agents" concept, so the orchestrator agent isn't exposed there. The skills still work - invoke them by name (e.g. `/winui-setup`, `/winui-design`) and Codex will load them on demand. </details> Then start a new session and run the `winui-setup` skill with `/winui-setup`. Once setup is done, try a real task: > "Build me a WinUI 3 markdown editor with live preview and a custom title bar" ### What gets installed | Tool | Minimum | Recommended | Install command | |---|---|---|---| | Git | 2.54 | 2.54+ | `winget install Git.Git` | | .NET SDK | 8.0 | 10.0 | `winget install Microsoft.DotNet.SDK.10` | | WinApp CLI | 0.3 | latest | `winget install Microsoft.WinAppCLI` | | WinUI 3 templates | — | latest | `dotnet new install Microsoft.WindowsAppSDK.WinUI.CSharp.Templates` | | Developer Mode | enabled | enabled | DWORD `AllowDevelopmentWithoutDevLicense` set to `1` | Visual Studio with the WinUI workload is **optional** but recommended for the XAML-diagnostics workaround called out in the next section. Neither setup path will install it; if you want it, run: ```powershell winget install Microsoft.VisualStudio.Community --override "--add Microsoft.VisualStudio.Workload.Universal" ``` > [!IMPORTANT] > **For best results, install Visual Studio with the WinUI workload.** There is a known XAML-compiler issue under `dotnet build` where a malformed XAML file produces no useful diagnostic — the build just fails with no indication of what's wrong in which `.xaml`. Agents that hit this thrash through unrelated guesses. The `winui-dev-workflow` skill works around it via a small [`BuildAndRun.ps1`](plugins/winui/skills/winui-dev-workflow/BuildAndRun.ps1) helper that prefers MSBuild when it's available on the machine and falls back to `dotnet build` otherwise. **This workaround is explicitly temporary** and goes away when the next Windows App SDK release fixes the underlying compiler. ## Why a Copilot CLI plugin? Modern Windows app development covers a lot of ground — XAML and Fluent Design, MVVM, MSIX packaging, code signing, Store submission, accessibility, theming, UI automation. AI agents working from generic web context tend to mix WinUI 3 with older stacks (UWP, WPF), miss the packaged-execution model, or stop short of running and verifying what they built. These skills **stay in the WinUI 3 lane end-to-end** — from `dotnet new` through a signed MSIX — and pair the agent with tools that give it real, ground-truth answers instead of guesses. The result: you ask `copilot -p "create a WinUI 3 photo viewer with thumbnails and EXIF metadata"`, and the agent picks the right template, scaffolds the project, designs the XAML with theming and accessibility in mind, wires up MVVM correctly, builds, fixes errors with real diagnostics, launches through the right packaged-execution pipeline, and (if you ask) drives the running app through UI automation to validate it works. ## What's in this repo ``` .github/plugin/ Marketplace manifest (marketplace.json) plugins/winui/ Copilot CLI plugin manifest + agent + skill files agents/winui-dev/ The orchestrator agent skills/ The eight skills (see table below) src/tools/ Source for the in-repo tools shipped with the skills winmd-cli/ Native-AOT WinRT/.NET metadata indexer (winmd.exe) winui-search/ Native-AOT search over WinUI Gallery + Toolkit (winui-search.exe) winui-analyzer/ Microsoft.WindowsAppSDK.Analyzers Roslyn analyzer scripts/ Helper scripts (see scripts/build-tools.ps1) ``` ### The agent: `winui-dev` A focused agent for WinUI 3 / Windows App SDK / XAML / C# work. Use it for new apps, adding features, converting from WPF/Electron/web, or fixing bugs. It pulls in the skills below as needed. ### The eight skills Each skill is a focused, self-contained playbook. The agent loads `winui-design` and `winui-dev-workflow` by default — those cover most "build me a WinUI 3 app" requests end-to-end. You opt into the others when you want them, including `winui-setup` for one-time machine prep. | Skill | What it does | |---|---| | **`winui-dev-workflow`** | Build and run workflow — project creation from templates, the `BuildAndRun.ps1` helper, `winapp run`, error diagnosis, prerequisites. Use when building, running, or fixing build errors. | | **`winui-design`** | UI design and XAML correctness — layout planning, control selection, Fluent Design, theming (Light/Dark/HighContrast), typography, spacing, brushes, accessibility, data-binding review. Bundles `winui-search.exe` for grounded control lookup against the WinUI Gallery + Community Toolkit catalogue. | | **`winui-code-review`** | Code-quality review before committing — MVVM compliance, `x:Bind` correctness, accessibility, theming, security, performance. Catches what the compiler and UI tests won't. | | **`winui-ui-testing`** | Automated UI testing — generates a batch test script, runs all tests in one pass, reads results. Covers element assertions, interactions, value checks (TextBox, ComboBox, ToggleSwitch), file pickers, flyouts, dialogs, persistence, accessibility audits. | | **`winui-packaging`** | MSIX packaging, code signing, and distribution — release builds, certificate generation (`winapp cert generate`), trust, signing (`winapp sign`), self-contained deployment, GitHub Actions CI/CD, and Microsoft Store submission. | | **`winui-wpf-migration`** | WPF → WinUI 3 migration — namespace replacement, control mapping (`DataGrid` → `ListView`, `WrapPanel` → `ItemsRepeater`, `TabControl` → `TabView`), `Dispatcher` → `DispatcherQueue`, `System.Drawing` → `BitmapImage`, MVVM conversion to CommunityToolkit.Mvvm, `DynamicResource` → `ThemeResource`. | | **`winui-session-report`** | Diagnostic report on the current or a recent Copilot session. Use when filing a bug, debugging agent behaviour, or reviewing what happened during a build session. | | **`winui-setup`** | Install and verify machine prerequisites — .NET SDK 10, the WinApp CLI, the WinUI 3 .NET templates, and Developer Mode. Idempotent. **User-invoked only** — run it explicitly with `/winui-setup` to set up a fresh machine; the agent will not load it on its own and will instead ask you to run it if a later command fails because a prerequisite is missing. | ## The tools we lean on Skills are *prompts plus playbooks*. They get their actual leverage from a small set of tools — some external, some included in this repo. ### External tools the skills depend on * **[`winapp` CLI](https://github.com/microsoft/winappcli)** (`winget install Microsoft.WinAppCLI`) — the command-line driver for installing, running, signing, packaging, and **automating** WinUI 3 / WinAppSDK apps. **Without `winapp`, these skills wouldn't be possible.** Packaged WinUI 3 apps can't just be launched as a `.exe` — they need to be installed and started through the right activation pipeline. `winapp run` does exactly that and streams the app's debug output back to the agent so it can see crashes and exceptions instead of staring at silence. `winapp ui` powers the entire `winui-ui-testing` skill: enumerating elements, asserting state, driving controls, capturing accessibility audits — all from the command line, all scriptable, all readable by an AI agent. `winapp manifest` and `winapp pack` are what makes `winui-packaging` able to take a build all the way to a signed MSIX. `winapp` is being built **in parallel** with these skills, in lockstep — every time a skill needed a new automation surface or a tighter feedback loop, that requirement landed in `winapp` first. * **[`Microsoft.WindowsAppSDK.WinUI.CSharp.Templates`](https://www.nuget.org/packages/Microsoft.WindowsAppSDK.WinUI.CSharp.Templates)** — the new `dotnet new` templates for WinUI 3 + Windows App SDK. The dev-workflow skill uses these as the canonical scaffold so every new project starts from the same supported baseline. ### In-repo tools — what's running on your machine Several skills ship helper binaries and PowerShell scripts that run under your user account. **None of them are code-signed today.** They live in this repo so you can read the source, build them yourself, and verify what they do — that's an explicit launch-preview trade-off, not a long-term distribution model. | Artifact | Source | What it does | Long-term plan | |---|---|---|---| | **`Microsoft.WindowsAppSDK.Analyzers.dll`** (Roslyn analyzer) | [`src/tools/winui-analyzer/`](src/tools/winui-analyzer/) | Catches common WinUI 3 / WinAppSDK pitfalls at build time: UWP namespace leaks, `Window.Current`, `CoreDispatcher`, `WebView2` without `EnsureCoreWebView2Async`, raw `TabView` content, attached-property syntax bugs, removed ONNX GenAI APIs, the old field-backed `[ObservableProperty]` pattern, and more. Every rule ships at `Warning` severity (no `Error`s) and includes a `helpLinkUri`. Verified against source on every PR by the `analyzer-provenance` CI job. | Publish as the `Microsoft.WindowsAppSDK.Analyzers` NuGet package; skill stops shipping the prebuilt DLL and projects pick it up via `<PackageReference>`. | | **`winmd.exe`** (winmd-cli) | [`src/tools/winmd-cli/`](src/tools/winmd-cli/) | Native-AOT WinRT/.NET metadata indexer. The agent uses it to verify an API actually exists and has the signature it thinks it does — *before* writing code that won't compile. Reads `.winmd` and managed `.dll` metadata from NuGet, the Windows SDK, and WinAppSDK and returns the same XML doc text Visual Studio IntelliSense uses. | Publish as a `dotnet tool` on NuGet, or fold relevant subcommands into [`winappcli`](https://github.com/microsoft/winappcli). | | **`winui-search.exe`** (winui-search) | [`src/tools/winui-search/`](src/tools/winui-search/) | Native-AOT BM25 search over [WinUI Gallery](https://github.com/microsoft/WinUI-Gallery) and [CommunityToolkit/Windows](https://github.com/CommunityToolkit/Windows) scenarios. Lets the agent see real shipping samples for a control before writing a single line of XAML. Embedded JSON snapshots ship offline; live refresh via `winui-search update`. **Distributed today as a prebuilt unsigned exe inside the `winui-design` skill payload**, verified on every PR by the `winui-search-provenance` CI job. | Same as `winmd-cli` — `dotnet tool`, fold into `winappcli`, or expose over a small MCP server. | | **`BuildAndRun.ps1`** | [`plugins/winui/skills/winui-dev-workflow/BuildAndRun.ps1`](plugins/winui/skills/winui-dev-workflow/BuildAndRun.ps1) | Picks MSBuild over `dotnet build` to work around the XAML-compiler diagnostic gap called out above. After a successful build it hands off to `winapp run`. | **Removed entirely once the next Windows App SDK release fixes the XAML compiler under `dotnet build`** — the skills will switch to `dotnet build` / `dotnet run` directly. | | **`Analyze-Session.ps1`** | [`plugins/winui/skills/winui-session-report/Analyze-Session.ps1`](plugins/winui/skills/winui-session-report/Analyze-Session.ps1) | Reads your local Copilot session events and produces a `session-report.md` for bug filing. **The report can include excerpts of your prompts, file paths, and command output — review it before sharing.** The skill prints a privacy notice when it runs. | Fold into the `copilot` CLI as a session-report subcommand, or publish as a `dotnet tool`. | If any of this is a deal-breaker for your environment, please [open an issue](https://github.com/microsoft/win-dev-skills/issues) — that feedback is what determines how quickly each item moves out of "preview, ships from repo" into "signed package on a registry". ### Building the in-repo tools yourself ```powershell # Build all three tools (AOT-publishes winmd-cli and winui-search), run the # analyzer test suite, and refresh both committed payloads (analyzer DLL inside # winui-dev-workflow, winui-search.exe inside winui-design). This is the same # build the pr-validation workflow runs in CI. ./scripts/build-tools.ps1 ``` Per-tool READMEs cover what they do and how to consume them in more detail: * [`src/tools/winui-analyzer/README.md`](src/tools/winui-analyzer/README.md) — analyzer + rule catalog * [`src/tools/winmd-cli/README.md`](src/tools/winmd-cli/README.md) — `winmd` CLI usage * [`src/tools/winui-search/README.md`](src/tools/winui-search/README.md) — `winui-search` CLI usage ## Pinning to a release The default install (`copilot plugin install winui@win-dev-skills`) tracks `main` HEAD — every promotion to `main` is a tagged release, but the marketplace install path always picks up the latest. If you need a stable pin, install from the git URL with a tag ref instead: ```powershell copilot plugin install https://github.com/microsoft/win-dev-skills.git#v0.3.0 ``` ```powershell claude plugin install https://github.com/microsoft/win-dev-skills.git#v0.3.0 ``` Browse available tags at <https://github.com/microsoft/win-dev-skills/tags>. ## How releases work Day-to-day work lands on a `staging` branch via PRs. Periodically a maintainer opens a **promotion PR** (`staging → main`) that bumps the version and updates `CHANGELOG.md`; merging that PR auto-creates a `vX.Y.Z` git tag at the merge commit. See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the contributor flow and [`RELEASING.md`](RELEASING.md) for the maintainer playbook. ## Beyond Copilot CLI Today the plugin targets [GitHub Copilot CLI](https://github.com/github/gh-copilot), but we want these skills to be usable from **any** AI coding host that's a good fit for Windows desktop development. We're actively figuring out the cleanest way to ship for multiple hosts without forking the content — and we want feedback on which hosts matter most to you. File an issue if you have a preference. ## Help us improve After trying the skills, run the `winui-session-report` skill. It analyzes your session — turns, tokens, build patterns, what worked, what didn't — and produces a `session-report.md` file. **The file may contain excerpts of your prompts, file paths, and command output, so review it before sharing.** Please attach it when you [open an issue](https://github.com/microsoft/win-dev-skills/issues) — the bug template asks for it. If a skill produces something wrong, surprising, or just not as good as it should be, we want to know. Skill names, scopes, structure, distribution mechanics for the analyzer and CLI tools, the `BuildAndRun.ps1` workaround — **everything you see today is a starting point**, and feedback in the next few months shapes where each piece lands. ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA); see [opensource.microsoft.com/cla](https://opensource.microsoft.com/cla) for details. This project has adopted the [Microsoft Open Source Code of Conduct](CODE_OF_CONDUCT.md). For support channels see [SUPPORT.md](SUPPORT.md), and for responsible disclosure of security issues see [SECURITY.md](SECURITY.md). **Open PRs against `staging`, not `main`.** See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the branch model and the release flow. When you open a PR, the `pr-validation` workflow rebuilds the analyzer DLL, runs the analyzer test suite, validates the plugin manifest and skill frontmatter, and verifies the committed analyzer binary matches its source. The `release-policy` workflow additionally enforces the staging/main split (no version bumps in feature PRs; required version bump + CHANGELOG entry in promotion PRs). Run [`scripts/build-tools.ps1`](scripts/build-tools.ps1) locally before pushing to keep those checks green. ## 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/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 is subject to those third parties' policies. ## License This project is licensed under the [MIT License](LICENSE). Third-party components and their licenses are listed in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).

Mobile Development AI Tools
272 Github Stars
OCR-Form-Tools
Open Source

OCR-Form-Tools

# Form OCR Testing Tool Help us improve Form Recognizer. [Take our survey!](https://aka.ms/FR-HaTS-Survey) ## Features Preview [![Build Status](https://dev.azure.com/msazure/Cognitive%20Services/_apis/build/status/microsoft.OCR-Form-Tools?branchName=master)](https://dev.azure.com/msazure/Cognitive%20Services/_build/latest?definitionId=118293&branchName=master) An open source labeling tool for [Form Recognizer](https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/), part of the Form OCR Test Toolset (FOTT). This is a `MAIN` branch of the Tool. It contains all the newest features available. This is **NOT** the most stable version since this is a preview. The purpose of this repo is to allow customers to test the tools available when working with Microsoft Forms and OCR services. Currently, Labeling tool is the first tool we present here. Users could provide feedback, and make customer-specific changes to meet their unique needs. Microsoft Azure Form Recognizer team will update the source code periodically. If you would like to contribute, please check the contributing section. * **If you want to checkout our latest GA version, please go to [Form-Recognizer-Toolkit](https://github.com/microsoft/Form-Recognizer-Toolkit/tree/main/SampleCode/LabelingUX), or use [Form Recognizer Studio](https://formrecognizer.appliedai.azure.com/studio).** * **If you want to checkout our V2.1 GA version of the tool, please follow this [link](https://github.com/microsoft/OCR-Form-Tools/tree/v2.1-General-Availability-Release).** * **If you want to checkout our V2.0 GA version of the tool, please follow this [link](https://github.com/microsoft/OCR-Form-Tools/tree/v2.0-General-Availability-Release).** ___ FOTT's Labeling Tool is a React + Redux Web application, written in [TypeScript](https://github.com/Microsoft/TypeScript). This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). Current Features of Labeling Tool: (you can view a short demo [here](https://youtu.be/GRGs18lZJ1E?t=462)) * **Label** forms in PDF, JPEG or TIFF formats. * **Train** model with labeled data through [Form Recognizer](https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/) * **Predict/Analyze** a single form with the trained model, to extract key-value predictions/analyses for the form. ## Getting Started ### Build and run from source Form Labeling Tool requires [NodeJS (>= 10.x, Dubnium) and NPM](https://github.com/nodejs/Release) ```bash git clone https://github.com/Microsoft/OCR-Form-Tools.git cd OCR-Form-Tools yarn install yarn build yarn start ``` ### Set up this tool with Docker Please see instructions [here](https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/quickstarts/label-tool#set-up-the-sample-labeling-tool), and view our docker hub repository [here](https://hub.docker.com/_/microsoft-azure-cognitive-services-custom-form-labeltool?tab=description) for the latest container image info. - `latest` docker image tags track the general availability releases of FOTT. - `latest-preview`, docker image tags track the preview releases of FOTT. - `latest-preview-private`, docker image tags track the private preview releases of FOTT. ### Run as web application Using a modern Web browser, FOTT can be run directly at: - https://fott-2-1.azurewebsites.net/ **Note: these web app are for testing purpose only. HTTPS is required, unless it's for localhost.** ### Run as desktop application FOTT can be run as a desktop application after initial set up. ```bash yarn electron-start ``` The desktop application has additional features, such as: - Support for local file system as provider storage - Support for cross-domain resource requests ### Release as desktop application FOTT can be released as a distributable desktop application. ```bash yarn release ``` The distributable will saved in the releases folder of the cloned repository. ## Using labeling tool ### Set up input data To go thru a complete label-train-analyze scenario, you need a set of at least six forms of the same type. You will label five forms to train a model and one form to test the model. You could upload the [sample files](https://go.microsoft.com/fwlink/?linkid=2090451) to the root of a blob storage container in an Azure Storage account. You can use [Azure Storage Explorer](https://azure.microsoft.com/en-us/features/storage-explorer/) to upload data. For advanced scenarios where there are forms in quite different formats, you could organize them into subfolders based on similar format. When you set up your project to train a model from one format, you need to specify a subfolder in the project setting page. #### Configure cross-domain resource sharing (CORS) Enable CORS on your storage account. Select your storage account in the Azure portal and click the **CORS** tab on the left pane. On the bottom line, fill in the following values. Then click **Save** at the top. * Allowed origins = * * Allowed methods = [select all] * Allowed headers = * * Exposed headers = * * Max age = 200 ![alt text](docs/images/cors-setup.png "CORS setup") ### Create Connections Form OCR Testing Tool is a 'Bring Your Own data' (BYOD) application. In this tool, connections are used to configure and manage source (the assets to label) and target (the location where labels should be exported). The source and target are the same location in Form OCR Testing Tool. Eventually, they together will be inputs to [Form Recognizer](https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/). Connections can be set up and shared across projects. They use an extensible provider model, so new source/target providers can easily be added. Currently, both this labeling tool and [Form Recognizer](https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/) only support [Azure blob storage](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction). To create a new connection, click the `New Connections` (plug) icon, in the left hand navigation bar. Fill in the fields with the following values: * **Display Name** - The connection display name. * **Description** - Your project description. * **SAS URL** - The shared access signature (SAS) URL of your Azure blob storage container. To retrieve the SAS URL, open the Microsoft Azure Storage Explorer, right-click your container (note: not the parent storage node, not the URL in your Azure portal), and select Get shared access signature. Set the expiry time to some time after you'll have used the service. Make sure the Read, Write, Delete, and List permissions are checked, and click Create. Then copy the value in the URL section. It should have such format: https://&lt;storage account&gt;.blob.core.windows.net/&lt;container name&gt;?&lt;SAS value&gt;. ![alt text](docs/images/new-connection.png "New Connection") ![alt_text](docs/images/get-sas.PNG "Get SAS URL") ### Create a new project In this labeling tool, a project is used to store your configurations and settings. Create a new project and fill in the fields with the following values: * **Display Name** - the project display name * **Security Token** - Some project settings can include sensitive values, such as API keys or other shared secrets. Each project will generate a security token that can be used to encrypt/decrypt sensitive project settings. You can find security tokens in the Application Settings by clicking the gear icon in the lower corner of the left navigation bar. * **Source Connection** - The Azure blob storage container connection you created in the previous step that you would like to use for this project. * **Folder Path** - Optional - If your source forms are located in a sub-folder on the blob container, specify the folder name here * **Form Recognizer Service Uri** - Your Form Recognizer endpoint URL. It should have such format: https://&lt;your-name&gt;.cognitiveservcices.azure.com. * **API Key** - Your Form Recognizer subscription key. * **Description** - Optional - Project description ![alt text](docs/images/new-project.png "New Project") ### Label your forms When you create or open a project, the main tag editor window opens. The tag editor consists of three parts: * A preview pane that contains a scrollable list of forms from the source connection. * The main editor pane that allows you to label text by applying tags. * The tags editor pane that allows users to modify, reorder, and delete tags. #### Identify text elements and tables Click **Run OCR on all files** on the left pane to get the text layout information for each document. The labeling tool will draw bounding boxes around each text element and display an icon at the top left corner of each table. You can click a table's icon to display that table's identified borders #### Apply labels to text Next, you'll create labels and apply them to the text elements that you want the model to recognize. There are many key-value pairs in a document you would like to train a model to extract, the first step is to label the value of the key-value pair. For example, you see text `Charge: 1002.00` in a form, and you would like to label the value (1002.00), so that AI model could be trained to extract such information on similar forms. 1. First, use the tags editor pane to create the tags (labels) you'd like to identify, e.g, "Cost". 2. In the main editor, click and drag to select one or multiple words from the highlighted text elements. e.g., "1002.00". Note: You cannot currently select text that spans across multiple pages. 3. Click on the tag you want to apply, or press corresponding keyboard key (e.g., key '1' for the first tag). You can only apply one tag to each selected text element, and each tag can only be applied once per page. Follow the above steps to label five of your forms, and then move on to the next step. ![alt text](docs/images/apply-labels.png "Apply Labels") #### Specify tag type and format You can specify tag type and format with tag contextual menu. The type and format information will be stored in fields.json in the source location. The information will be used in post-processing to get better result. ![alt text](docs/images/specify-tag-type-format.png "Specify Tag Type and Format") #### Train a custom model Click the Train icon on the left pane to open the Training page. Then click the **Train** button to begin training the model. Once the training process completes, you'll see the following information: * **Model ID** - The ID of the model that was created and trained. Each training call creates a new model with its own ID. Copy this string to a secure location; you'll need it if you want to do prediction/analysis calls through the REST API. * **Average Accuracy** - The model's average accuracy. You can improve model accuracy by labeling additional forms and training again to create a new model. We recommend starting by labeling five forms and adding more forms as needed. * The list of tags, and the estimated accuracy per tag. ![alt text](docs/images/train-model.png "Train Model") After training finishes, examine the **Average Accuracy** value. If it's low, you should add more input documents and repeat the steps above. The documents you've already labeled will remain in the project index. Tip: You can also run the training process with a REST API call. To learn how to do this, see [Train with labels using Python](https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/quickstarts/python-labeled-data). #### Analyze a form #### Click on the Analyze icon on the left pane to open the Analyze page. Upload a form document that you haven't used in the training process. Then click the **Analyze** button on the right to get key-value predictions/analyses for the form. The tool will highlight fields and its bounding boxes and will report the confidence of each value. ![alt text](docs/images/analyze-form.png "Analyze Form") Tip: You can also run the Analyze API with a REST call. To learn how to do this, see [Train with labels using Python](https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/quickstarts/python-labeled-data). #### Compose a model #### Click the Compose icon on the left pane to open the Compose page. FoTT will display the first page of your models—by decending order of Model ID—in a list. Select multiple models you want to compose into one model and click the **Compose** button. Once the new model has been composed, it's ready to analyze with. ![alt text](docs/images/compose.png "Compose") To load more of your models, click the **Load next page** button at the bottom of the list. This will load the next page of your models by decending order of model ID. You can sort the currently loaded models by clicking the column headers at the top of the list. Only the currently loaded models will be sorted. You will need to load all pages of your models first and then sort to view the complete sorted list of your models. #### Save a project and resume later #### To resume your project at another time or in another browser, you need to save your project's security token and reenter it later. ##### Get project credentials ##### Go to your project settings page (document setting icon) and take note of the security token name. Then go to your application settings (gear icon), which shows all of the security tokens in your current browser instance. Find your project's security token and copy its name and key value to a secure location. ##### Restore project credentials ##### When you want to resume your project, you first need to create a connection to the same blob storage container. Repeat the steps above to do this. Then, go to the application settings page (gear icon) and see if your project's security token is there. If it isn't, add a new security token and copy over your token name and key from the previous step. Then click Save Settings. ##### Resume a project ##### Finally, go to the main page (house icon) and click Open Cloud Project. Then select the blob storage connection, and select your project's .proj file. The application will load all of the project's settings because it has the security token. ##### Share a project FoTT allow sharing of projects with somebody who use the tool too and share access to same Azure Blob Storage container where a project is located. In order to share project follow these steps: ###### On the sending side: 1. Open the project you want to share in the tool. In the right top corner find and click "share" icon ![alt text](docs/images/share-icon.png "Share project menu icon"). You should see a message pop-up saying that your share string been saved in your clipboard. 2. Share the string in you clipboard via any convenient way for you. ###### On the receiving side: 1. Go to the "Home Page", and click on "Open Cloud Project". 2. Insert shared string to appropriate field in the pop-up. 3. Click okay. #### Keyboard Shortcuts and useful tips #### Labeling tool allows a number of keyboard shortcuts to support accessibility and also sometimes make labeling easier and faster. You can view them by clicking the following icon on the right side of the title bar:\ ![alt text](docs/images/keyboard-shortcuts-icon.png "Keyboard shortcuts menu icon") Hotkeys of 1 through 0 and all letters are assigned to first 36 tags, after you selected one or multiple words from the highlighted text elements, by pressing these hotkeys, you can label the selected words. '[' and ']' keys can be used move the selection to the previous or the next word. '<' and '>' keys can be used go to the previous or the next page in multi-pages documents. '-', '+' and '/' keys can be used to zoom in/out and reset zoom of editing page. Hold Alt key and click on tag name, user can change the tag's name. To delete all labels for a tag - select all labels for a tag on document then press 'delete' key. ## Collaborators This project is cloned and modified from [VoTT](https://github.com/microsoft/VoTT) project. ## Contributing There are many ways to contribute to Form OCR Testing Tool -- please review our [contribution guidelines](CONTRIBUTING.md). 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. * [简体中文](README.zh-cn.md) * [日本語](README.ja-jp.md)

Data Labeling RPA
538 Github Stars
0xDeCA10B
Open Source

0xDeCA10B

# Sharing Updatable Models (SUM) on Blockchain (formerly Decentralized & Collaborative AI on Blockchain) <img src="./assets/logo.gif?raw=true" width=500 alt="Animated logo for the project. A neural network appears on a block. The nodes change color until finally converging. The block slides away on a chain and the process restarts on the next blank block."> <!-- Put horizontally since build status badges are normally horizontal. --> | [Demo][demo-folder] | [Simulation][simulation-folder] | Security | |:-:|:-:|:-:| | [![Demo: Test](https://github.com/microsoft/0xDeCA10B/actions/workflows/demo-test.yml/badge.svg?branch=main)](https://github.com/microsoft/0xDeCA10B/actions/workflows/demo-test.yml) | [![Simulation: Test](https://github.com/microsoft/0xDeCA10B/actions/workflows/simulation-test.yml/badge.svg?branch=main)](https://github.com/microsoft/0xDeCA10B/actions/workflows/simulation-test.yml) | [![Build Status](https://dev.azure.com/maluuba/0xDeCA10B/_apis/build/status/Security%20Checks?branchName=main)](https://dev.azure.com/maluuba/0xDeCA10B/_build/latest?definitionId=118&branchName=main) | **Sharing Updatable Models (SUM) on Blockchain** is a framework to host and train publicly available machine learning models. Ideally, using a model to get a prediction is free. Adding data consists of validation by three steps as described below. <img src="./assets/architecture_flow.png?raw=true" width=500 alt="Picture of a someone sending data to the addData method in CollaborativeTrainer which sends data to the 3 main components as further described next."> 1. The **IncentiveMechanism** validates the request to add data, for instance, in some cases a "stake" or deposit is required. In some cases, the incentive mechanism can also be triggered later to provide users with payments or virtual "karma" points. 2. The **DataHandler** stores data and meta-data on the blockchain. This ensures that it is accessible for all future uses, not limited to this smart contract. 3. The machine learning **model** is updated according to predefined training algorithms. In addition to adding data, anyone can query the model for predictions **for free**. The basics of the framework can be found in our [blog post][blog1]. A demo of one incentive mechanism can be found [here][demo]. More details can be found in the [initial paper][overview-paper] describing the framework, accepted to Blockchain-2019, The IEEE International Conference on Blockchain. This repository contains: * [Demos][demo-folder] showcasing some proof of concept systems using the Ethereum blockchain. There is a locally deployable test blockchain and demo dashboard to interact with smart contracts written in Solidity. * [Simulation tools][simulation-folder] written in Python to quickly see how models and incentive mechanisms would work when deployed. <img src="./assets/aka.ms 0xDeCA10B QR.png?raw=true" width=250 alt="Picture of a QR code with aka.ms/0xDeCA10B written in the middle."> # FAQ/Concerns ## Aren't smart contracts just for simple code? There are many options. We can restrict the framework to simple models: Perceptron, Naive Bayes, Nearest Centroid, etc. We can also combine off-chain computation with on-chain computation in a few ways such as: * encoding off-chain to a higher dimensional representation and just have the final layers of the model fine-tuned on-chain, * using secure multiparty computation, or * using external APIs, or as they are called the blockchain space, oracles, to train and run the model We can also use algorithms that do not require all models parameters to be updated (e.g. Perceptron). We hope to inspire more research in efficient ways to update more complex models. Some of those proposals are not in the true spirit of this system which is to share models completely publicly but for some applications they may be suitable. At least the data would be shared so others can still use it to train their own models. ## Will transaction fees be too high? Fees in Ethereum are low enough for simple models: a few cents as of July 2019. Simple machine learning models are good for many applications. As described the previous answer, there are ways to keep transactions simple. Fees are decreasing: Ethereum is switching to proof of stake. Other blockchains may have lower or possibly no fees. ## What about storing models off-chain? Storing the model parameters off-chain, e.g. using IPFS, is an option but many of the popular solutions do not have robust mirroring to ensure that the model will still be available if a node goes down. One of the major goals of this project is to share models and improve their availability, the easiest way to do that now is to have the model stored and trained in a smart contract. We're happy to make improvements! If you do know of a solution that would be cheaper and more robust than storing models on a blockchain like Ethereum then let us know by filing an issue! ## What if I just spam bad data? This depends on the incentive mechanism (IM) chosen but essentially, you will lose a lot of money. Others will notice the model is performing badly or does not work as expected and then stop contributing to it. Depending on the IM, such as in Deposit, Refund, and Take: Self-Assessment, others that already submitted "good" data will gladly take your deposits without submitting any more data. Furthermore, people can easily automatically correct your data using techniques from unsupervised learning such as clustering. They can then use the data offline for their own private model or even deploy a new collection system using that model. ## What if no one gives bad data, then no one can profit? That’s great! This system will work as a source for quality data and models. People will contribute data to help improve the machine learning models they use in their daily life. Profit depends on the incentive mechanism (IM). Yes, in Deposit, Refund, and Take: Self-Assessment, the contributors will not profit and should be able to claim back their own deposits. In the Prediction Market based mechanism, contributors can still get rewarded by the original provider of the bounty and test set. # Learn More ## Papers More details can be found in our initial paper, [Decentralized & Collaborative AI on Blockchain][overview-paper], which describes the framework, accepted to Blockchain-2019, The IEEE International Conference on Blockchain. An analysis of several machine learning models with the self-assessment incentive mechanism can be found in our second paper, [Analysis of Models for Decentralized and Collaborative AI on Blockchain][self-assessment-analysis-paper], which was accepted to [The 2020 International Conference on Blockchain](http://blockchain1000.org/2020/). # 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.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., label, 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. [demo-folder]: demo/ [simulation-folder]: simulation/ [demo]: https://aka.ms/0xDeCA10B-demo [blog1]: https://aka.ms/0xDeCA10B-blog1 [overview-paper]: https://aka.ms/0xDeCA10B-paper [self-assessment-analysis-paper]: https://arxiv.org/abs/2009.06756

AI Agents Digital Product Sales
608 Github Stars
BotFramework-WebChat
Open Source

BotFramework-WebChat

# ![Bot Framework Web Chat](https://raw.githubusercontent.com/microsoft/BotFramework-WebChat/main/media/BotFrameworkWebChat_header.png) ### [Click here to find out what is new in Web Chat](https://github.com/microsoft/BotFramework-WebChat/blob/main/CHANGELOG.md) # Bot Framework Web Chat [![npm version](https://badge.fury.io/js/botframework-webchat.svg)](https://badge.fury.io/js/botframework-webchat) [![Build Status](https://fuselabs.visualstudio.com/BotFramework-WebChat/_apis/build/status/BotFramework-WebChat-daily?branchName=main)](https://fuselabs.visualstudio.com/BotFramework-WebChat/_build/latest?definitionId=498&branchName=main) This repository contains code for the Bot Framework Web Chat component. The Bot Framework Web Chat component is a highly-customizable web-based client for the Bot Framework v4 SDK. The Bot Framework SDK v4 enables developers to model conversation and build sophisticated bot applications. This repository is part of the [Microsoft Bot Framework](https://github.com/microsoft/botframework) - a comprehensive framework for building enterprise-grade conversational AI experiences. Web Chat supports [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP). Web developers are recommended to enable CSP to improve security and protect conversations. You can read more about CSP in [this article](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/CONTENT_SECURITY_POLICY.md). Note: The [Bot Framework SDK](https://github.com/microsoft/botframework-sdk) was archived on GitHub on December 2025. *This* Web Chat component specifically is *not* archived, and still is available on GitHub as under the related licences covered in this readme. <hr /> # Version notes > This section points out important version notes. For further information, please see the related links and check the [`CHANGELOG.md`](https://github.com/microsoft/BotFramework-WebChat/blob/main/CHANGELOG.md) [Our achievements](https://github.com/microsoft/BotFramework-WebChat/blob/main/ACHIEVEMENTS.md) Notes: web developers are advised to use [`~` (tilde range)](https://github.com/npm/node-semver?tab=readme-ov-file#tilde-ranges-123-12-1) to select minor versions, which contains new features and/or fixes. Use [`^` (caret range)](https://github.com/npm/node-semver?tab=readme-ov-file#caret-ranges-123-025-004) to select major versions, which may contains breaking changes. ## 4.19.0 notable changes - Supports informative message in [livestreaming](./docs/LIVESTREAMING.md) ## 4.18.0 notable changes In this release, we are focusing on performance improvements, including memory and load time optimizations. ## 4.17.0 notable changes ### Support livestreaming response Bots can now livestream their responses. Before Bot Framework SDK support this feature, bot authors can follow the details in [LIVESTREAMING.md](./docs/LIVESTREAMING.md) to construct the livestream responses. ### Debut of ES Modules Web Chat now exports as ES Modules (named exports) along with CommonJS (named and unnamed exports). ### Improvement to file upload experience End-user can now add a message and confirm before uploading their file to the bot. To opt-out of the new experience, pass `sendAttachmentOn: 'send'` in style options. ### Theme pack support We are excited to add theme pack support. Developers can now pack all their customization in a single package and publish it to NPM. ### Experimental Fluent UI theme pack We are excited to announce Fluent UI theme pack is in the work and is currently in experimental phase. This theme pack is designed for web developers who want to bring a native Copilot user experience to their customers. We will continue to add new features and support both white-label experience and Fluent UI experience with the same level of parity. You can wrap Web Chat with `<FluentThemeProvider>` to try out the new experience. ```tsx import ReactWebChat from 'botframework-webchat'; import { FluentThemeProvider } from 'botframework-webchat-fluent-theme'; export default function MyComponent() { return ( <FluentThemeProvider> <ReactWebChat /> </FluentThemeProvider> ); } ``` #### Support HTML-in-Markdown Web Chat will now render HTML-in-Markdown. We have ported our sanitizer and accessibility fixer to work on HTML level. Both Markdown and HTML-in-Markdown will receive the same treatment and meet our security and accessibility requirements. You can turn off this option by setting `styleOptions.markdownRenderHTML` to `false`. ## 4.16.1 notable changes Web Chat now supports [Adaptive Cards schema up to 1.6](https://adaptivecards.io/explorer/). Some features in Adaptive Cards are in preview or designed to use outside of Bot Framework. Web Chat does not support these features. ## 4.16.0 notable changes Starting from 4.16.0, Internet Explorer is no longer supported. After more than a year of the Internet Explorer 11 officially retirement, we decided to stop supporting Internet Explorer. This will help us to bring new features to Web Chat. 4.15.9 is the last version which supports Internet Explorer in limited fashion. ## 4.12.1 patch: New style property `adaptiveCardsParserMaxVersion` Web Chat 4.12.1 patch includes a new style property allowing developers to choose the max Adaptive Cards schema version. See [PR #3778](https://github.com/microsoft/BotFramework-WebChat/pull/3778) for code changes. To specify a different max version, you can adjust the style options, shown below: ```js window.WebChat.renderWebChat( { directLine, store, styleOptions: { adaptiveCardsParserMaxVersion: '1.2' } }, document.getElementById('webchat') ); ``` - Web Chat will apply the maximum schema available according to the Adaptive Cards version (as of this patch, schema 1.3) by default. - An invalid version will revert to Web Chat's default. ## Visual focus changes to transcript in Web Chat 4.12.0 A new accessibility update has been added to Web Chat from PR [#3703](https://github.com/microsoft/BotFramework-WebChat/pull/3703). This change creates visual focus for the transcript (bold black border) and `aria-activedescendent` focused activity (black dashed border) by default. Where applicable, `transcriptVisualKeyboardIndicator...` values will also be applied to carousel (`CarouselFilmStrip.js`) children. This is done in order to match current default focus styling for Adaptive Cards, which may be a child of a carousel. To modify these styles, you can change the following props via `styleOptions`: ``` transcriptActivityVisualKeyboardIndicatorColor: DEFAULT_SUBTLE, transcriptActivityVisualKeyboardIndicatorStyle: 'dashed', transcriptActivityVisualKeyboardIndicatorWidth: 1, transcriptVisualKeyboardIndicatorColor: 'Black', transcriptVisualKeyboardIndicatorStyle: 'solid', transcriptVisualKeyboardIndicatorWidth: 2, ``` The above code shows the default values you will see in Web Chat. ## API refactor into new package in Web Chat 4.11.0 The Web Chat API has been refactored into a separate package. To learn more, check out the [API refactor summary](https://github.com/microsoft/BotFramework-WebChat/pull/3543). ## Direct Line Speech support in Web Chat 4.7.0 Starting from Web Chat 4.7.0, Direct Line Speech is supported, and it is the preferred way to provide an integrated speech functionality in Web Chat. We are working on [closing feature gaps](https://github.com/microsoft/BotFramework-WebChat/labels/Direct%20Line%20Speech) between Direct Line Speech and Web Speech API (includes Cognitive Services and browser-provided speech functionality). ## Upgrading to 4.6.0 Starting from Web Chat 4.6.0, Web Chat requires React 16.8.6 or up. Although we recommend that you upgrade your host app at your earliest convenience, we understand that host app may need some time before its React dependencies are updated, especially in regards to huge applications. If your app is not ready for React 16.8.6 yet, you can follow the [hybrid React sample](https://github.com/microsoft/BotFramework-WebChat/tree/main/samples/01.getting-started/g.hybrid-react-npm) to dual-host React in your app. ## Speech changes in Web Chat 4.5.0 There is a breaking change on behavior expectations regarding speech and input hint in Web Chat. Please refer to the section on [input hint behavior before 4.5.0](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/SPEECH.md#input-hint-behavior-before-4-5-0) for details. ## Migrating from Web Chat v3 to v4 [View migration docs](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/MIGRATION.md) to learn about migrating from Web Chat v3. <hr /> # How to use First, create a bot using [Azure Bot Service](https://azure.microsoft.com/en-us/services/bot-service/). Once the bot is created, you will need to [obtain the bot's Web Chat secret](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-webchat?view=azure-bot-service-3.0#step-1) in Azure Portal. Then use the secret to [generate a token](https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-authentication?view=azure-bot-service-4.0) and pass it to your Web Chat. ## Connect a client app to bot Web Chat provides UI on top of the Direct Line and Direct Line Speech Channels. There are two ways to connect to your bot through HTTP calls from the client: by sending the Bot secret or generating a token via the secret. <!-- TODO: https://github.com/microsoft/BotFramework-WebChat/issues/2151 (ongoing) --> <!-- Update the following paragraph and the API table (`directline`) with new documentation when updated docs are published --> We strongly recommend using the token API instead of providing the app with your secret. To learn more about why, see the [authentication documentation](https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-authentication?view=azure-bot-service-4.0) on the [token API](https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-api-reference?view=azure-bot-service-4.0) and client security. For further reading, please see the following links: - Using Web Chat with [Azure Bot Services authentication](https://blog.botframework.com/2018/09/01/using-webchat-with-azure-bot-services-authentication/) - [Enhanced Direct Line authentication features](https://blog.botframework.com/2018/09/25/enhanced-direct-line-authentication-features/) ## Integrate with JavaScript Web Chat is designed to integrate with your existing website using JavaScript or React. Integrating with JavaScript will give you moderate styling and customizability options. You can use the full, typical Web Chat package (called full-feature bundle) that contains the most typically used features. Here is how how you can add Web Chat control to your website: <!-- prettier-ignore-start --> ```html <!DOCTYPE html> <html> <head> <script crossorigin="anonymous" src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js" ></script> <style> html, body { height: 100%; } body { margin: 0; } #webchat { height: 100%; width: 100%; } </style> </head> <body> <div id="webchat" role="main"></div> <script> window.WebChat.renderWebChat( { directLine: window.WebChat.createDirectLine({ token: 'YOUR_DIRECT_LINE_TOKEN' }), userID: 'YOUR_USER_ID', username: 'Web Chat User', locale: 'en-US' }, document.getElementById('webchat') ); </script> </body> </html> ``` <!-- prettier-ignore-end --> > `userID`, `username`, and `locale` are all optional parameters to pass into the `renderWebChat` method. To learn more about Web Chat props, look at the [Web Chat API Reference](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/API.md) documentation. > Assigning `userID` as a static value is not recommended since this will cause all users to share state. Please see the [`API userID entry`](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/API.md#userID) for more information. More information on localization can be found in the [Localization](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/LOCALIZATION.md) documentation. ![Screenshot of Web Chat](https://raw.githubusercontent.com/microsoft/BotFramework-WebChat/main/media/weatherquery.png.jpg) See the working sample of the [full Web Chat bundle](https://github.com/microsoft/BotFramework-WebChat/tree/main/samples/01.getting-started/a.full-bundle). ## Integrate with React For full customizability, you can use React to recompose components of Web Chat. To install the production build from NPM, run `npm install botframework-webchat`. See our [version notes](#version-notes) on how to select a version. <!-- prettier-ignore-start --> ```js import React, { useMemo } from 'react'; import ReactWebChat, { createDirectLine } from 'botframework-webchat'; export default () => { const directLine = useMemo(() => createDirectLine({ token: 'YOUR_DIRECT_LINE_TOKEN' }), []); return <ReactWebChat directLine={directLine} userID="YOUR_USER_ID" />; }; ``` <!-- prettier-ignore-end --> > You can also run `npm install botframework-webchat@main` to install a development build that is synced with Web Chat's GitHub `main` branch. See the working sample of [Web Chat rendered via React](https://github.com/microsoft/BotFramework-WebChat/tree/main/samples/01.getting-started/e.host-with-react/). ### Experimental support for Redux DevTools Web Chat internally use Redux for state management. [Redux DevTools](https://github.com/reduxjs/redux-devtools) is enabled in the NPM build as an opt-in feature. This is for glancing into how Web Chat works. This is not an API explorer and is not an endorsement of using the Redux store to programmatically access the UI. The [hooks API](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/HOOKS.md) should be used instead. To use Redux DevTools, use the `createStoreWithDevTools` function for creating a Redux DevTools-enabled store. <!-- prettier-ignore-start --> ```diff import React, { useMemo } from 'react'; - import ReactWebChat, { createDirectLine, createStore } from 'botframework-webchat'; + import ReactWebChat, { createDirectLine, createStoreWithDevTools } from 'botframework-webchat'; export default () => { const directLine = useMemo(() => createDirectLine({ token: 'YOUR_DIRECT_LINE_TOKEN' }), []); - const store = useMemo(() => createStore(), []); + const store = useMemo(() => createStoreWithDevTools(), []); return <ReactWebChat directLine={directLine} store={store} userID="YOUR_USER_ID" />; }; ``` <!-- prettier-ignore-end --> There are some limitations when using the Redux DevTools: - The Redux store uses side-effects via [`redux-saga`](https://github.com/redux-saga/redux-saga). Time-traveling may break the UI. - Many UI states are stored in React context and state. They are not exposed in the Redux store. - Some time-sensitive UIs are based on real-time clock and not affected by time-traveling. - Dispatching actions are not officially supported. Please use [hooks API](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/HOOKS.md) instead. - Actions and reducers may move in and out of Redux store across versions. [Hooks API](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/HOOKS.md) is the official API for accessing the UI. # Customizing the Web Chat UI Web Chat is designed to be customizable without forking the source code. The table below outlines what kind of customizations you can achieve when you are importing Web Chat in different ways. This list is not exhaustive. | | CDN bundle | React | | ----------------------------- | :--------: | :------: | | Change colors | &#10004; | &#10004; | | Change sizes | &#10004; | &#10004; | | Update/replace CSS styles | &#10004; | &#10004; | | Listen to events | &#10004; | &#10004; | | Interact with hosting webpage | &#10004; | &#10004; | | Custom render activities | | &#10004; | | Custom render attachments | | &#10004; | | Add new UI components | | &#10004; | | Recompose the whole UI | | &#10004; | See more about [customizing Web Chat](https://github.com/microsoft/BotFramework-WebChat/blob/main/samples/README.md) to learn more on customization. ## Supported Activity Types on the Web Chat Client Bot Framework has many activity types, but not all are supported in Web Chat. [View activity types docs](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/ACTIVITYTYPES.md) to learn more. # Samples list [View the complete list of Web Chat samples](https://github.com/microsoft/BotFramework-WebChat/tree/main/samples) for more ideas on customizing Web Chat. # Further reading ## API Reference View the [API documentation](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/API.md) for implementing Web Chat. ## Browser compatibility Web Chat supports the latest 2 versions of modern browsers like Chrome, Microsoft Edge, and FireFox. If you need Web Chat in Internet Explorer 11, please see the [ES5 bundle demo](https://microsoft.github.io/BotFramework-WebChat/01.getting-started/c.es5-bundle). Please note, however: - Web Chat does not support Internet Explorer older than version 11 - Customization as shown in non-ES5 samples are not supported for Internet Explorer. Because IE11 is a non-modern browser, it does not support ES6, and many samples that use arrow functions and modern promises would need to be manually converted to ES5. If you are in need of heavy customization for your app, we strongly recommend developing your app for a modern browser like Google Chrome or Microsoft Edge. - Web Chat has no plan to support samples for IE11 (ES5). - For customers who wish to manually rewrite our other samples to work in IE11, we recommend looking into converting code from ES6+ to ES5 using polyfills and transpilers like [`babel`](https://babeljs.io/docs/en/next/babel-standalone.html). ## Accessibility View the [accessibility documentation](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/ACCESSIBILITY.md). ## Localization View the [localization documentation](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/LOCALIZATION.md) for implementing in Web Chat. ## Notifications View the [notification documentation](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/NOTIFICATION.md) for implementing in Web Chat. ## Telemetry View the [telemetry documentation](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/TELEMETRY.md) for implementing in Web Chat. ## Technical Support Guide View the [Technical Support Guide](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/TECHNICAL_SUPPORT_GUIDE.md) to get guidance and help on troubleshooting in the Web Chat repo for more information before filing a new issue. ## Speech Web Chat supports a wide-range of speech engines for a natural chat experience with a bot. This section outlines the different engines that are supported: - [Direct Line Speech](#integrate-with-direct-line-speech) - [Cognitive Services Speech Services](#integrate-with-cognitive-services-speech-services) - [Browser-provided engine or other engines](#browser-provided-engine-or-other-engines) ### Integrate with Direct Line Speech Direct Line Speech is the preferred way to add speech functionality in Web Chat. Please refer to the [Direct Line Speech](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/DIRECT_LINE_SPEECH.md) documentation for details. ### Integrate with Cognitive Services Speech Services You can use Cognitive Services Speech Services to add speech functionality to Web Chat. Please refer to the [Cognitive Services Speech Services](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/SPEECH.md) documentation for details. ### Browser-provided engine or other engines You can also use any speech engines which support [W3C Web Speech API standard](https://wicg.github.io/speech-api/). Some browsers support the [Speech Recognition API](https://caniuse.com/#feat=mdn-api_speechrecognition) and the [Speech Synthesis API](https://caniuse.com/#feat=mdn-api_speechsynthesis). You can mix-and-match different engines - including Cognitive Services Speech Services - to provide best user experience. <hr /> # How to test with Web Chat's latest bits Web Chat latest bits are available on the [Web Chat daily releases page](https://github.com/microsoft/BotFramework-WebChat/releases/daily). Dailies will be released after 3:00AM Pacific Standard Time when changes have been committed to the main branch. # Contributing See our [Contributing page](https://github.com/microsoft/BotFramework-WebChat/tree/main/.github/CONTRIBUTING.md) for details on how to build the project and our repository guidelines for Pull Requests. See our [CODE OF CONDUCT page](https://github.com/microsoft/BotFramework-WebChat/blob/main/.github/CODE_OF_CONDUCT.md) for details about the Microsoft Code of Conduct. # Reporting Security Issues [View the security documentation](https://github.com/microsoft/BotFramework-WebChat/tree/main/docs/SECURITY.md) to learn more about reporting security issues.

Web Components & Widgets API Tools
1.8K Github Stars
maro
Open Source

maro

[![License](https://img.shields.io/pypi/l/pymaro)](https://github.com/microsoft/maro/blob/master/LICENSE) [![Platform](https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/platform.svg)](https://pypi.org/project/pymaro/) [![Python Versions](https://img.shields.io/pypi/pyversions/pymaro.svg?logo=python&logoColor=white)](https://pypi.org/project/pymaro/#files) [![Code Size](https://img.shields.io/github/languages/code-size/microsoft/maro)](https://github.com/microsoft/maro) [![Docker Size](https://img.shields.io/docker/image-size/maro2020/maro)](https://hub.docker.com/repository/docker/maro2020/maro/tags?page=1) [![Issues](https://img.shields.io/github/issues/microsoft/maro)](https://github.com/microsoft/maro/issues) [![Pull Requests](https://img.shields.io/github/issues-pr/microsoft/maro)](https://github.com/microsoft/maro/pulls) [![Dependencies](https://img.shields.io/librariesio/github/microsoft/maro)](https://libraries.io/pypi/pymaro) [![test](https://github.com/microsoft/maro/workflows/test/badge.svg)](https://github.com/microsoft/maro/actions?query=workflow%3Atest) [![build](https://github.com/microsoft/maro/workflows/build/badge.svg)](https://github.com/microsoft/maro/actions?query=workflow%3Abuild) [![docker](https://github.com/microsoft/maro/workflows/docker/badge.svg)](https://hub.docker.com/repository/docker/maro2020/maro) [![docs](https://readthedocs.org/projects/maro/badge/?version=latest)](https://maro.readthedocs.io/) [![PypI Versions](https://img.shields.io/pypi/v/pymaro)](https://pypi.org/project/pymaro/#files) [![Wheel](https://img.shields.io/pypi/wheel/pymaro)](https://pypi.org/project/pymaro/#files) [![Citi Bike](https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/citi_bike.svg)](https://maro.readthedocs.io/en/latest/scenarios/citi_bike.html) [![CIM](https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/cim.svg)](https://maro.readthedocs.io/en/latest/scenarios/container_inventory_management.html) [![VM Scheduling](https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/vm_scheduling.svg)](https://maro.readthedocs.io/en/latest/scenarios/vm_scheduling.html) [![Gitter](https://img.shields.io/gitter/room/microsoft/maro)](https://gitter.im/Microsoft/MARO#) [![Stack Overflow](https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/stack_overflow.svg)](https://stackoverflow.com/questions/ask?tags=maro) [![Releases](https://img.shields.io/github/release-date-pre/microsoft/maro)](https://github.com/microsoft/maro/releases) [![Commits](https://img.shields.io/github/commits-since/microsoft/maro/latest/master)](https://github.com/microsoft/maro/commits/master) [![Vulnerability Scan](https://github.com/microsoft/maro/workflows/vulnerability%20scan/badge.svg)](https://github.com/microsoft/maro/actions?query=workflow%3A%22vulnerability+scan%22) [![Lint](https://github.com/microsoft/maro/workflows/lint/badge.svg)](https://github.com/microsoft/maro/actions?query=workflow%3Alint) [![Coverage](https://img.shields.io/codecov/c/github/microsoft/maro)](https://codecov.io/gh/microsoft/maro) [![Downloads](https://img.shields.io/pypi/dm/pymaro)](https://pypi.org/project/pymaro/#files) [![Docker Pulls](https://img.shields.io/docker/pulls/maro2020/maro)](https://hub.docker.com/repository/docker/maro2020/maro) [![Play with MARO](https://raw.githubusercontent.com/microsoft/maro/master/docs/source/images/badges/play_with_maro.svg)](https://hub.docker.com/r/maro2020/maro) # [![MARO LOGO](./docs/source/images/logo.svg)](https://maro.readthedocs.io/en/latest/) Multi-Agent Resource Optimization (MARO) platform is an instance of Reinforcement learning as a Service (RaaS) for real-world resource optimization. It can be applied to many important industrial domains, such as [container inventory management](https://maro.readthedocs.io/en/latest/scenarios/container_inventory_management.html) in logistics, [bike repositioning](https://maro.readthedocs.io/en/latest/scenarios/citi_bike.html) in transportation, [virtual machine](https://maro.readthedocs.io/en/latest/scenarios/vm_scheduling.html) provisioning in data centers, and asset management in finance. Besides [Reinforcement Learning](https://www.andrew.cmu.edu/course/10-703/textbook/BartoSutton.pdf) (RL), it also supports other planning/decision mechanisms, such as [Operations Research](https://en.wikipedia.org/wiki/Operations_research). Key Components of MARO: - Simulation toolkit: it provides some predefined scenarios, and the reusable wheels for building new scenarios. - RL toolkit: it provides a full-stack abstraction for RL, such as agent manager, agent, RL algorithms, learner, actor, and various shapers. - Distributed toolkit: it provides distributed communication components, interface of user-defined functions for message auto-handling, cluster provision, and job orchestration. ![MARO Key Components](./docs/source/images/maro_overview.svg) ## Contents | File/folder | Description | | ----------- | ------------------------------------------------------------------------------------------------- | | `maro` | MARO source code. | | `docs` | MARO docs, it is host on [readthedocs](https://maro.readthedocs.io/en/latest/). | | `examples` | Showcase of MARO. | | `notebooks` | MARO quick-start notebooks. | *Try [MARO playground](#run-playground) to have a quick experience.* ## Install MARO from [PyPI](https://pypi.org/project/pymaro/#files) *Notes: The CLI commands (including the visualization tool) are not included in pymaro package. To enable these support, you need to install from source.* - Mac OS / Linux ```sh pip install pymaro ``` - Windows ```powershell # Install torch first, if you don't have one. pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html pip install pymaro ``` ## Install MARO from Source *Notes: Install from source if you want to use the CLI commands (including the visualization tool).* - Prerequisites - C++ Compiler - Linux or Mac OS X: `gcc` - Windows: [Build Tools for Visual Studio 2017](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15) - Enable Virtual Environment - Mac OS / Linux ```sh # If your environment is not clean, create a virtual environment firstly. python -m venv maro_venv source ./maro_venv/bin/activate ``` - Windows ```powershell # If your environment is not clean, create a virtual environment firstly. python -m venv maro_venv # You may need this for SecurityError in PowerShell. Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted # Activate the virtual environment. .\maro_venv\Scripts\activate ``` - Install MARO ```sh # Git Clone the whole source code. git clone https://github.com/microsoft/maro.git ``` - Mac OS / Linux ```sh # Install MARO from source. bash scripts/install_maro.sh; pip install -r ./requirements.dev.txt; ``` - Windows ```powershell # Install MARO from source. .\scripts\install_maro.bat; pip install -r ./requirements.dev.txt; ``` - *Notes: If your package is not found, remember to set your PYTHONPATH* - Mac OS / Linux ```sh export PYTHONPATH=PATH-TO-MARO ``` - Windows ```powershell $Env:PYTHONPATH=PATH-TO-MARO ``` ## Quick Example ```python from maro.simulator import Env env = Env(scenario="cim", topology="toy.5p_ssddd_l0.0", start_tick=0, durations=100) metrics, decision_event, is_done = env.step(None) while not is_done: metrics, decision_event, is_done = env.step(None) print(f"environment metrics: {env.metrics}") ``` ## [Environment Visualization](https://maro.readthedocs.io/en/latest/) ```sh # Enable environment dump feature, when initializing the environment instance env = Env(scenario="cim", topology="toy.5p_ssddd_l0.0", start_tick=0, durations=100, options={"enable-dump-snapshot": "./dump_data"}) # Inspect environment with the dump data maro inspector dashboard --source_path ./dump_data/YOUR_SNAPSHOT_DUMP_FOLDER ``` ### Show Cases - Case I - Container Inventory Management ![CIM Inter Epoch](./docs/source/images/visualization/dashboard/cim_inter_epoch.gif) ![CIM Intra Epoch](./docs/source/images/visualization/dashboard/cim_intra_epoch_by_ports.gif) - Case II - Citi Bike ![Citi Bike Inter Epoch](./docs/source/images/visualization/dashboard/citi_bike_inter_epoch.gif) ![Citi Bike Intra Epoch](./docs/source/images/visualization/dashboard/citi_bike_intra_epoch_by_station.gif) ## Run Playground - Pull from [Docker Hub](https://hub.docker.com/r/maro2020/playground) ```sh # Pull the docker image from docker hub docker pull maro2020/playground # Run playground container. # Redis commander (GUI for redis) -> http://127.0.0.1:40009 # Jupyter lab with maro -> http://127.0.0.1:40010 docker run -p 40009:40009 -p 40010:40010 maro2020/playground ``` - Build from source - Mac OS / Linux ```sh # Build playground image. bash ./scripts/build_playground.sh # Run playground container. # Redis commander (GUI for redis) -> http://127.0.0.1:40009 # Jupyter lab with maro -> http://127.0.0.1:40010 docker run -p 40009:40009 -p 40010:40010 maro2020/playground ``` - Windows ```powershell # Build playground image. .\scripts\build_playground.bat # Run playground container. # Redis commander (GUI for redis) -> http://127.0.0.1:40009 # Jupyter lab with maro -> http://127.0.0.1:40010 docker run -p 40009:40009 -p 40010:40010 maro2020/playground ``` ## 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. ## Related Papers ### [Container Inventory Management](https://maro.readthedocs.io/en/latest/scenarios/container_inventory_management.html) ![CIM Vis](./docs/source/images/scenario/cim_vis.gif) Wenlei Shi, Xinran Wei, Jia Zhang, Xiaoyuan Ni, Arthur Jiang, Jiang Bian, Tie-Yan Liu. "[Cooperative Policy Learning with Pre-trained Heterogeneous Observation Representations](https://arxiv.org/abs/2012.13099)". AAMAS 2021 Xihan Li, Jia Zhang, Jiang Bian, Yunhai Tong, Tie-Yan Liu. "[A Cooperative Multi-Agent Reinforcement Learning Framework for Resource Balancing in Complex Logistics Network](https://arxiv.org/abs/1903.00714)". AAMAS 2019 ## Related News [MSRA Top-10 Hack-Techs in 2021](https://mp.weixin.qq.com/s/Y4kjQq8gKcsEsVadjdwnEQ) [Open Source Platform MARO: Anywhere Door for Resource Optimization](https://mp.weixin.qq.com/s/zXIpgzomLhDWS_YUFmRlEQ) [AI from "Point" to "Surface"](https://mp.weixin.qq.com/s/PggO49wwmS7grTO0nEMgVQ) ## [Cite Us](./CITATION) ## License Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the [MIT](./LICENSE) License.

ML Frameworks Supply Chain
920 Github Stars
scitt-ccf-ledger
Open Source

scitt-ccf-ledger

# scitt-ccf-ledger [![Build and test](https://github.com/microsoft/scitt-ccf-ledger/actions/workflows/build-test.yml/badge.svg)](https://github.com/microsoft/scitt-ccf-ledger/actions/workflows/build-test.yml) [![Build Status](https://github-private.visualstudio.com/microsoft/_apis/build/status%2FOneBranch%2Fscitt-ccf-ledger-wrapper%2Fscitt-ccf-ledger-wrapper-Official?repoName=scitt-ccf-ledger-wrapper&branchName=master)](https://github-private.visualstudio.com/microsoft/_build/latest?definitionId=716&repoName=scitt-ccf-ledger-wrapper&branchName=master) This repository contains the source code for scitt-ccf-ledger, an application that runs on top of [CCF](https://github.com/microsoft/CCF) implementing draft standards developed within the IETF. See [SCITT Standard alignment](docs/scitt.md). The purpose of scitt-ccf-ledger is to provide transparent provenance for artefacts in digital supply chains. It achieves this by allowing signed claims about artefacts to be submitted to a secure, immutable ledger and returning receipts that prove the claims have been stored and registration policies applied. This project is open source to facilitate auditability and academic collaboration. We are keen to engage in research collaboration on this project. Please reach out to discuss this by opening an issue. ## Quick start The instructions below guide you through building and deploying a local instance of scitt-ccf-ledger for development and testing purposes. Being a CCF application, scitt-ccf-ledger targets AMD SEV-SNP, but also supports running on x86-64 hardware without TEE support in what is called *virtual* mode. All instructions below assume a Linux operating system and the availability of Docker and Python. > Note that `run-dev.sh` configures the network in a way that is not suitable for production; in particular it generates an ad-hoc governance member key pair, disables API authentication, and sets a permissive policy. First, start the service in one terminal window: ```sh ./docker/build.sh ./docker/run-dev.sh # Output will show: # ... # 2025-11-06T13:10:51.559932Z 100 [info ] CCF/src/host/socket.h:49 | TCP RPC Client listening on 0.0.0.0:8000 # ... # 2025-11-06T13:11:01.743871Z -0.012 0 [info ] CCF/src/node/rpc/frontend.h:949 | Opening frontend # 2025-11-06T13:11:01.743882Z -0.012 0 [info ] CCF/src/node/node_state.h:2581 | Service open at seqno 9 # ... ``` Then, in **another terminal** window, you can submit a test signed statement and obtain a transparent statement: ```sh # Use the Python virtual environment that was set up in the previous step source venv/bin/activate # Use the CLI to submit a test payload scitt submit test/payloads/manifest.spdx.json.sha384.digest.cose --development --url "https://localhost:8000" --transparent-statement output.cose # 2025-11-06 13:19:16.006 | DEBUG | pyscitt.client:request:402 - POST /entries 202 # 2025-11-06 13:19:16.009 | DEBUG | pyscitt.client:request:402 - GET /operations/2.13 202 # 2025-11-06 13:19:18.012 | DEBUG | pyscitt.client:request:402 - GET /operations/2.13 (attempt #2) 200 # 2025-11-06 13:19:18.015 | DEBUG | pyscitt.client:request:402 - GET /entries/2.13/statement 503 TransactionNotCached # 2025-11-06 13:19:19.017 | DEBUG | pyscitt.client:request:402 - GET /entries/2.13/statement (attempt #2) 200 # Registered test/payloads/manifest.spdx.json.sha384.digest.cose as transaction 2.13 # Received output.cose ``` Alternatively, use `--wait-for-commit` to block until the transaction is committed and return the receipt directly in a single request, without polling: ```sh scitt submit test/payloads/manifest.spdx.json.sha384.digest.cose --development --url "https://localhost:8000" --transparent-statement output.cose --wait-for-commit # 2025-11-06 13:19:16.006 | DEBUG | pyscitt.client:request:402 - POST /entries?waitForCommit=true 200 # Registered test/payloads/manifest.spdx.json.sha384.digest.cose as transaction 2.13 # Received output.cose ``` ## Supported inputs See [inputs.md](./docs/inputs.md) to understand what you can register and store in the service. ## Usage examples See the [demo/](demo/) directory for steps to launch and use the service. ## Development and testing See [DEVELOPMENT.md](DEVELOPMENT.md) for instructions on building, running, and testing scitt-ccf-ledger. ## Available clients See [clients.md](./docs/clients.md) for a list of available clients to interact with the service. ## Configuration See [configuration.md](./docs/configuration.md) for instructions on how to configure registration policies and authentication. ## Reproducing builds See [reproducibility.md](./docs/reproducibility.md) for instructions on reproducing builds. ## Contributing This project welcomes contributions and suggestions. Please see the [Contribution guidelines](CONTRIBUTING.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. 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.

Security SSO & Authentication
45 Github Stars
AzUrlShortener
Open Source

AzUrlShortener

# Azure Url Shortener (AzUrlShortener) ![GitHub Release](https://img.shields.io/github/v/release/microsoft/AzUrlShortener) ![.NET](https://img.shields.io/badge/10.0-512BD4?logo=dotnet&logoColor=fff) [![Build](https://github.com/microsoft/AzUrlShortener/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/microsoft/AzUrlShortener/actions/workflows/build.yml) ![GitHub License](https://img.shields.io/github/license/microsoft/AzUrlShortener) [![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?&logo=discord&logoColor=white)](https://discord.gg/6zA3jKw) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> [![All Contributors](https://img.shields.io/badge/all_contributors-23-orange.svg?style=flat-square)](#contributors-) <!-- ALL-CONTRIBUTORS-BADGE:END --> ![UrlShortener][UrlShortener] A simple and easy to use and to deploy budget-friendly Url Shortener for everyone. It runs in your Azure (Microsoft cloud) subscription. > If you don't own an Azure subscription already, you can create your **free** account today. It comes with 200$ credit, so you can experience almost everything without spending a dime. [Create your free Azure account today](https://azure.microsoft.com/free?WT.mc_id=dotnet-0000-frbouche) Features: - Redirect different destination base on schedules. - Keep Statistics of your clicks. - Budget-friendly and 100% open-source. - Extensible for more enterprise-friendly configurations - Simple step by step deployment. ## How To Deploy 👉 **[Step by Step Deployment](doc/how-to-deploy.md)** 👈 documentation is available here. If you want to **Update** or **Upgrade**, please refer to [the faq page](doc/faq.md). ## How To Use It Once deployed, use the admin webApp (aka TinyBlazorAdmin) to create new short URLs. ![Tiny Blazor Admin looks](images/tinyblazyadmin-tour.gif) ### Alternative Admin Tool By default, all the required resources are deployed into Azure. However you can decide to run the [API](src/Cloud5mins.ShortenerTools.Api/) locally, in a container or somewhere else. You can than use an API client like [Postman](https://www.postman.com/) or a plugin to VSCode like [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client), to manage your URLs. We've included simple API calls via a postman collection and environment [here](./src/tools/). You can also directly update the tables in storage using [Azure Storage Explorer](doc/how-to-use-azure-storage-explorer.md). --- ## Videos There is also a videos that explains a bit how things works and does a quick tour of the project. | Cloud 5 Mins | Azure Friday | | --- | --- | | [![Tiny Blazor Admin looks](images/AzUrlShortener_preview.gif)](https://youtu.be/fzXy2D77WMM) | [![Azure Friday](/images/AzureFriday_preview.gif)](https://learn.microsoft.com/en-us/shows/azure-friday/azurlshortener-an-open-source-budget-friendly-url-shortener) | --- ## What's Next? We are always trying to make it better. See the [AzUrlShortener project](https://github.com/users/FBoucher/projects/6/views/4) page and [issues](https://github.com/microsoft/AzUrlShortener/issues) to see the current progress. You are invited to go into the [Discussion](https://github.com/microsoft/AzUrlShortener/discussions) tab to share your feedback, ask question, and suggest new feature! Or have look at our [faq](doc/faq.md) page for more information. Current Backlog contains: - More Statistics - QR Code - More tracking information (like Country) - etc. --- ## Contributing If you find a bug or would like to add a feature, check out those resources: Check out our [Code of Conduct](CODE_OF_CONDUCT.md) and [Contributing](CONTRIBUTING.md) docs. This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! ## Contributors ✨ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tbody> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/surlydev"><img src="https://avatars1.githubusercontent.com/u/880671?v=4?s=100" width="100px;" alt="SurlyDev"/><br /><sub><b>SurlyDev</b></sub></a><br /><a href="#ideas-surlydev" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center" valign="top" width="14.28%"><a href="http://cloud5mins.com"><img src="https://avatars3.githubusercontent.com/u/2404846?v=4?s=100" width="100px;" alt="Frank Boucher"/><br /><sub><b>Frank Boucher</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=FBoucher" title="Code">💻</a> <a href="#video-FBoucher" title="Videos">📹</a> <a href="https://github.com/microsoft/AzUrlShortener/issues?q=author%3AFBoucher" title="Bug reports">🐛</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/AK0785"><img src="https://avatars1.githubusercontent.com/u/40241010?v=4?s=100" width="100px;" alt="AKER"/><br /><sub><b>AKER</b></sub></a><br /><a href="#ideas-AK0785" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center" valign="top" width="14.28%"><a href="http://baaijte.net"><img src="https://avatars3.githubusercontent.com/u/1761079?v=4?s=100" width="100px;" alt="Vincent Baaij"/><br /><sub><b>Vincent Baaij</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=vnbaaij" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/kmm7"><img src="https://avatars3.githubusercontent.com/u/13196402?v=4?s=100" width="100px;" alt="kmm7"/><br /><sub><b>kmm7</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=kmm7" title="Code">💻</a> <a href="#ideas-kmm7" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/fs366e2spm"><img src="https://avatars2.githubusercontent.com/u/52791126?v=4?s=100" width="100px;" alt="fs366e2spm"/><br /><sub><b>fs366e2spm</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/issues?q=author%3Afs366e2spm" title="Bug reports">🐛</a> <a href="#ideas-fs366e2spm" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/Hedlund01"><img src="https://avatars1.githubusercontent.com/u/48281171?v=4?s=100" width="100px;" alt="Hugo Hedlund"/><br /><sub><b>Hugo Hedlund</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=Hedlund01" title="Code">💻</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/thefisk"><img src="https://avatars2.githubusercontent.com/u/39799908?v=4?s=100" width="100px;" alt="Nathan Fisk"/><br /><sub><b>Nathan Fisk</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=thefisk" title="Documentation">📖</a></td> <td align="center" valign="top" width="14.28%"><a href="http://www.lexplore.com"><img src="https://avatars0.githubusercontent.com/u/3719489?v=4?s=100" width="100px;" alt="Erik Alsmyr"/><br /><sub><b>Erik Alsmyr</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/issues?q=author%3Aalsmyr" title="Bug reports">🐛</a> <a href="https://github.com/microsoft/AzUrlShortener/commits?author=alsmyr" title="Documentation">📖</a></td> <td align="center" valign="top" width="14.28%"><a href="https://jawn.net"><img src="https://avatars3.githubusercontent.com/u/1705112?v=4?s=100" width="100px;" alt="Bernard Vander Beken"/><br /><sub><b>Bernard Vander Beken</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=jawn" title="Documentation">📖</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/IronManion"><img src="https://avatars0.githubusercontent.com/u/36028632?v=4?s=100" width="100px;" alt="IronManion"/><br /><sub><b>IronManion</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=IronManion" title="Documentation">📖</a></td> <td align="center" valign="top" width="14.28%"><a href="http://www.jasonhand.com"><img src="https://avatars0.githubusercontent.com/u/1173344?v=4?s=100" width="100px;" alt="Jason Hand"/><br /><sub><b>Jason Hand</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=jasonhand" title="Documentation">📖</a> <a href="#infra-jasonhand" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td> <td align="center" valign="top" width="14.28%"><a href="https://Microsoft.com"><img src="https://avatars.githubusercontent.com/u/617586?v=4?s=100" width="100px;" alt="Scott Cate"/><br /><sub><b>Scott Cate</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=scottcate" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/arglgruml"><img src="https://avatars.githubusercontent.com/u/3940298?v=4?s=100" width="100px;" alt="arglgruml"/><br /><sub><b>arglgruml</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/issues?q=author%3Aarglgruml" title="Bug reports">🐛</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/DavidTCarpenters"><img src="https://avatars.githubusercontent.com/u/50587918?v=4?s=100" width="100px;" alt="DavidTCarpenters"/><br /><sub><b>DavidTCarpenters</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=DavidTCarpenters" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/solvaholic"><img src="https://avatars.githubusercontent.com/u/14636658?v=4?s=100" width="100px;" alt="Roger D. Winans"/><br /><sub><b>Roger D. Winans</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=solvaholic" title="Documentation">📖</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/fatpacket"><img src="https://avatars.githubusercontent.com/u/5621063?v=4?s=100" width="100px;" alt="fatpacket"/><br /><sub><b>fatpacket</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=fatpacket" title="Documentation">📖</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/ch-rob"><img src="https://avatars.githubusercontent.com/u/14352153?v=4?s=100" width="100px;" alt="Chad Voelker"/><br /><sub><b>Chad Voelker</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=ch-rob" title="Code">💻</a> <a href="https://github.com/microsoft/AzUrlShortener/commits?author=ch-rob" title="Documentation">📖</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/davidmginn"><img src="https://avatars.githubusercontent.com/u/831166?v=4?s=100" width="100px;" alt="David Ginn"/><br /><sub><b>David Ginn</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=davidmginn" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="http://www.c-sharpcorner.com/members/catcher-wong"><img src="https://avatars.githubusercontent.com/u/8394988?v=4?s=100" width="100px;" alt="Catcher Wong"/><br /><sub><b>Catcher Wong</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=catcherwong" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/stulzq"><img src="https://avatars.githubusercontent.com/u/13200155?v=4?s=100" width="100px;" alt="Zhiqiang Li"/><br /><sub><b>Zhiqiang Li</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=stulzq" title="Code">💻</a></td> </tr> <tr> <td align="center" valign="top" width="14.28%"><a href="https://github.com/ddematheu2"><img src="https://avatars.githubusercontent.com/u/43075365?v=4?s=100" width="100px;" alt="ddematheu2"/><br /><sub><b>ddematheu2</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/issues?q=author%3Addematheu2" title="Bug reports">🐛</a> <a href="https://github.com/microsoft/AzUrlShortener/commits?author=ddematheu2" title="Code">💻</a></td> <td align="center" valign="top" width="14.28%"><a href="https://davidop.code.blog/"><img src="https://avatars.githubusercontent.com/u/7433346?v=4?s=100" width="100px;" alt="David Oliva Paredes"/><br /><sub><b>David Oliva Paredes</b></sub></a><br /><a href="https://github.com/microsoft/AzUrlShortener/commits?author=davidop" title="Code">💻</a></td> </tr> </tbody> </table> <!-- markdownlint-restore --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END --> This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! > This project was inspired by a project created by [Jeremy Likness](https://github.com/JeremyLikness) that you can find here [jlik.me](https://github.com/JeremyLikness/jlik.me). [UrlShortener]: images/UrlShortener_600.png

Link Shortening & Tracking FaaS & Serverless
583 Github Stars
Commercial-Marketplace-SaaS-API-Emulator
Open Source

Commercial-Marketplace-SaaS-API-Emulator

# Microsoft Commercial Marketplace API Emulator This repository contains a Node.js implementation of an emulator for the Microsoft commercial marketplace SaaS Fulfillment APIs. To make hosting the emulator as simple as possible, the repo includes a Dockerfile for a building a containerised version. ## What challenges does this project address? Integrating with the commercial marketplace has a few scaffolding requirements; a barrier to getting up and running quickly. The emulator breaks that dependency, allowing teams to start building for marketplace with zero friction. Specifically: - Remove dependency on Partner Center - Partner Center onboarding and permissions can take some time to setup correctly. You can get started right away without waiting for this process. - Ordinarily, testing API flows against plans can only happen after they have been created in Partner Center. Emulated plans allow development to happen in parallel. Only final testing is required against Partner Center plans. - Remove the AAD requirement - A SaaS transactable offer, or at least the integration with marketplace, must be built with AAD. The integration with the marketplace APIs requires the app to be registered in AAD and API calls are secured with OAuth2. Similarly, your landing page must support AAD SSO. The emulator removes these requirements to make it simpler (and quicker) to start implementing your integration flows. ## Design goals - Keep things simple - Implement the minimum required whilst being fully functional out of the box - Be consistent with the **behaviour** of APIs, note differences from the documented behaviour - Support both unauthenticated use for simplicity and authenticated use for closer fidelity with the marketplace APIs. - Flexible implementation that offers multiple hosting options to suit the user - Offer configuration options to tailor the behaviour - Provide a UI to step through and visualise certain actions ## Getting started The emulator is a Node.js application designed to be run as a Docker container for portability. Other hosting options are also possible. For more details see the relevant section: - [Hosting the emulator](./docs/launching.md) - [Configuring the emulator](./docs/config.md) - [Usage scenarios](./docs/scenarios.md) ## Using the emulator With the emulator running, you can connect to it using a browser and standard tools such as the [REST Client extension for VS Code](https://github.com/Huachao/vscode-restclient), [Postman](https://www.postman.com/) etc. The URL and port will depend on [your chosen deployment method](./docs/launching.md). eg if you're running the emulator locally using `docker run`, you would likely connect on `http://localhost:8080`. 1. Run the emulator using your [chosen method](./docs/launching.md) 1. With a browser, connect to `http://<domain>:<port>` (domain, port depend on your run method) - You should be presented with a page for configuring a synthetic marketplace purchase token 1. Configure a purchase token 1. (Optionally) configure properties on the purchase token (otherwise defaults will be populated) 1. Click the `Generate Token` button 1. Observe the generated JSON result 1. You can now either 1. Use the emulator's simple, built-in landing page implementation to resolve & activate a subscription 1. Exercise the APIs manually (eg using the VS Code REST client or Postman) ### Use the Emulator's built-in landing page 1. Click on the `Post to landing page` button in the Token area 1. You will be taken to the emulator's built-in landing page 1. The purchase token is passed to the landing page as a query string parameter 1. When it loads, the landing page automatically calls the `resolve API` to decode the token 1. Key token properties are displayed on the page 1. Click the `Activate subscription` button to call the `activate API` 1. You should see a message indicating a `200 OK` status response 1. Navigate to the `Subscriptions` page to see your new subscription has been activated ### A word about the Publisher ID Subscriptions need to be associated with a publisher. In the marketplace, the publisher is derived using claims from the AAD bearer token used to authenticate. For the emulator, to keep things simple, we removed the AAD requirement. Instead, you can define the Publisher ID in one of two ways: 1. A `publisherId` query string parameter. This is set to "FourthCoffee" as a default in the emulator 1. To see an example of this in action, take a look at the sample REST calls: [subscriptions-apis.http](./rest_calls/subscription-apis.http) 1. To modify this Publisher ID for the built-in emulator functions, set the `PUBLISHER_ID` environment variable 1. A Publisher ID constructed from the publisher tenant and app IDs. 1. This is useful to mirror the behaviour of the marketplace. The tenant and app ID from the app registration you use to authenticate with the marketplace APIs will also work with the emulator 1. To modify this Publisher ID for the built-in emulator functions, set the `PUBLISHER_TENANT_ID` and `PUBLISHER_APP_ID` environment variables. Set these to the tenant and app ID from the app registration used to authenticate with the marketplace APIs. eg from the Azure Portal (see below) or Partner Center offer page. ![Screenshot of tenant id and app id](./docs/images/readme-publisherid-1.png) You can use either approach (but not both at the same time!). The former is useful for early testing as you don't need to register with AAD, the latter is useful in the latter stages of emulator testing as it is directly compatible with the marketplace. For more information on configuration see [Configuring the emulator](./docs/config.md) ### Exercise the APIs manually 1. Click the `Copy to clipboard` button in the Token area (**not** the JSON result) 1. This copies the Base64 encoded purchase token to the clipboard 1. Call the `resolve API` to resolve (decode) the purchase token 1. This repo includes helpers to call the emulated APIs using the REST Client extension for VS Code 1. Open this repo in VS Code 1. Install the [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) 1. Open [subscription-apis.http](rest_calls/subscription-apis.http) from the `\rest_calls` folder 1. In `subscription-apis.http` set - `publisherId [string]` simulates the Publisher ID (can be anything you like eg Contoso Corp) - `baseUrl [sting]` format as above eg `http://localhost:8080` - `purchaseToken [string]` the Base64 encoded purchase token (paste from the clipboard) 1. Click `Send Request` (under ### Resolve) - You should see a Response appear with a `200 OK` status - The payload will include the decoded purchase token 1. Call the `activate API` to activate the purchase 1. In `subscription-apis.http` 1. Update the `planId` on the `activate` request to **match a valid planId** as set in the purchase token 1. Click on `Send Request` on the `activate API` call 1. You should see a `200 OK` status 1. The payload will be `OK` At this point you have - Created a (synthetic) purchase token - Resolved that purchase token to its properties - Activated the purchase You can now call other APIs to see their response - eg the `GetSubscriptions` API would return a list of all subscriptions - Having completed the above steps, this will return a collection with one item, the subscription you activated There are helpers for all available SaaS Fulfillment v2 APIs in - [subscription-apis.http](rest_calls/subscription-apis.http) - [operations-apis.http](rest_calls/operations-apis.http) For more details on the available APIs and their operation, see - [SaaS subscription life cycle](https://learn.microsoft.com/azure/marketplace/partner-center-portal/pc-saas-fulfillment-life-cycle) - [Subscription APIs](https://learn.microsoft.com/azure/marketplace/partner-center-portal/pc-saas-fulfillment-subscription-api) - [Operations APIs](https://learn.microsoft.com/azure/marketplace/partner-center-portal/pc-saas-fulfillment-operations-api) ## Functionality The solution emulates all operations on the [SaaS Fulfillment APIs v2](https://learn.microsoft.com/azure/marketplace/partner-center-portal/pc-saas-fulfillment-life-cycle) closely. It is close-to, but not 100% fidelity (see [Limitations](#limitations) below. Any solution should be [thoroughly tested against the marketplace APIs](https://learn.microsoft.com/azure/marketplace/test-saas-overview) before final release. Capabilities include the following: - Generate a synthetic [purchase identification token](https://learn.microsoft.com/azure/marketplace/partner-center-portal/pc-saas-fulfillment-subscription-api#resolve-a-purchased-subscription) - This token has customisable subscription properties that can be resolved by the emulated `resolve` API - Publisher ID can be set by query string parameter (`publisherId`) or authorization header (bearer token) - Testing the following flows: - Landing page flow - Activation flow - Update flow - Suspend and reinstate flow - Webhook flows The format of the marketplace [purchase identification token](https://learn.microsoft.com/azure/marketplace/partner-center-portal/pc-saas-fulfillment-subscription-api#resolve-a-purchased-subscription) is not documented. In the emulator, this has been simulated with a Base64 encoded JSON payload. ## Limitations - The activate call does not validate the publisher (as the 'faux' purchase token isn't associated with a specific publisher. This may be implemented in future. ## Accelerator Integration There are two Open Source projects from teams at Microsoft, the SaaS Accelerator and MONA SaaS that have been updated to work with the Emulator in place of the Azure Marketplace. Documentation: [Integrations](/docs/integration.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](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. ## 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). 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.

Invoicing & Billing API Tools
41 Github Stars