Skip to main content

Intel® Extension for Transformers

An Innovative Transformer-based Toolkit to Accelerate GenAI/LLM Everywhere

Release Notes

🏭Architecture   |   💬NeuralChat   |   😃Inference   |   💻Examples   |   📖Documentations

🚀Latest News

  • NeuralChat has been showcased in Intel Innovation’23 Keynote and Google Cloud Next'23 to demonstrate GenAI/LLM capabilities on Intel Xeon Scalable Processors.
  • NeuralChat supports custom chatbot development and deployment on broad Intel HWs such as Xeon Scalable Processors, Gaudi2, Xeon CPU Max Series, Data Center GPU Max Series, Arc Series, and Core Processors. Check out Notebooks and below sample code.
# pip install intel-extension-for-transformers
from intel_extension_for_transformers.neural_chat import build_chatbot
chatbot = build_chatbot()
response = chatbot.predict("Tell me about Intel Xeon Scalable Processors.")
  • LLM runtime extends Hugging Face Transformers API to provide seamless low precision inference for popular LLMs, supporting mainstream low precision data types such as INT8/FP8/INT4/FP4/NF4.

🏃Installation

Quick Install from Pypi

pip install intel-extension-for-transformers

For more installation methods, please refer to Installation Page

🌟Introduction

Intel® Extension for Transformers is an innovative toolkit to accelerate Transformer-based models on Intel platforms, in particular effective on 4th Intel Xeon Scalable processor Sapphire Rapids (codenamed Sapphire Rapids). The toolkit provides the below key features and examples:

🌱Getting Started

Below are the sample code to enable weight-only low precision inference. See more examples.

INT4 Inference

from transformers import AutoTokenizer
from intel_extension_for_transformers.transformers import AutoModel, WeightOnlyQuantConfig

model_name = "EleutherAI/gpt-j-6B"
config = WeightOnlyQuantConfig(compute_dtype="int8", weight_dtype="int4")
prompt = "Once upon a time, a little girl"

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
inputs = tokenizer(prompt, return_tensors="pt").input_ids

model = AutoModel.from_pretrained(model_name, quantization_config=config)
gen_tokens = model.generate(inputs, max_new_tokens=300)
gen_text = tokenizer.batch_decode(gen_tokens)

INT8 Inference

from transformers import AutoTokenizer
from intel_extension_for_transformers.transformers import AutoModel, WeightOnlyQuantConfig

model_name = "EleutherAI/gpt-j-6B" 
config = WeightOnlyQuantConfig(compute_dtype="bf16", weight_dtype="int8")
prompt = "Once upon a time, a little girl"

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
inputs = tokenizer(prompt, return_tensors="pt").input_ids

model = AutoModel.from_pretrained(model_name, quantization_config=config)
gen_tokens = model.generate(inputs, max_new_tokens=300)
gen_text = tokenizer.batch_decode(gen_tokens)

🎯Validated Models

Here is the average accuracy of validated models on Lambada (OpenAI), HellaSwag, Winogrande, PIQA, and WikiText. The next token latency is based on 32 input tokens and greedy search on Intel's 4th Generation Xeon Scalable Sapphire Rapids processor.

Model FP32 INT4 (Group size 32) INT4 (Group size 128) Next Token Latency
EleutherAI/gpt-j-6B 0.643 0.644 0.64 21.98ms
meta-llama/Llama-2-7b-hf 0.69 0.69 0.685 24.55ms
decapoda-research/llama-7b-hf 0.689 0.682 0.68 24.84ms
EleutherAI/gpt-neox-20b 0.674 0.672 0.669 80.16ms
mosaicml/mpt-7b-chat 0.672 0.67 0.666 35.84ms
tiiuae/falcon-7b 0.698 0.694 0.693 36.1ms
baichuan-inc/baichuan-7B 0.474 0.471 0.47 Coming Soon
facebook/opt-6.7b 0.65 0.647 0.643 Coming Soon
databricks/dolly-v2-3b 0.613 0.609 0.609 22.02ms
tiiuae/falcon-40b-instruct 0.756 0.757 0.755 Coming Soon

Find other models like ChatGLM, ChatGLM2, StarCoder... in LLM Runtime

📖Documentation

OVERVIEW
Model Compression NeuralChat Neural Engine Kernel Libraries
MODEL COMPRESSION
Quantization Pruning Distillation Orchestration
Neural Architecture Search Export Metrics/Objectives Pipeline
NEURAL ENGINE
Model Compilation Custom Pattern Deployment Profiling
KERNEL LIBRARIES
Sparse GEMM Kernels Custom INT8 Kernels Profiling Benchmark
ALGORITHMS
Length Adaptive Data Augmentation
TUTORIALS AND RESULTS
Tutorials Supported Models Model Performance Kernel Performance

📃Selected Publications/Events

View Full Publication List.

Additional Content

Acknowledgements

💁Collaborations

Welcome to raise any interesting ideas on model compression techniques and LLM-based chatbot development! Feel free to reach us and look forward to our collaborations on Intel Extension for Transformers!

Release files for intel-extension-for-transformers 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for intel-extension-for-transformers 1.2
File Size Uploaded
intel-extension-for-transformers-1.2.tar.gz 73.3 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for intel-extension-for-transformers 1.2
File
intel_extension_for_transformers-1.2-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
intel_extension_for_transformers-1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
intel_extension_for_transformers-1.2-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
intel_extension_for_transformers-1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
intel_extension_for_transformers-1.2-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
intel_extension_for_transformers-1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details

Total release size: 360.0 MB

Release files / intel-extension-for-transformers-1.2.tar.gz

Download URL intel-extension-for-transformers-1.2.tar.gz
Size 73.3 MB
Tags Source
SHA-256 checksum
How to use checksums
5ab3589039733492c65427bab9bf08dc0bd0e5915a81d83a848d4b89ed6ecbb4
BLAKE2b-256 checksum
How to use checksums
828478eab558cbeba5e5490867e38e267a154592bd435ab8bd967323a7b60f13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / intel_extension_for_transformers-1.2-cp310-cp310-win_amd64.whl

Download URL intel_extension_for_transformers-1.2-cp310-cp310-win_amd64.whl
Size 21.5 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
0d74aff0a8d1f90ee61ff808409f541c8b9880b41ad7d1df31075570502ca34a
BLAKE2b-256 checksum
How to use checksums
ac55f68a7ea18d74e3a162b5d172d5c92d56b587d9b32c543e8ac8b6091afd6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / intel_extension_for_transformers-1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL intel_extension_for_transformers-1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 74.0 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e8dd9772665696072b78b829848649bc3728e7d6c95411ea535b6dea5630db0b
BLAKE2b-256 checksum
How to use checksums
1615c46218743d794604670263360c99a82ecca2b34542e8646378c29b4df799
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / intel_extension_for_transformers-1.2-cp39-cp39-win_amd64.whl

Download URL intel_extension_for_transformers-1.2-cp39-cp39-win_amd64.whl
Size 21.5 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
5f169308921397bf2a614ffc491324ce12db397f7b5d2185d39fefce2f3add53
BLAKE2b-256 checksum
How to use checksums
d4c2f340f0b2f22df011c864509e1cd4183c1fb154a2167824cdd34fd39a2ec3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / intel_extension_for_transformers-1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL intel_extension_for_transformers-1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 74.0 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
ea595ebebb72e48944e6a5ccad419efdbc6652bbb5f8d281cf719724b1d94c81
BLAKE2b-256 checksum
How to use checksums
449e643d532c6c2277eddb765f32d5da5a3622ff16077339577e7704a08e8119
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / intel_extension_for_transformers-1.2-cp38-cp38-win_amd64.whl

Download URL intel_extension_for_transformers-1.2-cp38-cp38-win_amd64.whl
Size 21.5 MB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
28d0ff9814d4a0a432ee2cc08b777d7d5d8cf84fb3b664f3b67408ad4ef591ad
BLAKE2b-256 checksum
How to use checksums
c332a85e0608e7cb59d532990771d482d3190686d15a10c92819725fe09811b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / intel_extension_for_transformers-1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL intel_extension_for_transformers-1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 74.0 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3e60f07424b079d01aad818ff1238d547613fbdd9e7298a5ac3aa252a2fd81bb
BLAKE2b-256 checksum
How to use checksums
fe80e01bcfd7ce587122223bcfc4e912505d38c39ec7d1372d388b6c7e81046f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

1.4.2

9 release files

1.4.1

9 release files

1.4

9 release files

1.3.2

8 release files

1.3.1

7 release files

1.3

7 release files

1.2.2

5 release files

1.2.1

4 release files

This release

1.2 This release

7 release files

1.1.1

4 release files

1.1

7 release files

1.0.1

9 release files

1.0

16 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page