repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
llm-on-ray | github_2023 | others | 84 | intel | xwu99 | @@ -0,0 +1,56 @@
+#!/bin/bash
+set -eo pipefail
+
+# Step 1: Python environment
+# Check Python version is or later than 3.9
+echo "Step 1: Python environment"
+echo "Checking Python version which should be equal or later than 3.9"
+if ! python -c 'import sys; assert sys.version_info >= (3,9)' > /dev/null; then
+ ex... | @Deegue It looks to me, there are some duplications for getting_started and setup for the setup process, is it better we can consolidate them into single one?
Also may I suggest to use bash functions for setup and step 1,2,3 for better structure and code reuse. for setup function, you can define arguments for differ... |
llm-on-ray | github_2023 | others | 84 | intel | xwu99 | @@ -0,0 +1,66 @@
+#!/bin/bash
+set -eo pipefail
+
+# Step 1: Python environment
+# Check Python version is or later than 3.9
+echo "Step 1: Python environment"
+echo "Checking Python version which should be equal or later than 3.9"
+if ! python -c 'import sys; assert sys.version_info >= (3,9)' > /dev/null; then
+ ex... | L16-L18 has been updated. pls check README.md
pip install .[cpu] --extra-index-url https://download.pytorch.org/whl/cpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/cpu/us/
|
llm-on-ray | github_2023 | others | 84 | intel | xwu99 | @@ -0,0 +1,66 @@
+#!/bin/bash
+set -eo pipefail
+
+# Step 1: Python environment
+# Check Python version is or later than 3.9
+echo "Step 1: Python environment"
+echo "Checking Python version which should be equal or later than 3.9"
+if ! python -c 'import sys; assert sys.version_info >= (3,9)' > /dev/null; then
+ ex... | ```suggestion
source $(python -c "import oneccl_bindings_for_pytorch as torch_ccl; print(torch_ccl.cwd)")/env/setvars.sh
``` |
llm-on-ray | github_2023 | others | 84 | intel | xwu99 | @@ -0,0 +1,66 @@
+#!/bin/bash
+set -eo pipefail
+
+# Step 1: Python environment
+# Check Python version is or later than 3.9
+echo "Step 1: Python environment"
+echo "Checking Python version which should be equal or later than 3.9"
+if ! python -c 'import sys; assert sys.version_info >= (3,9)' > /dev/null; then
+ ex... | ```suggestion
echo "Step 4: Access OpenAI API"
``` |
llm-on-ray | github_2023 | others | 84 | intel | xwu99 | @@ -0,0 +1,66 @@
+#!/bin/bash
+set -eo pipefail
+
+# Step 1: Python environment
+# Check Python version is or later than 3.9
+echo "Step 1: Python environment"
+echo "Checking Python version which should be equal or later than 3.9"
+if ! python -c 'import sys; assert sys.version_info >= (3,9)' > /dev/null; then
+ ex... | ```suggestion
echo "Method 1: Using curl to access model"
```
same for the following |
llm-on-ray | github_2023 | others | 84 | intel | xwu99 | @@ -8,6 +8,84 @@ on:
default: 'pr'
jobs:
+ setup-test:
+
+ name: setup-test
+ strategy:
+ matrix:
+ python-version: ["3.9", "3.10", "3.11"]
+
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: bash
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v... | ```suggestion
# Additional libraries required for pytest
``` |
llm-on-ray | github_2023 | others | 84 | intel | xwu99 | @@ -8,6 +8,84 @@ on:
default: 'pr'
jobs:
+ setup-test:
+
+ name: setup-test
+ strategy:
+ matrix:
+ python-version: ["3.9", "3.10", "3.11"]
+
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ shell: bash
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v... | ```suggestion
# Additional libraries required for pytest
``` |
llm-on-ray | github_2023 | others | 84 | intel | xwu99 | @@ -0,0 +1,66 @@
+#!/bin/bash
+set -eo pipefail
+
+# Step 1: Python environment
+# Check Python version is or later than 3.9
+echo "Step 1: Python environment"
+echo "Checking Python version which should be equal or later than 3.9"
+if ! python -c 'import sys; assert sys.version_info >= (3,9)' > /dev/null; then
+ ex... | ```suggestion
echo "Starting ray server for gpt2 with 1 cpu per worker"
``` |
llm-on-ray | github_2023 | others | 84 | intel | xwu99 | @@ -0,0 +1,62 @@
+#!/bin/bash
+set -eo pipefail
+
+# Usage: ./test_setup [CPU, GPU, Gaudi] [True for Deepspeed and false for disable]
+
+if [ "$#" != 2 ]; then
+ echo "Error, there should be 2 arguments! See Usage: ./test_setup [CPU, GPU, Gaudi] [True for Deepspeed and false for disable]"
+ exit 1
+fi
+
+# Step 1... | ```suggestion
# Step 4: Check if it is installed correctly
``` |
llm-on-ray | github_2023 | others | 92 | intel | xwu99 | @@ -6,7 +6,6 @@ on:
ci_type:
type: string
default: 'pr'
- | it's OK to leave a blank line here. |
llm-on-ray | github_2023 | python | 92 | intel | xwu99 | @@ -0,0 +1,139 @@
+import subprocess
+import pytest
+
+# Config matrix
+# config_file_array = ["inference/models/gpt2.yaml", None]
+# model_id_or_path_array = ["gpt2", None]
+# models_array = ["gpt2", "gpt2 gpt-j-6b", "gpt2 bloom-560m falcon-7b"]
+# port_array = [8000, None]
+# route_prefix_array = [None]
+# cpus_per_w... | It's better to print out the result if we want to check it in the CI before we find a better way to assert. |
llm-on-ray | github_2023 | python | 92 | intel | xwu99 | @@ -0,0 +1,125 @@
+import subprocess
+import pytest
+
+# Config matrix
+# config_file_array = ["inference/models/gpt2.yaml", None]
+# model_id_or_path_array = ["gpt2", None]
+# models_array = ["gpt2", "gpt2 gpt-j-6b", "gpt2 bloom-560m falcon-7b"]
+# port_array = [8000, None]
+# route_prefix_array = [None]
+# cpus_per_w... | ```suggestion
print("Output of stderr:")
``` |
llm-on-ray | github_2023 | python | 92 | intel | xwu99 | @@ -0,0 +1,125 @@
+import subprocess
+import pytest
+
+# Config matrix
+# config_file_array = ["inference/models/gpt2.yaml", None]
+# model_id_or_path_array = ["gpt2", None]
+# models_array = ["gpt2", "gpt2 gpt-j-6b", "gpt2 bloom-560m falcon-7b"]
+# port_array = [8000, None]
+# route_prefix_array = [None]
+# cpus_per_w... | ```suggestion
``` |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -1,13 +1,34 @@
name: tests
on:
- workflow_call
+ workflow_call:
+ inputs:
+ ci_type:
+ type: string
+ default: 'pr'
+ no_proxy:
+ type: string
+ default: 'localhost,127.0.0.1'
+ OPENAI_API_BASE:
+ type: string
+ default: 'http://localhost:8000/v1'
+ ... | no need. from Checkout action below to get checkout path. It should checks out your repository under $GITHUB_WORKSPACE |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -1,13 +1,34 @@
name: tests
on:
- workflow_call
+ workflow_call:
+ inputs:
+ ci_type:
+ type: string
+ default: 'pr'
+ no_proxy:
+ type: string
+ default: 'localhost,127.0.0.1'
+ OPENAI_API_BASE: | don't define test related constants here, should define elsewhere |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -1,13 +1,34 @@
name: tests
on:
- workflow_call
+ workflow_call:
+ inputs:
+ ci_type:
+ type: string
+ default: 'pr'
+ no_proxy:
+ type: string
+ default: 'localhost,127.0.0.1'
+ OPENAI_API_BASE:
+ type: string
+ default: 'http://localhost:8000/v1'
+ ... | This is part of the test, it's better to stay with the test code. |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -23,13 +44,79 @@ jobs:
architecture: 'x64'
- name: Display Python version
- run: python -c "import sys; print(sys.version)"
+ run: |
+ python -c "import sys; print(sys.version)"
+ bash -c "ls"
- name: Install dependencies |
```suggestion
- name: Install dependencies for tests
``` |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -23,13 +44,79 @@ jobs:
architecture: 'x64'
- name: Display Python version
- run: python -c "import sys; print(sys.version)"
+ run: |
+ python -c "import sys; print(sys.version)"
+ bash -c "ls"
- name: Install dependencies
run: |
python ... | what is the reason for using bash -c instead of direct calling? |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -1,13 +1,34 @@
name: tests
on:
- workflow_call
+ workflow_call:
+ inputs:
+ ci_type:
+ type: string
+ default: 'pr'
+ no_proxy:
+ type: string
+ default: 'localhost,127.0.0.1'
+ OPENAI_API_BASE:
+ type: string
+ default: 'http://localhost:8000/v1'
+ ... | consider change the name build/build-docker to sth else such as bare-test/docker-test? |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -23,13 +44,79 @@ jobs:
architecture: 'x64' | could we add test matrix to python-version that 3.9, 3.10, 3.11 (supported by IPEX) will all be tested? |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -23,13 +44,79 @@ jobs:
architecture: 'x64'
- name: Display Python version
- run: python -c "import sys; print(sys.version)"
+ run: |
+ python -c "import sys; print(sys.version)"
+ bash -c "ls"
- name: Install dependencies
run: |
python ... | Could we move all docker related blocks for all workflow actions into functions in some bash script and source from them?
It can reduce code duplications and easier to maintain. |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -1,13 +1,31 @@
name: tests
on:
- workflow_call
+ workflow_call:
+ inputs:
+ ci_type:
+ type: string
+ default: 'pr'
jobs:
- build:
-
+ bare-test:
+
+ name: bare-test
+ strategy:
+ matrix:
+ python-version: [3.9, 3.10 , 3.11] | ```suggestion
python-version: [3.9, 3.10, 3.11]
``` |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -19,17 +37,80 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
- python-version: '3.9'
+ python-version: ${{matrix.python-version}}
architecture: 'x64'
- name: Display Python version
- run: python -c "import sys; print(sys.versio... | Pls check README.md for latest update for installing
```suggestion
pip install .[cpu] --extra-index-url https://download.pytorch.org/whl/cpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/cpu/us/
``` |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -19,17 +37,80 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
- python-version: '3.9'
+ python-version: ${{matrix.python-version}}
architecture: 'x64'
- name: Display Python version
- run: python -c "import sys; print(sys.versio... | ```suggestion
source $(python -c "import oneccl_bindings_for_pytorch as torch_ccl; print(torch_ccl.cwd)")/env/setvars.sh
``` |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -1,7 +1,10 @@
#!/bin/bash
+set -eo pipefail
cd $(dirname $0)
+pip install -r ./requirements.txt | consider separate out installing requirements in run-test.sh since it only needs to do once. Suggest to do this in "Install dependencies for tests" of the workflow_tests.yml. |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -19,17 +37,80 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
- python-version: '3.9'
+ python-version: ${{matrix.python-version}}
architecture: 'x64'
- name: Display Python version
- run: python -c "import sys; print(sys.versio... | ```suggestion
docker-test:
``` |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -19,17 +37,80 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
- python-version: '3.9'
+ python-version: ${{matrix.python-version}}
architecture: 'x64'
- name: Display Python version
- run: python -c "import sys; print(sys.versio... | ```suggestion
- name: Run Tests
``` |
llm-on-ray | github_2023 | python | 83 | intel | xwu99 | @@ -0,0 +1,63 @@
+import subprocess
+import pytest
+
+
+def script_with_args(model_name, streaming_response, max_new_tokens, temperature, top_p):
+ config_path = "../.github/workflows/config/" + model_name + ".yaml" | suggest to get current script absolute path as base path and set other path relative to it, then this script will be independent from where your run from. |
llm-on-ray | github_2023 | python | 83 | intel | xwu99 | @@ -0,0 +1,78 @@
+import subprocess
+import pytest
+import os
+
+os.environ["no_proxy"] = "localhost,127.0.0.1"
+os.environ["OPENAI_API_BASE"] = "http://localhost:8000/v1"
+os.environ["OPENAI_API_KEY"] = "YOUR_OPEN_AI_KEY"
+os.environ["OPENAI_BASE_URL"] = "http://localhost:8000/v1"
+
+
+def script_with_args(api_base, m... | same again, it's ok to just put the list here to shorten code such as
for api_base in ["http://localhost:8000/v1"]
same for other cases. |
llm-on-ray | github_2023 | python | 83 | intel | xwu99 | @@ -0,0 +1,63 @@
+import subprocess
+import pytest
+
+
+def script_with_args(model_name, streaming_response, max_new_tokens, temperature, top_p):
+ config_path = "../.github/workflows/config/" + model_name + ".yaml"
+
+ cmd_serve = ["python", "../inference/serve.py", "--config_file", config_path]
+
+ result_se... | Just use constant list to fill the argument directly is OK |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -1,13 +1,31 @@
name: tests
on:
- workflow_call
+ workflow_call:
+ inputs:
+ ci_type:
+ type: string
+ default: 'pr'
jobs:
- build:
-
+ bare-test:
+
+ name: bare-test
+ strategy:
+ matrix:
+ python-version: [3.9, 3.10, 3.11]
+ isPR: | I think you just need to use L16, L17-L26 are unnecessary. |
llm-on-ray | github_2023 | others | 83 | intel | xwu99 | @@ -19,17 +37,100 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
- python-version: '3.9'
+ python-version: ${{matrix.python-version}}
architecture: 'x64'
- name: Display Python version
- run: python -c "import sys; print(sys.versi... |
```suggestion
- name: Run Tests
``` |
llm-on-ray | github_2023 | python | 83 | intel | xwu99 | @@ -0,0 +1,79 @@
+import subprocess
+import pytest
+import os
+
+os.environ["no_proxy"] = "localhost,127.0.0.1"
+os.environ["OPENAI_API_BASE"] = "http://localhost:8000/v1"
+os.environ["OPENAI_API_KEY"] = "YOUR_OPEN_AI_KEY"
+os.environ["OPENAI_BASE_URL"] = "http://localhost:8000/v1"
+
+
+def script_with_args(api_base, m... | Could you also print the output of `subprocess.run` so that we can check if the output is expected? |
llm-on-ray | github_2023 | python | 106 | intel | xwu99 | @@ -3,7 +3,7 @@
def update_finetune_config(base_model):
- conf_file = "finetune/finetune.yaml"
+ conf_file = "llmonray/finetune/finetune.yaml" | `llmonray` is cluttered and hard to read. use `llm_on_ray` instead just like intel_extension_for_pytorch |
llm-on-ray | github_2023 | others | 106 | intel | xwu99 | @@ -113,14 +113,14 @@ jobs:
EOF
)
docker exec "finetune" python -c "$CMD"
- docker exec "finetune" bash -c "python finetune/finetune.py --config_file finetune/finetune.yaml"
+ docker exec "finetune" bash -c "python -m llmonray.finetune.finetune --config_file llmonray/f... | llmonray.finetune.finetune is verbose. Use module llm_on_ray.finetune, may need to expose interfaces in module `__init__.py` and run from it.
Another better way is to use setup.py to install a command into bin and call `llm_on_ray-finetune` comand line instead, you can check how to do this from rayllm. |
llm-on-ray | github_2023 | others | 106 | intel | xwu99 | @@ -123,27 +123,27 @@ Set up `megatron_deepspeed_path` in the configuration.
```bash
cd /home/user/workspace/llm-on-ray
#Bloom-7B | add extra space after Bloom-7B, same below
```suggestion
# Bloom-7B
``` |
llm-on-ray | github_2023 | others | 106 | intel | xwu99 | @@ -23,7 +23,7 @@ Please follow [Deploying and Serving LLMs on Intel CPU/GPU/Gaudi](serve.md) docu
To serve model with vLLM, run the following:
```bash
-$ python serve.py --config_file inference/models/vllm/llama-2-7b-chat-hf-vllm.yaml --simple --keep_serve_terminal
+$ llm_on_ray-serve --config_file llm_on_ray/infe... | remove leading $, same below
```suggestion
llm_on_ray-serve --config_file llm_on_ray/inference/models/vllm/llama-2-7b-chat-hf-vllm.yaml --simple --keep_serve_terminal
``` |
llm-on-ray | github_2023 | others | 106 | intel | xwu99 | @@ -14,7 +14,7 @@ $ dev/scripts/install-ui.sh
## Start Web UI | need to remove leading $ to be consistent for above lines: dev/scripts/install-ui.sh
|
llm-on-ray | github_2023 | others | 106 | intel | xwu99 | @@ -27,7 +27,7 @@ RUN --mount=type=cache,target=/opt/conda/pkgs conda init bash && \
COPY ./pyproject.toml .
COPY ./MANIFEST.in .
-RUN mkdir ./finetune && mkdir ./inference
+RUN mkdir ./llm_on_ray | You map the source code path to /root/llm-on-ray directory in workflow but create llm_on_ray here, what is the intention for this directory?
|
llm-on-ray | github_2023 | python | 106 | intel | xwu99 | @@ -2,7 +2,7 @@
import glob
import importlib
-from .logging import logger
+from llm_on_ray.common.logging import logger
def import_all_module(basedir, prefix=None): |
```suggestion
def import_all_modules(basedir, prefix=None):
``` |
llm-on-ray | github_2023 | python | 106 | intel | xwu99 | @@ -1,5 +1,5 @@
import torch # noqa: F401
-from .optimizer import Optimizer
+from llm_on_ray.common.optimizer.optimizer import Optimizer | Did you already expose Optimizer in `__all__` of `__init__.py`? so that the code can be written in below style:
```suggestion
from llm_on_ray.common.optimizer import Optimizer
```
There are many similar cases need to fix. |
llm-on-ray | github_2023 | python | 106 | intel | xwu99 | @@ -1,4 +1,4 @@
-from .tokenizer import Tokenizer
+from llm_on_ray.common.tokenizer.tokenizer import Tokenizer | same, try to reduce it to this style by importing package rather than module
```suggestion
from llm_on_ray.common.tokenizer import Tokenizer
``` |
llm-on-ray | github_2023 | python | 106 | intel | xwu99 | @@ -58,16 +58,16 @@ def __init__(self, infer_conf: InferenceConfig):
self.use_vllm = infer_conf.vllm.enabled
if self.use_deepspeed:
- from deepspeed_predictor import DeepSpeedPredictor
+ from llm_on_ray.inference.deepspeed_predictor import DeepSpeedPredictor
self... | try to reduce to import the package by adding TransformerPredictor in `__all__`
```suggestion
from llm_on_ray.inference import TransformerPredictor
``` |
llm-on-ray | github_2023 | python | 106 | intel | xwu99 | @@ -0,0 +1,9 @@
+import os
+from llm_on_ray.common.agentenv.agentenv import AgentEnv
+from llm_on_ray.common.common import import_all_modules
+
+realpath = os.path.realpath(__file__)
+basedir = os.path.dirname(realpath)
+import_all_modules(basedir, "llm_on_ray.common.agentenv") | I don't this it a good idea to import all modules in `__init__.py`, this is a declare of public and private components of the package.
Only needed modules/classes should be imported and used as:
`from package_name import xxx` |
llm-on-ray | github_2023 | others | 106 | intel | xwu99 | @@ -113,14 +113,14 @@ jobs:
EOF
)
docker exec "finetune" python -c "$CMD"
- docker exec "finetune" bash -c "python finetune/finetune.py --config_file finetune/finetune.yaml"
+ docker exec "finetune" bash -c "llm_on_ray-finetune --config_file llm_on_ray/finetune/finetu... |
```suggestion
docker exec "finetune" bash -c "llm_on_ray-finetune --config_file llm_on_ray/finetune/finetune.yaml"
``` |
llm-on-ray | github_2023 | others | 94 | intel | harborn | @@ -0,0 +1,49 @@
+{ | I think we should unifiy json format to yaml, and rename this conf to `ds_config_zero2.yaml` |
llm-on-ray | github_2023 | python | 94 | intel | harborn | @@ -77,10 +84,26 @@ def train_func(config: Dict[str, Any]):
offload_to_cpu=False, rank0_only=False
),
)
+ deepspeed_plugin = None
+
+ elif accelerate_mode in ["GPU_DEEPSPEED"]:
+ fsdp_plugin = None
+ hf_ds_config = config["Training"]["deepspeed_config_file"... | ``` python
with open(config["Training"]["deepspeed_config_file"]) as f:
hf_ds_config = yaml.full_load(f)
```
here `hf_ds_config` is a dict type object, and `DeepSpeedPlugin` can accept and process a dict type hf_ds_config. |
llm-on-ray | github_2023 | others | 125 | intel | jiafuzha | @@ -38,9 +38,9 @@ jobs:
- name: Running task on Intel GPU
run: |
- rm ~/borealis-runner/llm-on-ray.tar.gz -f
- tar zcf ~/borealis-runner/llm-on-ray.tar.gz -C ~/actions-runner/_work/llm-on-ray .
- cd ~/borealis-runner/
+ rm /home/ci/borealis-runner/llm-on-ray.tar.gz ... | finetune_on_pvc.py should be checked in to our repo. |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -0,0 +1,131 @@
+#
+# Copyright 2023 The LLM-on-Ray Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | Can we use a URL to this image here so it can work by default? Can you also update the help message if it can be a local path or a URL. |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -0,0 +1,131 @@
+#
+# Copyright 2023 The LLM-on-Ray Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | Update the description to include "image". |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -0,0 +1,131 @@
+#
+# Copyright 2023 The LLM-on-Ray Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required b... | Any reason to for these default values? |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -0,0 +1,72 @@
+import torch
+from transformers import TextIteratorStreamer
+from inference.inference_config import InferenceConfig, PRECISION_BF16
+from predictor import Predictor
+from inference.utils import module_import
+
+
+class MllmPredictor(Predictor):
+ def __init__(self, infer_conf: InferenceConfig):
+ ... | Can we keep this `torch_dtype` and pass it to `from_pretrained`? |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -0,0 +1,72 @@
+import torch
+from transformers import TextIteratorStreamer
+from inference.inference_config import InferenceConfig, PRECISION_BF16
+from predictor import Predictor
+from inference.utils import module_import
+
+
+class MllmPredictor(Predictor):
+ def __init__(self, infer_conf: InferenceConfig):
+ ... | Remove the above commented code? |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -0,0 +1,72 @@
+import torch
+from transformers import TextIteratorStreamer
+from inference.inference_config import InferenceConfig, PRECISION_BF16
+from predictor import Predictor
+from inference.utils import module_import
+
+
+class MllmPredictor(Predictor):
+ def __init__(self, infer_conf: InferenceConfig):
+ ... | Can you confirm if this model is supported by IPEX or not? |
llm-on-ray | github_2023 | others | 107 | intel | carsonwang | @@ -0,0 +1,26 @@
+port: 8000
+name: deplot
+route_prefix: /deplot
+cpus_per_worker: 24
+gpus_per_worker: 0
+deepspeed: false
+workers_per_group: 2
+device: "cpu"
+ipex:
+ enabled: false
+ precision: bf16
+model_description:
+ model_id_or_path: /mnt/nvme0n1/chendi/llm-on-ray/models/google/deplot
+ tokenizer_name_or_... | Update these to ids on huggingface |
llm-on-ray | github_2023 | others | 107 | intel | carsonwang | @@ -0,0 +1,26 @@
+port: 8000
+name: fuyu-8b
+route_prefix: /fuyu-8b
+cpus_per_worker: 24
+gpus_per_worker: 0
+deepspeed: false
+workers_per_group: 2
+device: "cpu"
+ipex:
+ enabled: false
+ precision: bf16
+model_description:
+ model_id_or_path: /mnt/nvme0n1/chendi/llm-on-ray/models/adept/fuyu-8b
+ tokenizer_name_o... | Update these to ids on huggingface |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -148,12 +152,18 @@ async def __call__(self, http_request: Request) -> Union[StreamingResponse, JSON
async def openai_call(self, prompt, config, streaming_response=True):
prompts = []
+ images = []
if isinstance(prompt, list):
prompt_format = get_prompt_format(prompt)
... | get_promipt -> get_prompt |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -166,19 +176,31 @@ async def openai_call(self, prompt, config, streaming_response=True):
prompts.append(prompt)
if not streaming_response:
+ model_response = None
if self.use_vllm:
generate_result = (await self.predictor.generate_async(prompts, **confi... | Why not returning `GenerateResult` in `MllmPredictor.generate` like other predictors? |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -674,10 +758,14 @@ def shutdown_deploy(self):
serve.shutdown()
def get_ray_cluster(self):
- command = "conda activate " + self.conda_env_name + "; ray status"
+ command = "source ~/anaconda3/bin/activate; conda activate " + self.conda_env_name + "; ray status" | We can't assume this path works in other users' environment. |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -35,17 +35,21 @@
help="Whether to enable streaming response",
)
parser.add_argument(
- "--max_new_tokens", default=None, help="The maximum numbers of tokens to generate"
+ "--max_new_tokens", default=256, help="The maximum numbers of tokens to generate"
)
parser.add_argument(
- "--temperature", def... | Can we revoke the default value changes in this file? If these default values work for the mllm models, it makes sense to set them in `image_query_http_requests.py` as you have done. But this file more general so let's just use openai's default value? |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -41,21 +41,47 @@
args = parser.parse_args()
-client = OpenAI()
-# # List all models.
-models = client.models.list()
-print(models.data, "\n")
-
-# Note: not all arguments are currently supported and will be ignored by the backend.
-chat_completion = client.chat.completions.create(
- model=args.model_name,
- ... | Use args.xxx |
llm-on-ray | github_2023 | python | 107 | intel | carsonwang | @@ -41,21 +41,47 @@
args = parser.parse_args()
-client = OpenAI()
-# # List all models.
-models = client.models.list()
-print(models.data, "\n")
-
-# Note: not all arguments are currently supported and will be ignored by the backend.
-chat_completion = client.chat.completions.create(
- model=args.model_name,
- ... | Use args.xxx |
llm-on-ray | github_2023 | others | 107 | intel | KepingYan | @@ -10,8 +10,8 @@ ipex:
enabled: false
precision: bf16
model_description:
- model_id_or_path: meta-llama/Llama-2-7b-chat-hf
- tokenizer_name_or_path: meta-llama/Llama-2-7b-chat-hf
+ model_id_or_path: /mnt/nvme0n1/chendi/llm-on-ray/models/meta-llama/Llama-2-7b-chat-hf
+ tokenizer_name_or_path: /mnt/nvme0n1/ch... | Please restore these default value. |
llm-on-ray | github_2023 | python | 107 | intel | KepingYan | @@ -166,9 +177,13 @@ async def openai_call(self, prompt, config, streaming_response=True):
prompts.append(prompt)
if not streaming_response:
+ model_response = None | It seems this value is not used. |
llm-on-ray | github_2023 | python | 107 | intel | KepingYan | @@ -795,16 +902,19 @@ def _init_ui(self):
for index in range(len(self.ray_nodes)):
if "node:__internal_head__" in ray.nodes()[index]["Resources"]:
mark_alive = index
- node_ip = self.ray_nodes[index]["NodeName"]
- self.ssh_connect[index] = paramiko.SSHClient(... | Please revert this. |
llm-on-ray | github_2023 | python | 107 | intel | KepingYan | @@ -1024,22 +1134,32 @@ def _init_ui(self):
label="Top k",
info="The number of highest probability vocabulary tokens to keep for top-k-filtering.",
)
-
with gr.Tab("Dialogue"):
chatbot = gr.Chatbot(
... | Is it better for the default value to be None? We can set placeholder to let users know that it can be a pre-deployed endpoint or the endpoint returned from deployment module. |
llm-on-ray | github_2023 | python | 107 | intel | KepingYan | @@ -1024,22 +1134,32 @@ def _init_ui(self):
label="Top k",
info="The number of highest probability vocabulary tokens to keep for top-k-filtering.",
)
-
with gr.Tab("Dialogue"):
chatbot = gr.Chatbot(
... | Same here. Because the default value may not be deployed by users. |
llm-on-ray | github_2023 | python | 107 | intel | KepingYan | @@ -41,21 +41,47 @@
args = parser.parse_args()
-client = OpenAI()
-# # List all models.
-models = client.models.list()
-print(models.data, "\n")
-
-# Note: not all arguments are currently supported and will be ignored by the backend.
-chat_completion = client.chat.completions.create(
- model=args.model_name,
- ... | Can we remove parameters here, and set it via environment variables OPENAI_BASE_URL and OPENAI_API_KEY by users as described in readme? |
llm-on-ray | github_2023 | python | 117 | intel | carsonwang | @@ -58,4 +58,8 @@
temperature=args.temperature,
top_p=args.top_p,
)
-print(chat_completion)
+if args.streaming_response:
+ for chunk in chat_completion:
+ print(chunk) | Can we use the openAI example that previous didn't work?
```
for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
```
|
llm-on-ray | github_2023 | others | 111 | intel | carsonwang | @@ -29,8 +29,8 @@ COPY ./MANIFEST.in .
RUN mkdir ./finetune && mkdir ./inference
-RUN --mount=type=cache,target=/root/.cache/pip pip install -e .[cpu,deepspeed] -f https://developer.intel.com/ipex-whl-stable-cpu \
- -f https://download.pytorch.org/whl/torch_stable.html
+RUN --mount=type=cache,target=/root/.cach... | Why some use "--index-url --extra-index-url", some use "--extra-index-url --extra-index-url"? Is there any difference? But let's still better to use the same format. |
llm-on-ray | github_2023 | python | 103 | intel | carsonwang | @@ -155,10 +155,10 @@ def train(self):
max_train_step = self.config.get("max_train_step")
max_eval_step = self.config.get("max_eval_step")
for idx in range(self.starting_epoch, num_train_epochs, 1):
- logger.info(f"start train epoch {idx}")
self.model.train()
... | nit: start train -> Start training |
llm-on-ray | github_2023 | python | 103 | intel | carsonwang | @@ -63,12 +63,14 @@ def get_accelerate_environment_variable(mode: str, config: Union[Dict[str, Any],
return mode_env_vars[mode]
-def convert_dtype(dtype: str) -> torch.dtype:
- supported_dtypes = {"fp16": torch.float16, "bf16": torch.bfloat16, "fp32": torch.float32}
- if dtype in supported_dtypes:
- ... | Have you tested with setting it to "no" and does None work? Otherwise should we use fp32 if mixed_precision is "no" ? |
llm-on-ray | github_2023 | python | 103 | intel | carsonwang | @@ -73,6 +73,13 @@ def check_accelerate_mode(cls, v: str):
raise ValueError(f"accelerate_mode must be one of {modes}")
return v
+ @validator("mixed_precision")
+ def check_mixed_precision(cls, v: str):
+ supported_precisions = ["no", "fp16", "bf16", "fp32"]
+ if v not in supp... | nit: on -> one |
llm-on-ray | github_2023 | python | 103 | intel | carsonwang | @@ -73,6 +73,13 @@ def check_accelerate_mode(cls, v: str):
raise ValueError(f"accelerate_mode must be one of {modes}")
return v
+ @validator("mixed_precision")
+ def check_mixed_precision(cls, v: str):
+ supported_precisions = ["no", "fp16", "bf16", "fp32"] | Please also update finetune_parameters.md to remove fp8. |
llm-on-ray | github_2023 | others | 103 | intel | minmingzhu | @@ -3,6 +3,7 @@ General:
gpt_base_model: true
output_dir: /tmp/llm-ray/output
checkpoint_dir: /tmp/llm-ray/checkpoint
+ tracking_dir: /tmp/llm-ray/tracking | There are 9 files in the models directory. Do bloom-560m.yaml, finetune_config_template.yaml, gpt2.yaml, llama-7b.yaml and opt-125m.yaml also need to be modified? |
llm-on-ray | github_2023 | others | 39 | intel | KepingYan | @@ -0,0 +1,23 @@
+port: 8000
+name: starcoder
+route_prefix: /starcoder
+precision: 'bf16' | This attribute should be removed. |
llm-on-ray | github_2023 | others | 39 | intel | KepingYan | @@ -0,0 +1,22 @@
+port: 8000
+name: starcoder
+route_prefix: /starcoder
+cpus_per_worker: 24
+gpus_per_worker: 0
+deepspeed: false
+workers_per_group: 2
+ipex:
+ enabled: false
+ precision: bf16
+device: "cpu"
+model_description:
+ model_id_or_path: bigcode/starcoder
+ tokenizer_name_or_path: bigcode/starcoder
+ ... | `use_auth_token` cannot be written directly in config yaml, it needs to be set in CI file. @jiafuzha please help confirm this. |
llm-on-ray | github_2023 | python | 101 | intel | harborn | @@ -134,9 +134,11 @@ def train_func(config: Dict[str, Any]):
model = common.model.Model.registory.get("HuggingFaceModelForCausalLM")()(
config={
"name": base_model,
- "dtype": convert_dtype(config["Training"]["mixed_precision"]),
+ "dtype": convert_dtype(config["Training... | default is bf16? |
llm-on-ray | github_2023 | others | 101 | intel | harborn | @@ -3,6 +3,7 @@ General:
gpt_base_model: true
output_dir: /tmp/llm-ray/output
checkpoint_dir: /tmp/llm-ray/checkpoint
+ logger_name: tensorboard # only support tensorboard as tracker | name as `log_with` or `tracking_with` ? |
llm-on-ray | github_2023 | others | 75 | intel | carsonwang | @@ -0,0 +1,26 @@
+# Inference with Intel Habana Gaudi | can you please update the existing setup.md and serve.md in /docs instead of creating this new document? |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -238,13 +238,16 @@ def streaming_generate(self, prompt, streamer, **config):
for worker in self.prediction_workers[1:]:
worker.streaming_generate.remote(inputs_ref, self._create_dummy_streamer(), **config)
- def generate(self, prompt, **config):
+ def generate(self, prompt, return_shape... | The generate interface is an override of Predictor interface. We should have consistency maintained across interfaces.
I don't' think it's a good idea to change the interface just for the return value. |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -28,10 +28,13 @@ def __init__(self, infer_conf: InferenceConfig) -> None:
for stop_word in stop_words
]
self.stopping_criteria = StoppingCriteriaList([StoppingCriteriaSub(stops=stop_words_ids)])
+ self.input_length = None
def tokenize_inputs(self, text):
input_to... | better to get input length first before send them to the device? |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -26,8 +26,9 @@
from inference.inference_config import InferenceConfig
from typing import Union, Dict, Any
from starlette.responses import StreamingResponse, JSONResponse
+from fastapi import HTTPException
from inference.api_openai_backend.openai_protocol import ModelResponse
-from utils import get_input_format
+... | should remove inference. here? |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -64,20 +64,24 @@
}
proxies = {"http": None, "https": None}
-response = s.post(url, json=body, proxies=proxies) # type: ignore
+response = s.post(url, json=body, proxies=proxies, stream=args.streaming_response) # type: ignore
for chunk in response.iter_lines(decode_unicode=True):
- if chunk is not None:
- ... | ```suggestion
print()
``` |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -75,8 +66,8 @@ async def stream(self, model: str, prompt: Prompt, request_id: str):
prompt=prompt,
request_id=request_id,
async_iterator=deploy_handle.options(stream=True)
- .stream_response.options(stream=True, use_new_handle_api=True)
- .remote(prompt_co... | need indent the two lines |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -145,33 +146,71 @@ async def __call__(self, http_request: Request) -> Union[StreamingResponse, JSON
self.consume_streamer_async(streamer), status_code=200, media_type="text/plain"
)
- async def stream_response(self, prompt, config):
+ async def openai_call(self, prompt, config, ... | should merge this into above else logic |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -145,33 +146,71 @@ async def __call__(self, http_request: Request) -> Union[StreamingResponse, JSON
self.consume_streamer_async(streamer), status_code=200, media_type="text/plain"
)
- async def stream_response(self, prompt, config):
+ async def openai_call(self, prompt, config, ... | I think you can use generate_result.input_length or generate_result.generate_length directly
or use generate_length/generate_result, don't mix both. |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -145,33 +146,71 @@ async def __call__(self, http_request: Request) -> Union[StreamingResponse, JSON
self.consume_streamer_async(streamer), status_code=200, media_type="text/plain"
)
- async def stream_response(self, prompt, config):
+ async def openai_call(self, prompt, config, ... |
```suggestion
400, "Multiple prompts are not supported when using openai compatible api."
``` |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -145,33 +146,71 @@ async def __call__(self, http_request: Request) -> Union[StreamingResponse, JSON
self.consume_streamer_async(streamer), status_code=200, media_type="text/plain"
)
- async def stream_response(self, prompt, config):
+ async def openai_call(self, prompt, config, ... | Please capital the initial letter.
```suggestion
yield HTTPException(400, "Invalid prompt format.")
``` |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -103,7 +104,7 @@ def get_input_format(input: Union[List[str], List[dict]]):
for item in input:
if isinstance(item, str):
chat_format = False
- elif isinstance(item, dict):
+ elif isinstance(item, dict) or isinstance(item, ChatMessage): | need to add ChatMessage to the input: Union[xxx]
and you can consider break from the loop without checking all items |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -25,22 +25,39 @@ def __init__(self, infer_conf: InferenceConfig):
self.engine = AsyncLLMEngine.from_engine_args(args)
+ def check_config(self, **config): |
```suggestion
def update_vllm_config(self, **config):
``` |
llm-on-ray | github_2023 | python | 86 | intel | xwu99 | @@ -145,33 +146,71 @@ async def __call__(self, http_request: Request) -> Union[StreamingResponse, JSON
self.consume_streamer_async(streamer), status_code=200, media_type="text/plain"
)
- async def stream_response(self, prompt, config):
+ async def openai_call(self, prompt, config, ... | Need special care for vllm here, since there are two exec paths of vllm.generate, one for str, another for List[str].
The one for List[str] may not be efficient now. I will submit another PR to consolidate vllm.generate(str) and vllm.generate(List[str]). For now we need to pass str to vllm for single prompt (for benchm... |
llm-on-ray | github_2023 | python | 99 | intel | carsonwang | @@ -170,12 +168,17 @@ def train(self):
if self.lr_scheduler is not None:
self.lr_scheduler.step()
self.optimizer.zero_grad()
- if step % log_step == 0:
+
+ if step % logging_steps == 0:
+ loss... | Instead of just output 0, 1, 2, etc, can we support output it like 0.1, 0.2, etc just like other workflows? |
llm-on-ray | github_2023 | python | 99 | intel | carsonwang | @@ -184,6 +187,10 @@ def train(self):
else total_steps,
}
)
+ self.accelerator.log( | Do we want to use Ray's report or accelerator.log to log the metrics. Currently the code above logs the metrics twice, right? If Ray's report already meets our requirements, I think we don't need to use accelerator.log to log again? |
llm-on-ray | github_2023 | others | 99 | intel | carsonwang | @@ -10,9 +10,11 @@ The following are the parameters supported in the finetuning workflow.
|gpt_base_model|True|This parameter is for [Transformers#22482](https://github.com/huggingface/transformers/issues/22482). It needs to be set to True when the pretrained model is realted to gpt, otherwise it is False.|
|output_d... | Can we directly use the output_dir + "tracking" as the directory and not add this new parameter? |
llm-on-ray | github_2023 | python | 99 | intel | carsonwang | @@ -62,6 +63,14 @@ def get_accelerate_environment_variable(mode: str, config: Union[Dict[str, Any],
return mode_env_vars[mode]
+def convert_dtype(dtype: str) -> torch.dtype:
+ supported_dtypes = {"fp16": torch.float16, "bf16": torch.bfloat16, "fp32": torch.float32} | You passed mixed_precision as the parameter, its value could be "no", "fp16", "bf16" or "fp8". But "no" and "fp8" are not properly handled here. |
llm-on-ray | github_2023 | python | 99 | intel | carsonwang | @@ -62,6 +63,14 @@ def get_accelerate_environment_variable(mode: str, config: Union[Dict[str, Any],
return mode_env_vars[mode]
+def convert_dtype(dtype: str) -> torch.dtype:
+ supported_dtypes = {"fp16": torch.float16, "bf16": torch.bfloat16, "fp32": torch.float32}
+ if dtype in supported_dtypes:
+ ... | can you add the check in finetune_config.py instead of here? |
llm-on-ray | github_2023 | python | 99 | intel | carsonwang | @@ -217,14 +245,21 @@ def main(external_config=None):
"FI_PROVIDER": "tcp",
}
}
-
accelerate_env_vars = get_accelerate_environment_variable(accelerate_mode, config)
runtime_env["env_vars"].update(accelerate_env_vars)
if config["General"]["gpt_base_mode... | Why do we need this change and can we avoid this? If we start Ray first, then execute the finetune command, do we still need this change and does this change still work? |
llm-on-ray | github_2023 | python | 99 | intel | carsonwang | @@ -54,6 +56,8 @@ class Training(BaseModel):
resources_per_worker: RayResourceConfig
accelerate_mode: str
mixed_precision: str = "no"
+ gradient_accumulation_steps: int | Can you set the default value 1 here? |
llm-on-ray | github_2023 | others | 99 | intel | carsonwang | @@ -28,3 +30,5 @@ Training:
resources_per_worker:
CPU: 32
accelerate_mode: CPU_DDP
+ gradient_accumulation_steps: 2 | The default value is 1 in our document. can you please set to 1 here? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.