From ec2d9de0eaeb946f80625a5558a83a58274ab30c Mon Sep 17 00:00:00 2001 From: Jinyi Wan <1w2j3y@sjtu.edu.cn> Date: Wed, 24 Jan 2024 15:50:54 +0800 Subject: [PATCH] Fix README.md for solar (#9957) --- python/llm/README.md | 2 +- .../HF-Transformers-AutoModels/Model/solar/README.md | 12 ++++++------ .../Model/solar/generate.py | 4 ++-- .../example/CPU/PyTorch-Models/Model/solar/README.md | 10 +++++----- .../CPU/PyTorch-Models/Model/solar/generate.py | 4 ++-- .../HF-Transformers-AutoModels/Model/solar/README.md | 10 +++++----- .../Model/solar/generate.py | 4 ++-- .../example/GPU/PyTorch-Models/Model/solar/README.md | 10 +++++----- .../GPU/PyTorch-Models/Model/solar/generate.py | 4 ++-- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/python/llm/README.md b/python/llm/README.md index fbc07e6c..185d72d8 100644 --- a/python/llm/README.md +++ b/python/llm/README.md @@ -74,7 +74,7 @@ Over 20 models have been optimized/verified on `bigdl-llm`, including *LLaMA/LLa | Distil-Whisper | [link](example/CPU/HF-Transformers-AutoModels/Model/distil-whisper) | [link](example/GPU/HF-Transformers-AutoModels/Model/distil-whisper) | | Yi | [link](example/CPU/HF-Transformers-AutoModels/Model/yi) | [link](example/GPU/HF-Transformers-AutoModels/Model/yi) | | BlueLM | [link](example/CPU/HF-Transformers-AutoModels/Model/bluelm) | [link](example/GPU/HF-Transformers-AutoModels/Model/bluelm) | -| Solar-10.7B | [link](example/CPU/HF-Transformers-AutoModels/Model/solar-10.7b) | [link](example/GPU/HF-Transformers-AutoModels/Model/solar-10.7b) | +| SOLAR | [link](example/CPU/HF-Transformers-AutoModels/Model/solar) | [link](example/GPU/HF-Transformers-AutoModels/Model/solar) | ### Working with `bigdl-llm` diff --git a/python/llm/example/CPU/HF-Transformers-AutoModels/Model/solar/README.md b/python/llm/example/CPU/HF-Transformers-AutoModels/Model/solar/README.md index 84850d98..063ffe35 100644 --- a/python/llm/example/CPU/HF-Transformers-AutoModels/Model/solar/README.md +++ b/python/llm/example/CPU/HF-Transformers-AutoModels/Model/solar/README.md @@ -1,11 +1,11 @@ -# SOLAR-10.7B -In this directory, you will find examples on how you could apply BigDL-LLM INT4 optimizations on SOLAR-10.7B models. For illustration purposes, we utilize the [upstage/SOLAR-10.7B-Instruct-v1.0](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0) as a reference SOLAR-10.7B model. +# SOLAR +In this directory, you will find examples on how you could apply BigDL-LLM INT4 optimizations on SOLAR models. For illustration purposes, we utilize the [upstage/SOLAR-10.7B-Instruct-v1.0](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0) as a reference SOLAR model. ## 0. Requirements To run these examples with BigDL-LLM, we have some recommended requirements for your machine, please refer to [here](../README.md#recommended-requirements) for more information. ## Example: Predict Tokens using `generate()` API -In the example [generate.py](./generate.py), we show a basic use case for a SOLAR-10.7B model to predict the next N tokens using `generate()` API, with BigDL-LLM INT4 optimizations. +In the example [generate.py](./generate.py), we show a basic use case for a SOLAR model to predict the next N tokens using `generate()` API, with BigDL-LLM INT4 optimizations. ### 1. Install We suggest using conda to manage environment: ```bash @@ -13,7 +13,7 @@ conda create -n llm python=3.9 conda activate llm pip install --pre --upgrade bigdl-llm[all] # install the latest bigdl-llm nightly build with 'all' option -pip install transformers==4.35.2 # required by SOLAR-10.7B +pip install transformers==4.35.2 # required by SOLAR ``` ### 2. Run @@ -22,13 +22,13 @@ python ./generate.py --repo-id-or-model-path REPO_ID_OR_MODEL_PATH --prompt PROM ``` Arguments info: -- `--repo-id-or-model-path REPO_ID_OR_MODEL_PATH`: argument defining the huggingface repo id for the SOLAR-10.7B model to be downloaded, or the path to the huggingface checkpoint folder. It is default to be `'upstage/SOLAR-10.7B-Instruct-v1.0'`. +- `--repo-id-or-model-path REPO_ID_OR_MODEL_PATH`: argument defining the huggingface repo id for the SOLAR model to be downloaded, or the path to the huggingface checkpoint folder. It is default to be `'upstage/SOLAR-10.7B-Instruct-v1.0'`. - `--prompt PROMPT`: argument defining the prompt to be infered (with integrated prompt format for chat). It is default to be `'What is AI?'`. - `--n-predict N_PREDICT`: argument defining the max number of tokens to predict. It is default to be `32`. > **Note**: When loading the model in 4-bit, BigDL-LLM converts linear layers in the model into INT4 format. In theory, a *X*B model saved in 16-bit will requires approximately 2*X* GB of memory for loading, and ~0.5*X* GB memory for further inference. > -> Please select the appropriate size of the SOLAR-10.7B model based on the capabilities of your machine. +> Please select the appropriate size of the SOLAR model based on the capabilities of your machine. #### 2.1 Client On client Windows machine, it is recommended to run directly with full utilization of all cores: diff --git a/python/llm/example/CPU/HF-Transformers-AutoModels/Model/solar/generate.py b/python/llm/example/CPU/HF-Transformers-AutoModels/Model/solar/generate.py index 0f7a30eb..91ec5000 100644 --- a/python/llm/example/CPU/HF-Transformers-AutoModels/Model/solar/generate.py +++ b/python/llm/example/CPU/HF-Transformers-AutoModels/Model/solar/generate.py @@ -28,9 +28,9 @@ from transformers import AutoTokenizer SOLAR_PROMPT_FORMAT = "### User:\n{prompt}\n### Assistant:\n" if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Predict Tokens using `generate()` API for SOLAR-10.7B model') + parser = argparse.ArgumentParser(description='Predict Tokens using `generate()` API for SOLAR model') parser.add_argument('--repo-id-or-model-path', type=str, default="upstage/SOLAR-10.7B-Instruct-v1.0", - help='The huggingface repo id for the SOLAR-10.7B model to be downloaded' + help='The huggingface repo id for the SOLAR model to be downloaded' ', or the path to the huggingface checkpoint folder') parser.add_argument('--prompt', type=str, default="What is AI?", help='Prompt to infer') diff --git a/python/llm/example/CPU/PyTorch-Models/Model/solar/README.md b/python/llm/example/CPU/PyTorch-Models/Model/solar/README.md index 3ecbf0f9..c508828a 100644 --- a/python/llm/example/CPU/PyTorch-Models/Model/solar/README.md +++ b/python/llm/example/CPU/PyTorch-Models/Model/solar/README.md @@ -1,11 +1,11 @@ -# SOLAR-10.7B -In this directory, you will find examples on how you could use BigDL-LLM `optimize_model` API to accelerate SOLAR-10.7B models. For illustration purposes, we utilize the [upstage/SOLAR-10.7B-Instruct-v1.0](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0) as a reference SOLAR-10.7B model. +# SOLAR +In this directory, you will find examples on how you could use BigDL-LLM `optimize_model` API to accelerate SOLAR models. For illustration purposes, we utilize the [upstage/SOLAR-10.7B-Instruct-v1.0](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0) as a reference SOLAR model. ## Requirements To run these examples with BigDL-LLM, we have some recommended requirements for your machine, please refer to [here](../README.md#recommended-requirements) for more information. ## Example: Predict Tokens using `generate()` API -In the example [generate.py](./generate.py), we show a basic use case for a SOLAR-10.7B model to predict the next N tokens using `generate()` API, with BigDL-LLM INT4 optimizations. +In the example [generate.py](./generate.py), we show a basic use case for a SOLAR model to predict the next N tokens using `generate()` API, with BigDL-LLM INT4 optimizations. ### 1. Install We suggest using conda to manage the Python environment. For more information about conda installation, please refer to [here](https://docs.conda.io/en/latest/miniconda.html#). @@ -15,7 +15,7 @@ conda create -n llm python=3.9 # recommend to use Python 3.9 conda activate llm pip install --pre --upgrade bigdl-llm[all] # install the latest bigdl-llm nightly build with 'all' option -pip install transformers==4.35.2 # required by SOLAR-10.7B +pip install transformers==4.35.2 # required by SOLAR ``` ### 2. Run @@ -45,7 +45,7 @@ More information about arguments can be found in [Arguments Info](#23-arguments- #### 2.3 Arguments Info In the example, several arguments can be passed to satisfy your requirements: -- `--repo-id-or-model-path`: str, argument defining the huggingface repo id for the SOLAR-10.7B model to be downloaded, or the path to the huggingface checkpoint folder. It is default to be `'upstage/SOLAR-10.7B-Instruct-v1.0'`. +- `--repo-id-or-model-path`: str, argument defining the huggingface repo id for the SOLAR model to be downloaded, or the path to the huggingface checkpoint folder. It is default to be `'upstage/SOLAR-10.7B-Instruct-v1.0'`. - `--prompt`: str, argument defining the prompt to be inferred (with integrated prompt format for chat). It is default to be `'What is AI?'`. - `--n-predict`: int, argument defining the max number of tokens to predict. It is default to be `32`. diff --git a/python/llm/example/CPU/PyTorch-Models/Model/solar/generate.py b/python/llm/example/CPU/PyTorch-Models/Model/solar/generate.py index bba56339..612d9aca 100644 --- a/python/llm/example/CPU/PyTorch-Models/Model/solar/generate.py +++ b/python/llm/example/CPU/PyTorch-Models/Model/solar/generate.py @@ -27,9 +27,9 @@ from bigdl.llm import optimize_model SOLAR_PROMPT_FORMAT = "### User:\n{prompt}\n### Assistant:\n" if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Predict Tokens using `generate()` API for SOLAR-10.7B model') + parser = argparse.ArgumentParser(description='Predict Tokens using `generate()` API for SOLAR model') parser.add_argument('--repo-id-or-model-path', type=str, default="upstage/SOLAR-10.7B-Instruct-v1.0", - help='The huggingface repo id for the SOLAR-10.7B model to be downloaded' + help='The huggingface repo id for the SOLAR model to be downloaded' ', or the path to the huggingface checkpoint folder') parser.add_argument('--prompt', type=str, default="What is AI?", help='Prompt to infer') diff --git a/python/llm/example/GPU/HF-Transformers-AutoModels/Model/solar/README.md b/python/llm/example/GPU/HF-Transformers-AutoModels/Model/solar/README.md index 06fe0450..cd591d34 100644 --- a/python/llm/example/GPU/HF-Transformers-AutoModels/Model/solar/README.md +++ b/python/llm/example/GPU/HF-Transformers-AutoModels/Model/solar/README.md @@ -1,11 +1,11 @@ -# SOLAR-10.7B -In this directory, you will find examples on how you could apply BigDL-LLM INT4 optimizations on SOLAR-10.7B models on [Intel GPUs](../../../README.md). For illustration purposes, we utilize the [upstage/SOLAR-10.7B-Instruct-v1.0](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0) as a reference SOLAR-10.7B model. +# SOLAR +In this directory, you will find examples on how you could apply BigDL-LLM INT4 optimizations on SOLAR models on [Intel GPUs](../README.md). For illustration purposes, we utilize the [upstage/SOLAR-10.7B-Instruct-v1.0](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0) as a reference SOLAR model. ## 0. Requirements To run these examples with BigDL-LLM on Intel GPUs, we have some recommended requirements for your machine, please refer to [here](../../../README.md#requirements) for more information. ## Example: Predict Tokens using `generate()` API -In the example [generate.py](./generate.py), we show a basic use case for a SOLAR-10.7B model to predict the next N tokens using `generate()` API, with BigDL-LLM INT4 optimizations on Intel GPUs. +In the example [generate.py](./generate.py), we show a basic use case for a SOLAR model to predict the next N tokens using `generate()` API, with BigDL-LLM INT4 optimizations on Intel GPUs. ### 1. Install We suggest using conda to manage environment: ```bash @@ -13,7 +13,7 @@ conda create -n llm python=3.9 conda activate llm # below command will install intel_extension_for_pytorch==2.1.10+xpu as default pip install --pre --upgrade bigdl-llm[xpu] -f https://developer.intel.com/ipex-whl-stable-xpu -pip install transformers==4.35.2 # required by SOLAR-10.7B +pip install transformers==4.35.2 # required by SOLAR ``` ### 2. Configures OneAPI environment variables @@ -35,7 +35,7 @@ python ./generate.py --repo-id-or-model-path REPO_ID_OR_MODEL_PATH --prompt PROM ``` Arguments info: -- `--repo-id-or-model-path REPO_ID_OR_MODEL_PATH`: argument defining the huggingface repo id for the SOLAR-10.7B model (e.g `upstage/SOLAR-10.7B-Instruct-v1.0`) to be downloaded, or the path to the huggingface checkpoint folder. It is default to be `'upstage/SOLAR-10.7B-Instruct-v1.0'`. +- `--repo-id-or-model-path REPO_ID_OR_MODEL_PATH`: argument defining the huggingface repo id for the SOLAR model (e.g `upstage/SOLAR-10.7B-Instruct-v1.0`) to be downloaded, or the path to the huggingface checkpoint folder. It is default to be `'upstage/SOLAR-10.7B-Instruct-v1.0'`. - `--prompt PROMPT`: argument defining the prompt to be infered (with integrated prompt format for chat). It is default to be `'What is AI?'`. - `--n-predict N_PREDICT`: argument defining the max number of tokens to predict. It is default to be `32`. diff --git a/python/llm/example/GPU/HF-Transformers-AutoModels/Model/solar/generate.py b/python/llm/example/GPU/HF-Transformers-AutoModels/Model/solar/generate.py index 0c9c5976..6b105bad 100644 --- a/python/llm/example/GPU/HF-Transformers-AutoModels/Model/solar/generate.py +++ b/python/llm/example/GPU/HF-Transformers-AutoModels/Model/solar/generate.py @@ -28,9 +28,9 @@ from transformers import AutoTokenizer SOLAR_PROMPT_FORMAT = "### User:\n{prompt}\n### Assistant:\n" if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Predict Tokens using `generate()` API for SOLAR-10.7B model') + parser = argparse.ArgumentParser(description='Predict Tokens using `generate()` API for SOLAR model') parser.add_argument('--repo-id-or-model-path', type=str, default="upstage/SOLAR-10.7B-Instruct-v1.0", - help='The huggingface repo id for the SOLAR-10.7B model to be downloaded' + help='The huggingface repo id for the SOLAR model to be downloaded' ', or the path to the huggingface checkpoint folder') parser.add_argument('--prompt', type=str, default="What is AI?", help='Prompt to infer') diff --git a/python/llm/example/GPU/PyTorch-Models/Model/solar/README.md b/python/llm/example/GPU/PyTorch-Models/Model/solar/README.md index 9262ac2a..0a0de502 100644 --- a/python/llm/example/GPU/PyTorch-Models/Model/solar/README.md +++ b/python/llm/example/GPU/PyTorch-Models/Model/solar/README.md @@ -1,11 +1,11 @@ -# SOLAR-10.7B -In this directory, you will find examples on how you could use BigDL-LLM `optimize_model` API to accelerate SOLAR-10.7B models. For illustration purposes, we utilize the [upstage/SOLAR-10.7B-Instruct-v1.0](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0) as a reference SOLAR-10.7B model. +# SOLAR +In this directory, you will find examples on how you could use BigDL-LLM `optimize_model` API to accelerate SOLAR models. For illustration purposes, we utilize the [upstage/SOLAR-10.7B-Instruct-v1.0](https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0) as a reference SOLAR model. ## Requirements To run these examples with BigDL-LLM on Intel GPUs, we have some recommended requirements for your machine, please refer to [here](../../../README.md#requirements) for more information. ## Example: Predict Tokens using `generate()` API -In the example [generate.py](./generate.py), we show a basic use case for a SOLAR-10.7B model to predict the next N tokens using `generate()` API, with BigDL-LLM INT4 optimizations on Intel GPUs. +In the example [generate.py](./generate.py), we show a basic use case for a SOLAR model to predict the next N tokens using `generate()` API, with BigDL-LLM INT4 optimizations on Intel GPUs. ### 1. Install We suggest using conda to manage the Python environment. For more information about conda installation, please refer to [here](https://docs.conda.io/en/latest/miniconda.html#). @@ -16,7 +16,7 @@ conda activate llm # below command will install intel_extension_for_pytorch==2.1.10+xpu as default pip install --pre --upgrade bigdl-llm[xpu] -f https://developer.intel.com/ipex-whl-stable-xpu -pip install transformers==4.35.2 # required by SOLAR-10.7B +pip install transformers==4.35.2 # required by SOLAR ``` ### 2. Configures OneAPI environment variables @@ -39,7 +39,7 @@ python ./generate.py --repo-id-or-model-path REPO_ID_OR_MODEL_PATH --prompt PROM In the example, several arguments can be passed to satisfy your requirements: -- `--repo-id-or-model-path REPO_ID_OR_MODEL_PATH`: argument defining the huggingface repo id for the SOLAR-10.7B model (e.g `upstage/SOLAR-10.7B-Instruct-v1.0`) to be downloaded, or the path to the huggingface checkpoint folder. It is default to be `'upstage/SOLAR-10.7B-Instruct-v1.0'`. +- `--repo-id-or-model-path REPO_ID_OR_MODEL_PATH`: argument defining the huggingface repo id for the SOLAR model (e.g `upstage/SOLAR-10.7B-Instruct-v1.0`) to be downloaded, or the path to the huggingface checkpoint folder. It is default to be `'upstage/SOLAR-10.7B-Instruct-v1.0'`. - `--prompt PROMPT`: argument defining the prompt to be infered (with integrated prompt format for chat). It is default to be `'What is AI?'`. - `--n-predict N_PREDICT`: argument defining the max number of tokens to predict. It is default to be `32`. diff --git a/python/llm/example/GPU/PyTorch-Models/Model/solar/generate.py b/python/llm/example/GPU/PyTorch-Models/Model/solar/generate.py index 3dd53fb2..af9b2844 100644 --- a/python/llm/example/GPU/PyTorch-Models/Model/solar/generate.py +++ b/python/llm/example/GPU/PyTorch-Models/Model/solar/generate.py @@ -28,9 +28,9 @@ from bigdl.llm import optimize_model SOLAR_PROMPT_FORMAT = "### User:\n{prompt}\n### Assistant:\n" if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Predict Tokens using `generate()` API for SOLAR-10.7B model') + parser = argparse.ArgumentParser(description='Predict Tokens using `generate()` API for SOLAR model') parser.add_argument('--repo-id-or-model-path', type=str, default="upstage/SOLAR-10.7B-Instruct-v1.0", - help='The huggingface repo id for the SOLAR-10.7B model to be downloaded' + help='The huggingface repo id for the SOLAR model to be downloaded' ', or the path to the huggingface checkpoint folder') parser.add_argument('--prompt', type=str, default="What is AI?", help='Prompt to infer')