Update README.md (#10518)
This commit is contained in:
		
							parent
							
								
									d7d0e66b18
								
							
						
					
					
						commit
						5b76f88a8f
					
				
					 2 changed files with 142 additions and 170 deletions
				
			
		
							
								
								
									
										167
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										167
									
								
								README.md
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -1,18 +1,26 @@
 | 
			
		|||
## IPEX-LLM
 | 
			
		||||
> [!IMPORTANT]
 | 
			
		||||
> ***`bigdl-llm` has now become `ipex-llm` (see the migration guide [here](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/bigdl_llm_migration.html)); you may find the original `BigDL` project [here](https://github.com/intel-analytics/BigDL-2.x).***
 | 
			
		||||
 
 | 
			
		||||
**`ipex-llm`** is a library for running **LLM** (large language model) on Intel **XPU** (from *Laptop* to *GPU* to *Cloud*) using **INT4/FP4/INT8/FP8** with very low latency[^1] (for any **PyTorch** model).
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
> *It is built on the excellent work of [llama.cpp](https://github.com/ggerganov/llama.cpp), [bitsandbytes](https://github.com/TimDettmers/bitsandbytes), [qlora](https://github.com/artidoro/qlora), [gptq](https://github.com/IST-DASLab/gptq), [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ), [awq](https://github.com/mit-han-lab/llm-awq), [AutoAWQ](https://github.com/casper-hansen/AutoAWQ), [vLLM](https://github.com/vllm-project/vllm), [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), [gptq_for_llama](https://github.com/qwopqwop200/GPTQ-for-LLaMa), [chatglm.cpp](https://github.com/li-plus/chatglm.cpp), [redpajama.cpp](https://github.com/togethercomputer/redpajama.cpp), [gptneox.cpp](https://github.com/byroneverson/gptneox.cpp), [bloomz.cpp](https://github.com/NouamaneTazi/bloomz.cpp/), etc.*
 | 
			
		||||
# 💫 IPEX-LLM
 | 
			
		||||
**`IPEX-LLM`** is a PyTorch library for running **LLM** on Intel CPU and GPU *(e.g., local PC with iGPU, discrete GPU such as Arc, Flex and Max)* with very low latency[^1]. 
 | 
			
		||||
> [!NOTE]
 | 
			
		||||
> - *It is built on top of **Intel Extension for PyTorch** (**`IPEX`**), as well as the excellent work of **`llama.cpp`**, **`bitsandbytes`**, **`vLLM`**, **`qlora`**, **`AutoGPTQ`**, **`AutoAWQ`**, etc.*
 | 
			
		||||
> - *It provides seamless integration with [llama.cpp](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/llama_cpp_quickstart.html), [Text-Generation-WebUI](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/webui_quickstart.html), [HuggingFace tansformers](python/llm/example/GPU/HF-Transformers-AutoModels), [HuggingFace PEFT](python/llm/example/GPU/LLM-Finetuning), [LangChain](python/llm/example/GPU/LangChain), [LlamaIndex](python/llm/example/GPU/LlamaIndex), [DeepSpeed-AutoTP](python/llm/example/GPU/Deepspeed-AutoTP), [vLLM](python/llm/example/GPU/vLLM-Serving), [FastChat](python/llm/src/ipex_llm/serving/fastchat), [HuggingFace TRL](python/llm/example/GPU/LLM-Finetuning/DPO), [AutoGen](python/llm/example/CPU/Applications/autogen), [ModeScope](python/llm/example/GPU/ModelScope-Models), etc.* 
 | 
			
		||||
> - ***50+ models** have been optimized/verified on `ipex-llm` (including LLaMA2, Mistral, Mixtral, Gemma, LLaVA, Whisper, ChatGLM, Baichuan, Qwen, RWKV, and more); see the complete list [here](#verified-models).*
 | 
			
		||||
 | 
			
		||||
### Latest update 🔥 
 | 
			
		||||
- [2024/03] **LangChain** added support for `ipex-llm`; see the details [here](https://python.langchain.com/docs/integrations/llms/bigdl).
 | 
			
		||||
## Latest Update 🔥 
 | 
			
		||||
- [2024/03] `bigdl-llm` has now become `ipex-llm` (see the migration guide [here](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/bigdl_llm_migration.html)); you may find the original `BigDL` project [here](https://github.com/intel-analytics/bigdl-2.x).
 | 
			
		||||
- [2024/02] `ipex-llm` now supports directly loading model from [ModelScope](python/llm/example/GPU/ModelScope-Models) ([魔搭](python/llm/example/CPU/ModelScope-Models)).
 | 
			
		||||
- [2024/02] `ipex-llm` added inital **INT2** support (based on llama.cpp [IQ2](python/llm/example/GPU/HF-Transformers-AutoModels/Advanced-Quantizations/GGUF-IQ2) mechanism), which makes it possible to run large-size LLM (e.g., Mixtral-8x7B) on Intel GPU with 16GB VRAM.
 | 
			
		||||
- [2024/02] Users can now use `ipex-llm` through [Text-Generation-WebUI](https://github.com/intel-analytics/text-generation-webui) GUI.
 | 
			
		||||
- [2024/02] `ipex-llm` now supports *[Self-Speculative Decoding](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Inference/Self_Speculative_Decoding.html)*, which in practice brings **~30% speedup** for FP16 and BF16 inference latency on Intel [GPU](python/llm/example/GPU/Speculative-Decoding) and [CPU](python/llm/example/CPU/Speculative-Decoding) respectively.
 | 
			
		||||
- [2024/02] `ipex-llm` now supports a comprehensive list of LLM finetuning on Intel GPU (including [LoRA](python/llm/example/GPU/LLM-Finetuning/LoRA), [QLoRA](python/llm/example/GPU/LLM-Finetuning/QLoRA), [DPO](python/llm/example/GPU/LLM-Finetuning/DPO), [QA-LoRA](python/llm/example/GPU/LLM-Finetuning/QA-LoRA) and [ReLoRA](python/llm/example/GPU/LLM-Finetuning/ReLora)).
 | 
			
		||||
- [2024/02] `ipex-llm` now supports a comprehensive list of LLM **finetuning** on Intel GPU (including [LoRA](python/llm/example/GPU/LLM-Finetuning/LoRA), [QLoRA](python/llm/example/GPU/LLM-Finetuning/QLoRA), [DPO](python/llm/example/GPU/LLM-Finetuning/DPO), [QA-LoRA](python/llm/example/GPU/LLM-Finetuning/QA-LoRA) and [ReLoRA](python/llm/example/GPU/LLM-Finetuning/ReLora)).
 | 
			
		||||
- [2024/01] Using `ipex-llm` [QLoRA](python/llm/example/GPU/LLM-Finetuning/QLoRA), we managed to finetune LLaMA2-7B in **21 minutes** and LLaMA2-70B in **3.14 hours** on 8 Intel Max 1550 GPU for [Standford-Alpaca](python/llm/example/GPU/LLM-Finetuning/QLoRA/alpaca-qlora) (see the blog [here](https://www.intel.com/content/www/us/en/developer/articles/technical/finetuning-llms-on-intel-gpus-using-bigdl-llm.html)).
 | 
			
		||||
- [2024/01] 🔔🔔🔔 ***The default `ipex-llm` GPU Linux installation has switched from PyTorch 2.0 to PyTorch 2.1, which requires new oneAPI and GPU driver versions. (See the [GPU installation guide](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Overview/install_gpu.html) for more details.)***
 | 
			
		||||
<details><summary>More updates</summary>
 | 
			
		||||
<br/>
 | 
			
		||||
 
 | 
			
		||||
- [2023/12] `ipex-llm` now supports [ReLoRA](python/llm/example/GPU/LLM-Finetuning/ReLora) (see *["ReLoRA: High-Rank Training Through Low-Rank Updates"](https://arxiv.org/abs/2307.05695)*).
 | 
			
		||||
- [2023/12] `ipex-llm` now supports [Mixtral-8x7B](python/llm/example/GPU/HF-Transformers-AutoModels/Model/mixtral) on both Intel [GPU](python/llm/example/GPU/HF-Transformers-AutoModels/Model/mixtral) and [CPU](python/llm/example/CPU/HF-Transformers-AutoModels/Model/mixtral). 
 | 
			
		||||
- [2023/12] `ipex-llm` now supports [QA-LoRA](python/llm/example/GPU/LLM-Finetuning/QA-LoRA) (see *["QA-LoRA: Quantization-Aware Low-Rank Adaptation of Large Language Models"](https://arxiv.org/abs/2309.14717)*). 
 | 
			
		||||
| 
						 | 
				
			
			@ -22,10 +30,13 @@
 | 
			
		|||
- [2023/10] `ipex-llm` now supports [QLoRA finetuning](python/llm/example/GPU/LLM-Finetuning/QLoRA) on both Intel [GPU](python/llm/example/GPU/LLM-Finetuning/QLoRA) and [CPU](python/llm/example/CPU/QLoRA-FineTuning).
 | 
			
		||||
- [2023/10] `ipex-llm` now supports [FastChat serving](python/llm/src/ipex_llm/llm/serving) on on both Intel CPU and GPU.
 | 
			
		||||
- [2023/09] `ipex-llm` now supports [Intel GPU](python/llm/example/GPU) (including iGPU, Arc, Flex and MAX).
 | 
			
		||||
- [2023/09] `ipex-llm` [tutorial](https://github.com/intel-analytics/ipex-llm-tutorial) is released.
 | 
			
		||||
- [2023/09] Over 40 models have been optimized/verified on `ipex-llm`, including *LLaMA/LLaMA2, ChatGLM2/ChatGLM3, Mistral, Falcon, MPT, LLaVA, WizardCoder, Dolly, Whisper, Baichuan/Baichuan2, InternLM, Skywork, QWen/Qwen-VL, Aquila, MOSS,* and more; see the complete list [here](#verified-models).
 | 
			
		||||
- [2023/09] `ipex-llm` [tutorial](https://github.com/intel-analytics/bigdl-llm-tutorial) is released.
 | 
			
		||||
 
 | 
			
		||||
### `ipex-llm` Demos
 | 
			
		||||
</details> 
 | 
			
		||||
 | 
			
		||||
[^1]: Performance varies by use, configuration and other factors. `ipex-llm` may not optimize to the same degree for non-Intel products. Learn more at www.Intel.com/PerformanceIndex.
 | 
			
		||||
 | 
			
		||||
## `ipex-llm` Demos
 | 
			
		||||
See the ***optimized performance*** of `chatglm2-6b` and `llama-2-13b-chat` models on 12th Gen Intel Core CPU and Intel Arc GPU below.
 | 
			
		||||
 | 
			
		||||
<table width="100%">
 | 
			
		||||
| 
						 | 
				
			
			@ -55,96 +66,59 @@ See the ***optimized performance*** of `chatglm2-6b` and `llama-2-13b-chat` mode
 | 
			
		|||
  </tr>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
### `ipex-llm` quickstart
 | 
			
		||||
## `ipex-llm` Quickstart
 | 
			
		||||
### Install `ipex-llm`
 | 
			
		||||
- [Windows GPU](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/install_windows_gpu.html): installing `ipex-llm` on Windows with Intel GPU
 | 
			
		||||
- [Linux GPU](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/install_linux_gpu.html): installing `ipex-llm` on Linux with Intel GPU
 | 
			
		||||
- [Docker](docker/llm): using `ipex-llm` dockers on Intel CPU and GPU
 | 
			
		||||
- *For more details, please refer to the [installation guide](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Overview/install.html)*
 | 
			
		||||
 | 
			
		||||
- [Windows GPU installation](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/install_windows_gpu.html)
 | 
			
		||||
- [Run IPEX-LLM in Text-Generation-WebUI](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/webui_quickstart.html)
 | 
			
		||||
- [Run IPEX-LLM using Docker](docker/llm)
 | 
			
		||||
- [CPU INT4](#cpu-int4)
 | 
			
		||||
- [GPU INT4](#gpu-int4)
 | 
			
		||||
- [More Low-Bit support](#more-low-bit-support)
 | 
			
		||||
- [Verified models](#verified-models)
 | 
			
		||||
### Run `ipex-llm`
 | 
			
		||||
- [llama.cpp](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/llama_cpp_quickstart.html): running **ipex-llm for llama.cpp** (*using C++ interface of `ipex-llm` as an accelerated backend for `llama.cpp` on Intel GPU*)
 | 
			
		||||
- [vLLM](python/llm/example/GPU/vLLM-Serving): running `ipex-llm` in `vLLM` on both Intel [GPU](python/llm/example/GPU/vLLM-Serving) and [CPU](python/llm/example/CPU/vLLM-Serving)
 | 
			
		||||
- [FastChat](python/llm/src/ipex_llm/serving/fastchat): running `ipex-llm` in `FastChat` serving on on both Intel GPU and CPU
 | 
			
		||||
- [LangChain-Chatchat RAG](https://github.com/intel-analytics/Langchain-Chatchat): running `ipex-llm` in `LangChain-Chatchat` (*Knowledge Base QA using **RAG** pipeline*)
 | 
			
		||||
- [Text-Generation-WebUI](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/webui_quickstart.html): running `ipex-llm` in `oobabooga` **WebUI**
 | 
			
		||||
- [Benchmarking](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/benchmark_quickstart.html): running  (latency and throughput) benchmarks for `ipex-llm` on Intel CPU and GPU
 | 
			
		||||
 | 
			
		||||
#### CPU INT4
 | 
			
		||||
##### Install
 | 
			
		||||
You may install **`ipex-llm`** on Intel CPU as follows:
 | 
			
		||||
> Note: See the [CPU installation guide](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Overview/install_cpu.html) for more details.
 | 
			
		||||
```bash
 | 
			
		||||
pip install --pre --upgrade ipex-llm[all]
 | 
			
		||||
```
 | 
			
		||||
> Note: `ipex-llm` has been tested on Python 3.9, 3.10 and 3.11
 | 
			
		||||
### Code Examples
 | 
			
		||||
- Low bit inference
 | 
			
		||||
  - [INT4 inference](python/llm/example/GPU/HF-Transformers-AutoModels/Model): **INT4** LLM inference on Intel [GPU](python/llm/example/GPU/HF-Transformers-AutoModels/Model) and [CPU](python/llm/example/CPU/HF-Transformers-AutoModels/Model)
 | 
			
		||||
  - [FP8/FP4 inference](python/llm/example/GPU/HF-Transformers-AutoModels/More-Data-Types): **FP8** and **FP4** LLM inference on Intel [GPU](python/llm/example/GPU/HF-Transformers-AutoModels/More-Data-Types)
 | 
			
		||||
  - [INT8 inference](python/llm/example/GPU/HF-Transformers-AutoModels/More-Data-Types): **INT8** LLM inference on Intel [GPU](python/llm/example/GPU/HF-Transformers-AutoModels/More-Data-Types) and [CPU](python/llm/example/GPU/HF-Transformers-AutoModels/More-Data-Types)
 | 
			
		||||
  - [INT2 inference](python/llm/example/GPU/HF-Transformers-AutoModels/Advanced-Quantizations/GGUF-IQ2): **INT2** LLM inference (based on llama.cpp IQ2 mechanism) on Intel [GPU](python/llm/example/GPU/HF-Transformers-AutoModels/Advanced-Quantizations/GGUF-IQ2)
 | 
			
		||||
- FP16/BF16 inference
 | 
			
		||||
  - **FP16** LLM inference on Intel [GPU](python/llm/example/GPU/Speculative-Decoding), with possible [self-speculative decoding](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Inference/Self_Speculative_Decoding.html) optimization
 | 
			
		||||
  - **BF16** LLM inference on Intel [CPU](python/llm/example/CPU/Speculative-Decoding), with possible [self-speculative decoding](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Inference/Self_Speculative_Decoding.html) optimization 
 | 
			
		||||
- Save and load
 | 
			
		||||
  - [Low-bit models](python/llm/example/CPU/HF-Transformers-AutoModels/Save-Load): saving and loading `ipex-llm` low-bit models
 | 
			
		||||
  - [GGUF](python/llm/example/GPU/HF-Transformers-AutoModels/Advanced-Quantizations/GGUF): directly loading GGUF models into `ipex-llm`
 | 
			
		||||
  - [AWQ](python/llm/example/GPU/HF-Transformers-AutoModels/Advanced-Quantizations/AWQ): directly loading AWQ models into `ipex-llm`
 | 
			
		||||
  - [GPTQ](python/llm/example/GPU/HF-Transformers-AutoModels/Advanced-Quantizations/QPTQ): directly loading GPTQ models into `ipex-llm`
 | 
			
		||||
- Finetuning
 | 
			
		||||
  - LLM finetuning on Intel [GPU](python/llm/example/GPU/LLM-Finetuning), including [LoRA](python/llm/example/GPU/LLM-Finetuning/LoRA), [QLoRA](python/llm/example/GPU/LLM-Finetuning/QLoRA), [DPO](python/llm/example/GPU/LLM-Finetuning/DPO), [QA-LoRA](python/llm/example/GPU/LLM-Finetuning/QA-LoRA) and [ReLoRA](python/llm/example/GPU/LLM-Finetuning/ReLora)
 | 
			
		||||
  - QLoRA finetuning on Intel [CPU](python/llm/example/CPU/QLoRA-FineTuning)
 | 
			
		||||
- Integration with community libraries
 | 
			
		||||
  - [HuggingFace tansformers](python/llm/example/GPU/HF-Transformers-AutoModels)
 | 
			
		||||
  - [Standard PyTorch model](python/llm/example/GPU/PyTorch-Models)
 | 
			
		||||
  - [DeepSpeed-AutoTP](python/llm/example/GPU/Deepspeed-AutoTP)
 | 
			
		||||
  - [HuggingFace PEFT](python/llm/example/GPU/LLM-Finetuning/HF-PEFT)
 | 
			
		||||
  - [HuggingFace TRL](python/llm/example/GPU/LLM-Finetuning/DPO)
 | 
			
		||||
  - [LangChain](python/llm/example/GPU/LangChain)
 | 
			
		||||
  - [LlamaIndex](python/llm/example/GPU/LlamaIndex)
 | 
			
		||||
  - [AutoGen](python/llm/example/CPU/Applications/autogen)
 | 
			
		||||
  - [ModeScope](python/llm/example/GPU/ModelScope-Models)
 | 
			
		||||
- [Tutorials](https://github.com/intel-analytics/bigdl-llm-tutorial)
 | 
			
		||||
 | 
			
		||||
##### Run Model
 | 
			
		||||
You may apply INT4 optimizations to any Hugging Face *Transformers* models as follows.
 | 
			
		||||
*For more details, please refer to the `ipex-llm` document [website](https://ipex-llm.readthedocs.io/).*
 | 
			
		||||
 | 
			
		||||
```python
 | 
			
		||||
#load Hugging Face Transformers model with INT4 optimizations
 | 
			
		||||
from ipex_llm.transformers import AutoModelForCausalLM
 | 
			
		||||
model = AutoModelForCausalLM.from_pretrained('/path/to/model/', load_in_4bit=True)
 | 
			
		||||
 | 
			
		||||
#run the optimized model on CPU
 | 
			
		||||
from transformers import AutoTokenizer
 | 
			
		||||
tokenizer = AutoTokenizer.from_pretrained(model_path)
 | 
			
		||||
input_ids = tokenizer.encode(input_str, ...)
 | 
			
		||||
output_ids = model.generate(input_ids, ...)
 | 
			
		||||
output = tokenizer.batch_decode(output_ids)
 | 
			
		||||
```
 | 
			
		||||
*See the complete examples [here](python/llm/example/CPU/HF-Transformers-AutoModels/Model).*
 | 
			
		||||
 | 
			
		||||
#### GPU INT4
 | 
			
		||||
##### Install
 | 
			
		||||
You may install **`ipex-llm`** on Intel GPU as follows:
 | 
			
		||||
> Note: See the [GPU installation guide](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Overview/install_gpu.html) for more details.
 | 
			
		||||
```bash
 | 
			
		||||
# below command will install intel_extension_for_pytorch==2.1.10+xpu as default
 | 
			
		||||
pip install --pre --upgrade ipex-llm[xpu] -f https://developer.intel.com/ipex-whl-stable-xpu
 | 
			
		||||
```
 | 
			
		||||
> Note: `ipex-llm` has been tested on Python 3.9, 3.10 and 3.11
 | 
			
		||||
 | 
			
		||||
##### Run Model
 | 
			
		||||
You may apply INT4 optimizations to any Hugging Face *Transformers* models as follows.
 | 
			
		||||
 | 
			
		||||
```python
 | 
			
		||||
#load Hugging Face Transformers model with INT4 optimizations
 | 
			
		||||
from ipex_llm.transformers import AutoModelForCausalLM
 | 
			
		||||
model = AutoModelForCausalLM.from_pretrained('/path/to/model/', load_in_4bit=True)
 | 
			
		||||
 | 
			
		||||
#run the optimized model on Intel GPU
 | 
			
		||||
model = model.to('xpu')
 | 
			
		||||
 | 
			
		||||
from transformers import AutoTokenizer
 | 
			
		||||
tokenizer = AutoTokenizer.from_pretrained(model_path)
 | 
			
		||||
input_ids = tokenizer.encode(input_str, ...).to('xpu')
 | 
			
		||||
output_ids = model.generate(input_ids, ...)
 | 
			
		||||
output = tokenizer.batch_decode(output_ids.cpu())
 | 
			
		||||
```
 | 
			
		||||
*See the complete examples [here](python/llm/example/GPU).*
 | 
			
		||||
 | 
			
		||||
#### More Low-Bit Support
 | 
			
		||||
##### Save and load
 | 
			
		||||
 | 
			
		||||
After the model is optimized using `ipex-llm`, you may save and load the model as follows:
 | 
			
		||||
```python
 | 
			
		||||
model.save_low_bit(model_path)
 | 
			
		||||
new_model = AutoModelForCausalLM.load_low_bit(model_path)
 | 
			
		||||
```
 | 
			
		||||
*See the complete example [here](python/llm/example/CPU/HF-Transformers-AutoModels/Save-Load).*
 | 
			
		||||
 | 
			
		||||
##### Additonal data types
 | 
			
		||||
 | 
			
		||||
In addition to INT4, You may apply other low bit optimizations (such as *INT8*, *INT5*, *NF4*, etc.) as follows: 
 | 
			
		||||
```python
 | 
			
		||||
model = AutoModelForCausalLM.from_pretrained('/path/to/model/', load_in_low_bit="sym_int8")
 | 
			
		||||
```
 | 
			
		||||
*See the complete example [here](python/llm/example/CPU/HF-Transformers-AutoModels/More-Data-Types).*
 | 
			
		||||
 | 
			
		||||
#### Verified Models
 | 
			
		||||
Over 40 models have been optimized/verified on `ipex-llm`, including *LLaMA/LLaMA2, ChatGLM/ChatGLM2, Mistral, Falcon, MPT, Baichuan/Baichuan2, InternLM, QWen* and more; see the example list below.
 | 
			
		||||
## Verified Models
 | 
			
		||||
Over 50 models have been optimized/verified on `ipex-llm`, including *LLaMA/LLaMA2, Mistral, Mixtral, Gemma, LLaVA, Whisper, ChatGLM2/ChatGLM3, Baichuan/Baichuan2, Qwen/Qwen-1.5, InternLM* and more; see the list below.
 | 
			
		||||
  
 | 
			
		||||
| Model      | CPU Example                                                    | GPU Example                                                     |
 | 
			
		||||
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
 | 
			
		||||
| LLaMA *(such as Vicuna, Guanaco, Koala, Baize, WizardLM, etc.)* | [link1](python/llm/example/CPU/Native-Models), [link2](python/llm/example/CPU/HF-Transformers-AutoModels/Model/vicuna) | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/vicuna) |
 | 
			
		||||
| LLaMA 2                                  | [link1](python/llm/example/CPU/Native-Models), [link2](python/llm/example/CPU/HF-Transformers-AutoModels/Model/llama2) | [link1](python/llm/example/GPU/HF-Transformers-AutoModels/Model/llama2), [link2-low GPU memory example](python/llm/example/GPU/PyTorch-Models/Model/llama2#example-2---low-memory-version-predict-tokens-using-generate-api) |
 | 
			
		||||
|------------|----------------------------------------------------------------|-----------------------------------------------------------------|
 | 
			
		||||
| LLaMA *(such as Vicuna, Guanaco, Koala, Baize, WizardLM, etc.)* | [link1](python/llm/example/CPU/Native-Models), [link2](python/llm/example/CPU/HF-Transformers-AutoModels/Model/vicuna) |[link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/vicuna)|
 | 
			
		||||
| LLaMA 2    | [link1](python/llm/example/CPU/Native-Models), [link2](python/llm/example/CPU/HF-Transformers-AutoModels/Model/llama2) | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/llama2)  |
 | 
			
		||||
| ChatGLM    | [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/chatglm)   |    | 
 | 
			
		||||
| ChatGLM2   | [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/chatglm2)  | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/chatglm2)   |
 | 
			
		||||
| ChatGLM3   | [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/chatglm3)  | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/chatglm3)   |
 | 
			
		||||
| 
						 | 
				
			
			@ -154,7 +128,7 @@ Over 40 models have been optimized/verified on `ipex-llm`, including *LLaMA/LLaM
 | 
			
		|||
| MPT        | [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/mpt)       | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/mpt)        |
 | 
			
		||||
| Dolly-v1   | [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/dolly_v1)  | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/dolly-v1)   | 
 | 
			
		||||
| Dolly-v2   | [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/dolly_v2)  | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/dolly-v2)   | 
 | 
			
		||||
| Replit Code                              | [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/replit) | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/replit) |
 | 
			
		||||
| Replit Code| [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/replit)    | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/replit)     |
 | 
			
		||||
| RedPajama  | [link1](python/llm/example/CPU/Native-Models), [link2](python/llm/example/CPU/HF-Transformers-AutoModels/Model/redpajama) |    | 
 | 
			
		||||
| Phoenix    | [link1](python/llm/example/CPU/Native-Models), [link2](python/llm/example/CPU/HF-Transformers-AutoModels/Model/phoenix)   |    | 
 | 
			
		||||
| StarCoder  | [link1](python/llm/example/CPU/Native-Models), [link2](python/llm/example/CPU/HF-Transformers-AutoModels/Model/starcoder) | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/starcoder) | 
 | 
			
		||||
| 
						 | 
				
			
			@ -195,6 +169,3 @@ Over 40 models have been optimized/verified on `ipex-llm`, including *LLaMA/LLaM
 | 
			
		|||
| Gemma | [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/gemma) | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/gemma) |
 | 
			
		||||
| DeciLM-7B | [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/deciLM-7b) | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/deciLM-7b) |
 | 
			
		||||
| Deepseek | [link](python/llm/example/CPU/HF-Transformers-AutoModels/Model/deepseek) | [link](python/llm/example/GPU/HF-Transformers-AutoModels/Model/deepseek) |
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
***For more details, please refer to the `ipex-llm` [Document](https://test-ipex-llm.readthedocs.io/en/main/doc/LLM/index.html), [Readme](python/llm), [Tutorial](https://github.com/intel-analytics/ipex-llm-tutorial) and [API Doc](https://ipex-llm.readthedocs.io/en/latest/doc/PythonAPI/LLM/index.html).***
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,28 +1,17 @@
 | 
			
		|||
# bigdl-llm upgrade guide
 | 
			
		||||
## Upgrade bigdl-llm to ipex-llm
 | 
			
		||||
Need to uninstall bigdl-llm and install ipex-llm first.
 | 
			
		||||
# `bigdl-llm` Migration Guide
 | 
			
		||||
## Upgrade `bigdl-llm` package to `ipex-llm`
 | 
			
		||||
First uninstall `bigdl-llm` and install `ipex-llm`.
 | 
			
		||||
```bash
 | 
			
		||||
pip uninstall -y bigdl-llm
 | 
			
		||||
pip install --pre --upgrade ipex-llm[all] # for cpu
 | 
			
		||||
pip install --pre --upgrade ipex-llm[xpu] -f https://developer.intel.com/ipex-whl-stable-xpu # for xpu
 | 
			
		||||
```
 | 
			
		||||
## Run bigdl-llm example code
 | 
			
		||||
Choose a way to modify the example code to use.
 | 
			
		||||
## Migrate `bigdl-llm` code to `ipex-llm`
 | 
			
		||||
There are two options to migrate `bigdl-llm` code to `ipex-llm`.
 | 
			
		||||
 | 
			
		||||
### 1.Run bigdl-llm example code with ipex-llm in compatible mode
 | 
			
		||||
Minimal change: Use `BIGDL_COMPATIBLE_MODE` to run, need to add `import ipex_llm` at the 
 | 
			
		||||
beginning of code with bigdl-llm examples.
 | 
			
		||||
```python
 | 
			
		||||
# need to add before import bigdl.llm
 | 
			
		||||
import ipex_llm
 | 
			
		||||
from bigdl.llm.transformers import AutoModelForCausalLM
 | 
			
		||||
model = AutoModelForCausalLM.from_pretrained(model_path,
 | 
			
		||||
                                             load_in_4bit=True,
 | 
			
		||||
                                             trust_remote_code=True)
 | 
			
		||||
```
 | 
			
		||||
### 1. Upgrade `bigdl-llm` code to `ipex-llm`
 | 
			
		||||
To upgrade `bigdl-llm` code to `ipex-llm`, simply replace all `bigdl.llm` with `ipex_llm`:
 | 
			
		||||
 | 
			
		||||
### 2.Upgrade bigdl-llm example code to ipex-llm
 | 
			
		||||
Need to replace all `bigdl.llm` with `ipex_llm`.
 | 
			
		||||
```python
 | 
			
		||||
#from bigdl.llm.transformers import AutoModelForCausalLM
 | 
			
		||||
from ipex_llm.transformers import AutoModelForCausalLM
 | 
			
		||||
| 
						 | 
				
			
			@ -31,3 +20,15 @@ model = AutoModelForCausalLM.from_pretrained(model_path,
 | 
			
		|||
                                             trust_remote_code=True)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### 2. Run `bigdl-llm` code in compatible mode (experimental)
 | 
			
		||||
To run in the compatible mode, simply add `import ipex_llm` at the beginning of the existing `bigdl-llm` code:
 | 
			
		||||
 | 
			
		||||
```python
 | 
			
		||||
# need to add the below line before "import bigdl.llm"
 | 
			
		||||
import ipex_llm
 | 
			
		||||
from bigdl.llm.transformers import AutoModelForCausalLM
 | 
			
		||||
model = AutoModelForCausalLM.from_pretrained(model_path,
 | 
			
		||||
                                             load_in_4bit=True,
 | 
			
		||||
                                             trust_remote_code=True)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue