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
79
intel
xwu99
@@ -2,8 +2,14 @@ LLM-on-Ray introduces a Web UI, allowing users to easily finetune and deploy LLMs through a user-friendly interface. Additionally, the UI includes a chatbot application, enabling users to immediately test and refine the models. -## Setup -Please follow [setup.md](setup.md) to setup the environment...
```suggestion After activating the environment installed from the previous step, please run the following script to install environment for ui. ```
llm-on-ray
github_2023
others
79
intel
xwu99
@@ -2,8 +2,14 @@ LLM-on-Ray introduces a Web UI, allowing users to easily finetune and deploy LLMs through a user-friendly interface. Additionally, the UI includes a chatbot application, enabling users to immediately test and refine the models. -## Setup -Please follow [setup.md](setup.md) to setup the environment...
Need to rephrase the following: ``` # Get urls from the log # Running on local URL: http://0.0.0.0:8080 # Running on public URL: https://180cd5f7c31a1cfd3c.gradio.live ``` Get URL from the command line output (E.g. `http://0.0.0.0:8080` for local network and `https://180cd5f7c31a1cfd3c.gradio.live` for public...
llm-on-ray
github_2023
python
79
intel
xwu99
@@ -19,20 +19,23 @@ import os import sys -sys.path.append(os.path.join(os.path.dirname(__file__), "..")) -from inference.inference_config import all_models, ModelDescription, Prompt -from inference.inference_config import InferenceConfig as FinetunedConfig -from inference.chat_process import ChatModelGptJ, ChatMode...
insert a blank line
llm-on-ray
github_2023
python
79
intel
xwu99
@@ -837,7 +830,7 @@ def _init_ui(self): base_models_list.append("specify other models") base_model_dropdown = gr.Dropdown( base_models_list, - value=base_models_list[2], + value=base_models_list[4],
add comment for using constant, what is the value you are specifying here. Same below
llm-on-ray
github_2023
python
89
intel
harborn
@@ -137,14 +139,25 @@ def prepare(self, model, tokenizer, dataset, optimizer, accelerator): # self.model, self.optimizer, self.lr_scheduler, ..., are prepared with 2 steps # because it is recommended way to prepare model and optimizer while using FSDP. # https://huggingface.co/docs/accelerate...
`if accelerate_mode is "GPU_DEEPSPEED":`
llm-on-ray
github_2023
python
89
intel
harborn
@@ -137,14 +139,25 @@ def prepare(self, model, tokenizer, dataset, optimizer, accelerator): # self.model, self.optimizer, self.lr_scheduler, ..., are prepared with 2 steps # because it is recommended way to prepare model and optimizer while using FSDP. # https://huggingface.co/docs/accelerate...
why need DummyOptim ?
llm-on-ray
github_2023
python
89
intel
harborn
@@ -14,17 +14,29 @@ from pydantic_yaml import parse_yaml_raw_as -from accelerate import FullyShardedDataParallelPlugin -from torch.distributed.fsdp.fully_sharded_data_parallel import ( - FullOptimStateDictConfig, - FullStateDictConfig, -) +from accelerate import FullyShardedDataParallelPlugin, DeepSpeedPlugi...
can we implement a function to generate deepspeed config?
llm-on-ray
github_2023
python
89
intel
harborn
@@ -77,14 +95,18 @@ def train_func(config: Dict[str, Any]): offload_to_cpu=False, rank0_only=False ), ) + accelerator = accelerate.Accelerator(gradient_accumulation_steps=gradient_accumulation_steps, + fsdp_plugin=fsdp_plugin) + ...
no need fsdp_plugin here, just: `accelerator = accelerate.Accelerator(gradient_accumulation_steps=gradient_accumulation_steps)`
llm-on-ray
github_2023
python
89
intel
harborn
@@ -57,14 +57,14 @@ class Training(BaseModel): @validator("device") def check_device(cls, v: str): - devices = ["CPU", "GPU"] + devices = ["CPU", "GPU", "XPU"]
why add `XPU` here?
llm-on-ray
github_2023
others
89
intel
harborn
@@ -53,6 +53,7 @@ gpu = [ "intel_extension_for_pytorch==2.1.10+xpu", "oneccl_bind_pt==2.1.100+xpu", "dpctl==0.15.0"
miss a ','
llm-on-ray
github_2023
python
89
intel
harborn
@@ -135,14 +137,25 @@ def prepare(self, model, tokenizer, dataset, optimizer, accelerator): # self.model, self.optimizer, self.lr_scheduler, ..., are prepared with 2 steps # because it is recommended way to prepare model and optimizer while using FSDP. # https://huggingface.co/docs/accelerate...
scheduler name is configurable?
llm-on-ray
github_2023
python
80
intel
carsonwang
@@ -41,20 +41,49 @@ args = parser.parse_args() -# List all models. -models = openai.Model.list() -print(models) - -# Note: not all arguments are currently supported and will be ignored by the backend. -chat_completion = openai.ChatCompletion.create( - model=args.model_name, - messages=[ - {"role": "as...
Is it possible to remove this limit?
llm-on-ray
github_2023
python
80
intel
carsonwang
@@ -41,20 +41,49 @@ args = parser.parse_args() -# List all models. -models = openai.Model.list() -print(models) - -# Note: not all arguments are currently supported and will be ignored by the backend. -chat_completion = openai.ChatCompletion.create( - model=args.model_name, - messages=[ - {"role": "as...
can we just limit openAI sdk version to >= 1.0 and always use this method? We don't need to limit the version to < 1.9 if possible.
llm-on-ray
github_2023
python
88
intel
KepingYan
@@ -222,7 +231,6 @@ def train(self): self.save(checkpoint, idx) self.accelerator.wait_for_everyone() - output = self.config.get("output", "./output") if output is not None:
If L225 is deleted here, where is the `output` obtained?
llm-on-ray
github_2023
python
88
intel
KepingYan
@@ -108,7 +117,9 @@ def train_func(config: Dict[str, Any]): model = common.model.Model.registory.get("HuggingFaceModelForCausalLM")()( config={ "name": config["General"]["base_model"], + "dtype": convert_dtype(config["Training"]["mixed_precision"]),
same here.
llm-on-ray
github_2023
python
88
intel
KepingYan
@@ -108,7 +117,9 @@ def train_func(config: Dict[str, Any]): model = common.model.Model.registory.get("HuggingFaceModelForCausalLM")()( config={ "name": config["General"]["base_model"], + "dtype": convert_dtype(config["Training"]["mixed_precision"]), "config": config["G...
same here.
llm-on-ray
github_2023
python
88
intel
KepingYan
@@ -127,7 +138,7 @@ def train_func(config: Dict[str, Any]): config={ "num_train_epochs": config["Training"]["epochs"], "max_train_step": config["Training"].get("max_train_steps", None), - "log_step": 1, + "logging_steps": config["Training"]["logging_steps"],
Please add a default value like `config["Training"].get("logging_steps", 1)` since UI doesn't use pydantic class yet.
llm-on-ray
github_2023
python
88
intel
KepingYan
@@ -217,14 +228,16 @@ def main(external_config=None): "FI_PROVIDER": "tcp", } } - + num_cpus = ( + resources_per_worker["CPU"] * num_training_workers + 1 + ) # additional 1 for head worker accelerate_env_vars = get_accelerate_environment_variable...
Why do we need to set cpu parameters here?
llm-on-ray
github_2023
python
88
intel
KepingYan
@@ -153,29 +151,37 @@ def prepare(self, model, tokenizer, dataset, optimizer, accelerator): def train(self): num_train_epochs = self.config.get("num_train_epochs", 1) checkpoint = self.config.get("checkpoint") - log_step = self.config.get("log_step", 1) + logging_steps = self.config...
Please check if this line is needed, because we've set accumulation steps by https://github.com/intel/llm-on-ray/blob/fc06debac38f40460738b08171cd9f1e6d98bc1e/finetune/finetune.py#L82-L84 and also use `self.accelerator.backward(loss)`. I'm not sure if this is correct or if there's conflict between them.
llm-on-ray
github_2023
python
88
intel
KepingYan
@@ -54,6 +55,8 @@ class Training(BaseModel): resources_per_worker: RayResourceConfig accelerate_mode: str mixed_precision: str = "no" + gradient_accumulation_steps: int + logging_steps: int = 10
Please also add description in docs/finetune_parameters.md
llm-on-ray
github_2023
python
88
intel
KepingYan
@@ -153,29 +151,37 @@ def prepare(self, model, tokenizer, dataset, optimizer, accelerator): def train(self): num_train_epochs = self.config.get("num_train_epochs", 1) checkpoint = self.config.get("checkpoint") - log_step = self.config.get("log_step", 1) + logging_steps = self.config...
I don’t think the `writer` is needed, maybe ray.train.report is enough. After running `tensorboard --logdir .../ray_results/TorchTrainer_2024* --bind_all` we can see the parameters set in `report()`. @carsonwang please help confirm this.
llm-on-ray
github_2023
python
62
intel
xwu99
@@ -243,8 +243,8 @@ def generate(self, prompt, **config): inputs_ref = ray.put(input_ids) gen_tokens = ray.get( [worker.generate.remote(inputs_ref, **config) for worker in self.prediction_workers] - )[0]
[0] means the rank 0 output, I don't think you can remove this.
llm-on-ray
github_2023
others
42
intel
xwu99
@@ -0,0 +1,144 @@ +name: tests + +on: + workflow_call: + inputs: + ci_type: + type: string + default: 'pr' + runner_container_image: + type: string + default: '10.1.2.13:5000/llmray-build' + http_proxy: + type: string + default: 'http://proxy-chain.intel.com:...
remove line
llm-on-ray
github_2023
others
42
intel
xwu99
@@ -0,0 +1,144 @@ +name: tests + +on: + workflow_call: + inputs: + ci_type: + type: string + default: 'pr' + runner_container_image: + type: string + default: '10.1.2.13:5000/llmray-build' + http_proxy: + type: string + default: 'http://proxy-chain.intel.com:...
```suggestion - name: Start tests ```
llm-on-ray
github_2023
others
42
intel
xwu99
@@ -0,0 +1,144 @@ +name: tests + +on: + workflow_call: + inputs: + ci_type: + type: string + default: 'pr' + runner_container_image: + type: string + default: '10.1.2.13:5000/llmray-build' + http_proxy: + type: string + default: 'http://proxy-chain.intel.com:...
Remove this if there is no use
llm-on-ray
github_2023
others
42
intel
xwu99
@@ -0,0 +1,144 @@ +name: tests + +on: + workflow_call: + inputs:
Remove inputs as tests are running on github CI
llm-on-ray
github_2023
python
40
intel
KepingYan
@@ -130,7 +131,7 @@ def prepare(self, model, tokenizer, dataset, optimizer, accelerator): def train(self): num_train_epochs = self.config.get("num_train_epochs", 1) checkpoint = self.config.get("checkpoint") - log_step = self.config.get("log_step", 1) + logging_steps = self.config.g...
Please add default value `1` because of ui.
llm-on-ray
github_2023
python
40
intel
KepingYan
@@ -147,12 +148,19 @@ def train(self): if self.lr_scheduler is not None: self.lr_scheduler.step() self.optimizer.zero_grad() - if step % log_step == 0: - logger.info(f"train epoch:[{idx}/{num_train_epochs}]\tste...
Would it be better to use `loss.item()` here?
llm-on-ray
github_2023
python
40
intel
KepingYan
@@ -147,12 +148,19 @@ def train(self): if self.lr_scheduler is not None: self.lr_scheduler.step() self.optimizer.zero_grad() - if step % log_step == 0: - logger.info(f"train epoch:[{idx}/{num_train_epochs}]\tste...
This line is for updating the progress bar on web ui, the key of this dict can't be modified because of https://github.com/intel/llm-on-ray/blob/f26343d14320f0be889f46c3d1703a743de82f57/ui/start_ui.py#L82-L85.
llm-on-ray
github_2023
python
59
intel
KepingYan
@@ -718,6 +740,52 @@ def set_custom_model(self, base_model_name): visible = True if base_model_name == "specify other models" else False return gr.Textbox.update(visible=visible), gr.Textbox.update(visible=visible) + def set_upload_box(self, upload_type): + if upload_type == "Youtube": + ...
Could you add a default value here for convenience of demo?
llm-on-ray
github_2023
python
59
intel
KepingYan
@@ -718,6 +740,52 @@ def set_custom_model(self, base_model_name): visible = True if base_model_name == "specify other models" else False return gr.Textbox.update(visible=visible), gr.Textbox.update(visible=visible) + def set_upload_box(self, upload_type): + if upload_type == "Youtube": + ...
Same here.
llm-on-ray
github_2023
python
59
intel
KepingYan
@@ -320,27 +323,52 @@ def bot_rag( def regenerate( self, db_dir, - web_urls, - data_pdfs, + upload_type, + input_type, + input_texts, + depth, + upload_files, embedding_model, splitter_chunk_size, cpus_per_worker, ):...
Please reconfirm here, I got an error when testing it. ```bash Traceback (most recent call last): File "/home/ykp/miniconda3/envs/llmonray/lib/python3.9/site-packages/gradio/routes.py", line 439, in run_predict output = await app.get_blocks().process_api( File "/home/ykp/miniconda3/envs/llmonray/lib/python...
llm-on-ray
github_2023
python
59
intel
KepingYan
@@ -382,7 +402,9 @@ def regenerate( ] ) pipeline.add_operations(ops) - pipeline.execute() + ds = pipeline.execute() + for row in ds.iter_rows(): + print(row)
Please remove this unnecessary log.
llm-on-ray
github_2023
others
20
intel
KepingYan
@@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Create conda env +# conda create -n vllm-cpu python=3.10 +# conda activate vllm-cpu
Could these unnecessary comments be removed?
llm-on-ray
github_2023
python
20
intel
KepingYan
@@ -81,16 +86,27 @@ async def __call__(self, http_request: Request) -> Union[StreamingResponse, str] prompts.extend(text) else: prompts.append(text) + if not streaming_response: - return self.predictor.generate(prompts, **config) + if self.use_vllm: ...
Would it be better to add some warnings here?
llm-on-ray
github_2023
python
20
intel
KepingYan
@@ -0,0 +1,57 @@ +from typing import AsyncGenerator, List, Union +from predictor import Predictor +from inference_config import InferenceConfig +from transformers import TextIteratorStreamer +from vllm.engine.arg_utils import AsyncEngineArgs +from vllm.engine.async_llm_engine import AsyncLLMEngine +from vllm.sampling_p...
Could we add this method to inference/util.py? I will also change the relevant methods in api_openai_backend to be called from here. https://github.com/intel/llm-on-ray/blob/87ffd4f92336e49fcb54882ff331b9cb6aa6ef79/inference/api_openai_backend/router_app.py#L272 https://github.com/intel/llm-on-ray/blob/87ffd4f92336...
llm-on-ray
github_2023
python
20
intel
carsonwang
@@ -94,23 +100,37 @@ async def __call__(self, http_request: Request) -> Union[StreamingResponse, str] prompts.extend(text) else: prompts.append(text) + if not streaming_response: - return self.predictor.generate(prompts, **config) + if self.use_vllm:...
What causes the limitation and what needs to be done to address it?
llm-on-ray
github_2023
python
20
intel
carsonwang
@@ -32,7 +32,18 @@ class Ipex(BaseModel): @validator("precision") def _check_precision(cls, v: str): if v: - assert v in [IPEX_PRECISION_BF16, IPEX_PRECISION_FP32] + assert v in [PRECISION_BF16, PRECISION_FP32] + return v + + +class Vllm(BaseModel): + enabled: bool = F...
What about other precision types supported in vLLM? Can we also add them like FP16, etc?
llm-on-ray
github_2023
others
20
intel
jiafuzha
@@ -106,12 +111,16 @@ jobs: TARGET=${{steps.target.outputs.target}} if [[ ${{ matrix.model }} == "mpt-7b-bigdl" ]]; then docker exec "${TARGET}" bash -c "python inference/serve.py --config_file inference/models/bigdl/mpt-7b-bigdl.yaml --simple" + elif [[ ${{ matrix.model }} =...
If you change llama-2-7b-chat-hf-vllm-fp32.yaml to llama-2-7b-chat-hf-vllm.yaml, you don't need this condition branch. It's better to keep file name and model name same.
llm-on-ray
github_2023
others
20
intel
jiafuzha
@@ -143,16 +152,16 @@ jobs: docker exec "${TARGET}" bash -c "python examples/inference/api_server_simple/query_single.py --model_endpoint http://127.0.0.1:8000/${{ matrix.model }}" docker exec "${TARGET}" bash -c "python examples/inference/api_server_simple/query_single.py --model_endpoint htt...
restful API not supported yet?
llm-on-ray
github_2023
others
20
intel
jiafuzha
@@ -0,0 +1,41 @@ +# Setting up vLLM For Intel CPU + +__NOTICE: The support for vLLM is experimental and subject to change.__ + +## Install vLLM for Intel CPU + +vLLM for CPU currently only supports Intel® 4th Gen Xeon® Scalable Performance processor (formerly codenamed Sapphire Rapids). Please run the following script ...
But we can run it in CI with ICX.
llm-on-ray
github_2023
others
20
intel
jiafuzha
@@ -69,6 +69,10 @@ bigdl-cpu = [ "bigdl-llm[all]" ] +vllm = [ + "vllm>=0.2.6" +] +
It seems that you install vllm in a script, not by pip extra.
llm-on-ray
github_2023
python
20
intel
jiafuzha
@@ -0,0 +1,69 @@ +import asyncio +from typing import AsyncGenerator, List, Union +from predictor import Predictor +from inference.inference_config import InferenceConfig, PRECISION_BF16 +from vllm.engine.arg_utils import AsyncEngineArgs +from vllm.engine.async_llm_engine import AsyncLLMEngine +from vllm.sampling_params...
Do you have CI case for multiple prompts?
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,21 @@ +#!/bin/bash +export https_proxy=10.24.221.149:911 +export http_proxy=10.24.221.149:911 +work_path=$(dirname $0) +cd $(dirname $0) + +# This script runs pytest to execute all tests in the test_utils.py file. + +# Exit immediately if a command exits with a non-zero status. +set -e + +# Optional: activat...
```suggestion pytest -vs ./inference ```
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,8 @@ +pytest==7.4.4 +torch==2.1.0 +transformers==4.35.2 +# ray==3.0.0.dev0
remove unnecessary comments
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,44 @@ +name: tests + +on: + workflow_call + +jobs: + build: + + runs-on: ubuntu-latest + + + defaults: + run: + shell: bash + + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + # This is the version of the action for setting up Python,...
```suggestion - name: Start tests ```
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,44 @@ +name: tests + +on: + workflow_call + +jobs: + build: + + runs-on: ubuntu-latest + + + defaults: + run: + shell: bash + + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + # This is the version of the action for setting up Python,...
Remove as no use
llm-on-ray
github_2023
python
31
intel
xwu99
@@ -0,0 +1,62 @@ +import pytest +import torch + + +from utils import get_deployment_actor_options, StoppingCriteriaSub, max_input_len, get_torch_dtype, is_cpu_without_ipex +from inference_config import InferenceConfig, DEVICE_CPU +# from inference_config import InferenceConfig, DEVICE_CPU
remove not useful comments.
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,15 @@ +#!/bin/bash +export https_proxy=10.24.221.149:911
should remove internal proxy
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,15 @@ +#!/bin/bash +export https_proxy=10.24.221.149:911 +export http_proxy=10.24.221.149:911 +work_path=$(dirname $0)
work_path is not used
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,42 @@ +name: tests + +on: + workflow_call + +jobs: + build: + + runs-on: ubuntu-latest + + + defaults: + run: + shell: bash + + + steps:
Please separate each step with blank line
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,42 @@ +name: tests + +on: + workflow_call + +jobs: + build: + + runs-on: ubuntu-latest + + + defaults: + run: + shell: bash + + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + # This is the version of the action for setting up Python,...
remove redundant tailing blank lines, only one is ok.
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,42 @@ +name: tests + +on: + workflow_call + +jobs: + build: + + runs-on: ubuntu-latest + +
use one blank line is ok
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,15 @@ +#!/bin/bash +export https_proxy=10.24.221.149:911 +export http_proxy=10.24.221.149:911 +work_path=$(dirname $0) +cd $(dirname $0) + +# This script runs pytest to execute all tests in the test_utils.py file. + +# Exit immediately if a command exits with a non-zero status. +set -e + +# Run pytest with t...
```suggestion pytest -vs ./inference ```
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,12 @@ +#!/bin/bash +cd $(dirname $0) + +# This script runs pytest to execute all tests in the test_utils.py file.
should remove this
llm-on-ray
github_2023
others
31
intel
xwu99
@@ -0,0 +1,12 @@ +#!/bin/bash +cd $(dirname $0) + +# This script runs pytest to execute all tests in the test_utils.py file. + +# Exit immediately if a command exits with a non-zero status. +set -e + +# Run pytest with the test file
should remove this, just need to add necessary comment
llm-on-ray
github_2023
others
31
intel
Deegue
@@ -14,15 +14,21 @@ on: - 'rlhf/**' - 'tools/**' - 'pyproject.toml' + - 'tests/**' jobs: + call-lint: uses: ./.github/workflows/workflow_lint.yml + + call-tests: + needs: call-lint + uses: ./.github/workflows/workflow_tests.yml call-inference: needs: call-lint ...
We should leave a blank line at the end of the file.
llm-on-ray
github_2023
others
31
intel
Deegue
@@ -0,0 +1,35 @@ +name: tests + +on: + workflow_call + +jobs: + build: + + runs-on: ubuntu-latest + + defaults: + run: + shell: bash + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + ...
same above
llm-on-ray
github_2023
others
31
intel
Deegue
@@ -0,0 +1,2 @@ +[pytest] +pythonpath = ./ ../inference ./ ../
same above
llm-on-ray
github_2023
others
31
intel
Deegue
@@ -0,0 +1,12 @@ +#!/bin/bash +cd $(dirname $0) + +# This script runs pytest to execute all tests in the test_utils.py file. + +# Exit immediately if a command exits with a non-zero status. +set -e + +# Run pytest with the test file +pytest -vs ./inference + +echo "Pytest finished running tests."
same above
llm-on-ray
github_2023
python
31
intel
Deegue
@@ -0,0 +1,59 @@ +import pytest +import torch + +from utils import get_deployment_actor_options, StoppingCriteriaSub, max_input_len, get_torch_dtype, is_cpu_without_ipex +from inference_config import InferenceConfig, DEVICE_CPU + +# Mock the InferenceConfig for testing +@pytest.fixture +def mock_infer_conf():
Can we make it configurable? so that ipex and deepspeed can sometimes be enabled.
llm-on-ray
github_2023
python
31
intel
Deegue
@@ -0,0 +1,59 @@ +import pytest +import torch + +from utils import get_deployment_actor_options, StoppingCriteriaSub, max_input_len, get_torch_dtype, is_cpu_without_ipex +from inference_config import InferenceConfig, DEVICE_CPU + +# Mock the InferenceConfig for testing +@pytest.fixture +def mock_infer_conf(): + infe...
`assert stopping_criteria(input_ids, scores)` ?
llm-on-ray
github_2023
python
31
intel
Deegue
@@ -0,0 +1,59 @@ +import pytest +import torch + +from utils import get_deployment_actor_options, StoppingCriteriaSub, max_input_len, get_torch_dtype, is_cpu_without_ipex +from inference_config import InferenceConfig, DEVICE_CPU + +# Mock the InferenceConfig for testing +@pytest.fixture +def mock_infer_conf(): + infe...
`assert is_cpu_without_ipex(mock_infer_conf)` ?
llm-on-ray
github_2023
others
49
intel
xwu99
@@ -107,7 +107,7 @@ jobs: if [[ ${{ matrix.model }} == "mpt-7b-bigdl" ]]; then docker exec "${TARGET}" bash -c "python inference/serve.py --config_file inference/models/bigdl/mpt-7b-bigdl.yaml --serve_simple" else - docker exec "${TARGET}" bash -c "MODEL_TO_SERVE=\"${{ matr...
do you also think --serve_simple and --model_to_serve is too verbose since the command is already serve.py? Does it make sense to change to --simple and --model?
llm-on-ray
github_2023
python
49
intel
jiafuzha
@@ -60,8 +71,9 @@ def main(argv=None): import argparse parser = argparse.ArgumentParser(description="Model Serve Script", add_help=False) parser.add_argument("--config_file", type=str, help="inference configuration file in YAML. If specified, all other arguments are ignored") - parser.add_argument("--...
models_to_serve? since it could be multiple models.
llm-on-ray
github_2023
python
49
intel
jiafuzha
@@ -15,21 +15,31 @@ # import openai -import os +import argparse + +parser = argparse.ArgumentParser(description="Example script to query with openai sdk", add_help=True) +parser.add_argument("--request_model", default="gpt2", type=str, help="The name of model to request") +parser.add_argument("--streaming_response"...
why changed to request_model? I think model_name is pretty good.
llm-on-ray
github_2023
python
49
intel
jiafuzha
@@ -14,26 +14,33 @@ # limitations under the License. # -import os import json import requests +import argparse -s = requests.Session() +parser = argparse.ArgumentParser(description="Example script to query with http requests", add_help=True) +parser.add_argument("--request_api_base", default="http://localhost:8...
top_k is not supported?
llm-on-ray
github_2023
others
49
intel
xwu99
@@ -27,6 +27,19 @@ device: HPU LLM-on-Ray also supports serving with [Deepspeed](serve_deepspeed.md) for AutoTP and [BigDL-LLM](serve_bigdl.md) for INT4/FP4/INT8/FP8 to reduce latency. You can follow the corresponding documents to enable them. ## Serving +We support three methods to specify the models to be served,...
```suggestion python inference/serve.py --model_id_or_path gpt2 [--tokenizer_id_or_path gpt2 --port 8000 --route_prefix ...] ```
llm-on-ray
github_2023
others
44
intel
carsonwang
@@ -67,6 +63,10 @@ docker run -it --runtime=habana -v ./llm-on-ray:/root/llm-ray --name="llm-ray-ha ``` #### 3. Launch Ray cluster +If DeepSpeed is enabled, we should dynamic link oneCCL and Intel MPI libraries:
This is not only needed when Deepspeed is enabled. When you do distributed finetuning, oneCCL is required.
llm-on-ray
github_2023
others
44
intel
carsonwang
@@ -43,8 +43,6 @@ Software requirement: Python 3.9 git clone https://github.com/intel/llm-on-ray.git cd llm-on-ray pip install .[cpu] -f https://developer.intel.com/ipex-whl-stable-cpu -f https://download.pytorch.org/whl/torch_stable.html -# Dynamic link oneCCL and Intel MPI libraries
I think we still need this command in the README file. @xwu99 do you mean move this command into a different section after `#### 1. Clone the repository and install dependencies. `? Please clarify.
llm-on-ray
github_2023
others
44
intel
xwu99
@@ -67,6 +63,10 @@ docker run -it --runtime=habana -v ./llm-on-ray:/root/llm-ray --name="llm-ray-ha ``` #### 3. Launch Ray cluster +If DeepSpeed is enabled or doing distributed finetuing, oneCCL and Intel MPI libraries should be dynamically linked:
```suggestion If DeepSpeed is enabled or doing distributed finetuing, oneCCL and Intel MPI libraries should be dynamically linked in every node before Ray starts: ```
llm-on-ray
github_2023
others
12
intel
jiafuzha
@@ -45,6 +45,8 @@ jobs: - { model: "gpt-j-6b"} - { model: "mistral-7b-v0.1"} - { model: "mpt-7b-bigdl"} + - { model: "CodeLlama-7b-hf"} + - { model: "falcon-7b"}
please review them before merging it since we've verified them successfully.
llm-on-ray
github_2023
others
34
intel
jiafuzha
@@ -0,0 +1,22 @@ +name: Lint + +on: + workflow_call: + inputs: + ci_type: + type: string + default: 'pr' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-ft
please make it unique. This value is for finetune. You can use "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-lint".
llm-on-ray
github_2023
others
34
intel
jiafuzha
@@ -16,6 +16,8 @@ on: - 'pyproject.toml' jobs: + call-lint:
Do we want to run following ci jobs only after lint check is passed? If yes, please add 'needs' in all following jobs.
llm-on-ray
github_2023
others
34
intel
jiafuzha
@@ -0,0 +1,24 @@ +#!/bin/bash +# Formats the files by running pre-commit hooks. + +while getopts 'ah' opt; do + case "$opt" in + a) + pip install -q pre-commit
we need to install pre-commit at each run?
llm-on-ray
github_2023
python
43
intel
xwu99
@@ -864,7 +864,7 @@ def _init_ui(self): self.gr_chat = gr_chat if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Start UI", add_help=False) + parser = argparse.ArgumentParser(description="Start UI", add_help=True)
@KepingYan could we think a better description for this command line help?
llm-on-ray
github_2023
python
43
intel
KepingYan
@@ -58,22 +58,22 @@ def get_deployed_models(args): def main(argv=None): # args import argparse - parser = argparse.ArgumentParser(description="Model Serve Script", add_help=False) - parser.add_argument("--config_file", type=str, help="inference configuration file in YAML. If specified, all other argume...
Please keep uppercase and lowercase consistent here
llm-on-ray
github_2023
python
29
intel
carsonwang
@@ -20,10 +20,9 @@ from torch.distributed.fsdp.fully_sharded_data_parallel import FullOptimStateDictConfig, FullStateDictConfig import sys -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) - +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
`append` no longer works?
llm-on-ray
github_2023
python
29
intel
carsonwang
@@ -164,9 +163,10 @@ def get_finetune_config(): def main(external_config = None): - config = get_finetune_config() - if external_config is not None: - config.merge(external_config) + if not external_config: + config = get_finetune_config() + else: + config = external_config
Just curious, when do we use external_config? It seems it will never be used.
llm-on-ray
github_2023
others
30
intel
carsonwang
@@ -1,6 +1,7 @@ General: base_model: EleutherAI/gpt-j-6b gpt_base_model: true + log_step: 10
- This change is irrelevant to the purpose of this PR. Can you submit a sperate PR so we make each PR clear and have minimal changes? - Don't forget to update doc for the new parameter. - It seems better to put this in "Training" section. I plan to add another parameter `report_to` that people can configure for exam...
llm-on-ray
github_2023
others
30
intel
carsonwang
@@ -96,6 +97,10 @@ jobs: result['General']["gpt_base_model"] = True else: result['General']["gpt_base_model"] = False + if "${{ matrix.model }}" == "mistralai/Mistral-7B-v0.1": + result['General']['lora_config']['target_modules'] = ["q_p...
This should be added in `Run PEFT-LoRA Test` instead of this `Run Finetune Test`
llm-on-ray
github_2023
others
30
intel
carsonwang
@@ -43,6 +43,7 @@ jobs: include: - { model: "EleutherAI/gpt-j-6b"} - { model: "meta-llama/Llama-2-7b-chat-hf"} + - { model: "mistralai/Mistral-7B-v0.1"}
Let's keep it for now.
llm-on-ray
github_2023
others
23
intel
harborn
@@ -22,6 +22,7 @@ Training: learning_rate: 1.0e-05 lr_scheduler: linear weight_decay: 0.0 + mixed_precision: bf16
add a `log_step` option in General part? This option can be used to control number of training logs for `DefaultTrainer`
llm-on-ray
github_2023
others
10
intel
jiafuzha
@@ -27,26 +27,24 @@ An example dataset can be accessed at `examples/data/sample_finetune_data.jsonl ## Configure Finetuning Parameters -We provide an example configuration file ([CPU version](../finetune/finetune.conf), [GPU version](../examples/finetune/gpt_j_6b/finetune_intel_gpu.conf)) for finetuning LLMs. You ...
is 'docs/finetune_parameters.md' correct? I think it should be './finetune_parameters.md'
llm-on-ray
github_2023
others
10
intel
jiafuzha
@@ -1,39 +1,8 @@ # Reinforcement Learning by Human Feedback Workflow -## Supervised Fine-Tuning (SFT) Workflow +## Supervised Finetuning (SFT) Workflow -### 1. Prepare Dataset - -The standard data format should be as follows: - -```json -{ - "instruction": "Why can camels survive for long without water?", - ...
Do you mean get to 'finetune.md' for 'Prepare Dataset'? If yes, I think we can add an anchor in '1. Prepare Dataset', like '<a name="prepare.."></a> 1. Prepare Dataset', so that user can link it here. Otherwise, it may confuse user which parts to reference to.
llm-on-ray
github_2023
python
15
intel
jiafuzha
@@ -57,8 +57,10 @@ def recovery(self, config): self.starting_epoch = checkpoint_epoch["epoch"] + 1 logger.info(f"recovery to epoch {self.starting_epoch}") + except FileNotFoundError as e: + logger.info(e)
is it correct?
llm-on-ray
github_2023
python
15
intel
jiafuzha
@@ -108,6 +108,7 @@ def train_func(config: Dict[str, Any]): trainer = common.trainer.Trainer.registory.get("DefaultTrainer")(config = { "num_train_epochs": config["Training"]["epochs"], "max_train_step": config["Training"].get("max_train_steps", None), + "log_step": 1,
what's the default value? Will it cause too much log output?
neural-speed
github_2023
cpp
309
intel
JianpingChen066
@@ -34,7 +34,8 @@ struct raw_send_with_2_source_and_1_destination_func { offsets += offset; xetla_vector<uint64_t, SIMD> dsec = offsets + (uint64_t)a; - xetla_vector<dtype, SIMD> A_load_vec = xetla_load_global(a, offsets); + xetla_vector<dtype, SIMD> A_load_vec = + xetla_load_global<dtype, SIMD...
why now template argument can't be inferred from function arguments ?
neural-speed
github_2023
cpp
309
intel
JianpingChen066
@@ -233,78 +230,132 @@ constexpr __ESIMD_NS::atomic_op get_atomic_op(gpu::xetla::atomic_op ao) { } } // namespace detail -/// @addtogroup xetla_core_memory -/// @{ - -/// @brief Stateless scattered prefetch. -/// Prefetches elements located at specified address. -/// -/// Supported platforms: DG2, PVC +/// template...
any performance tests for the xetla instruction level modification ?
neural-speed
github_2023
cpp
305
intel
JianpingChen066
@@ -398,9 +398,8 @@ tile_load(tile_t& tile, payload_t& payload) { static constexpr gpu_arch arch_tag = payload_t::arch_tag; using load_store_attr = load_store_attr_t<msg_type::block_1d, arch_tag>; - static constexpr uint32_t max_load_vec_len = std::min(
I made another kind of fix for that, like diff --git a/include/subgroup/tile/impl/load_xe.hpp b/include/subgroup/tile/impl/load_xe.hpp index 0c9d32ca..32f1c791 100644 --- a/include/subgroup/tile/impl/load_xe.hpp +++ b/include/subgroup/tile/impl/load_xe.hpp @@ -22,6 +22,7 @@ #include <subgroup/tile/api.hpp> #in...
neural-speed
github_2023
cpp
273
intel
JianpingChen066
@@ -1011,32 +1014,33 @@ tile_store(tile_t& tile, payload_t& payload) { static constexpr gpu_arch arch_tag = payload_t::arch_tag; using load_store_attr = load_store_attr_t<msg_type::block_1d, arch_tag>; - static constexpr uint32_t max_store_vec_len = - load_store_attr::max_store_vec_len; + static constexp...
please also help to modify here for "64 *" to "max_store_vec_in_elems *"
neural-speed
github_2023
cpp
273
intel
JianpingChen066
@@ -403,28 +403,29 @@ tile_load(tile_t& tile, payload_t& payload) { static constexpr uint32_t load_len = tile_size_x / scale_factor; static constexpr gpu_arch arch_tag = payload_t::arch_tag; using load_store_attr = load_store_attr_t<msg_type::block_1d, arch_tag>; - static constexpr uint32_t max_load_vec_len =...
for block_1d, using mem_dtype = typename payload_t::mem_dtype; max_load_vec_in_elems = load_store_attr::max_load_vec_in_bytes / sizeof(mem_dtype); since scale_factor has been calculated in the payload, using mem_dtype = typename std::conditional< (bytes_per_row % sizeof(uint64_t) == 0) && ...
neural-speed
github_2023
cpp
261
intel
airMeng
@@ -73,9 +74,7 @@ struct compute_policy_int4_dequantize< static constexpr mma_engine mma_engine = mma_engine_; static constexpr gpu_arch arch_tag = arch_tag_; - static_assert( - !(mma_engine == mma_engine::xmx && arch_tag == gpu_arch::XeLpg), - "XeLpg does not support xmx"); + static_assert(!(arch_t...
```suggestion static_assert(arch_has_xmx<arch_tag>(), "XeLpg does not support xmx"); ```
neural-speed
github_2023
cpp
261
intel
airMeng
@@ -60,7 +60,8 @@ struct compute_policy_int4_dequantize< dequant_s_, mma_engine_, arch_tag_, - std::enable_if_t<(arch_tag_ <= gpu_arch::XeHpc)>> { + std::enable_if_t<( + arch_tag_ <= gpu_arch::XeHpc && mma_engine_ == mma_engine::xmx)>> {
```suggestion mma_engine_ == mma_engine::xmx)>> { ```
neural-speed
github_2023
cpp
261
intel
airMeng
@@ -89,14 +88,68 @@ struct compute_policy_int4_dequantize< static constexpr uint32_t block_size_y_a = 16; using mma_attr = mma_attr_t<arch_tag_, block_size_y_a>; - static constexpr uint32_t block_bytes_x_a = - (mma_engine == mma_engine::xmx) ? mma_attr::mma_k_in_bytes : 32; + static constexpr uint32_t bl...
@wanzizhu here MMA in XeTLA supports configured ```block_size_y_a```
neural-speed
github_2023
cpp
261
intel
airMeng
@@ -176,12 +190,20 @@ class gemm_t< // note: plane format, row-major // note: 4bit x 2, row-major - using matB_tile_desc_t = subgroup::tile_desc_t< - tile_size_x_b / pack_ratio, - tile_size_y_b, - block_size_x_b / pack_ratio, - block_size_y_b, - reg_layout::tiled>; + using matB_tile_d...
do we need to support row major too? there will be double size of templates expansion and slower compilation especially in IPEX.
neural-speed
github_2023
cpp
261
intel
airMeng
@@ -95,7 +95,7 @@ class gemm_universal_t< using dtype_c = typename mem_desc_c_t::dtype; using dtype_scale = typename mem_desc_scale_t::dtype; using dtype_zero_pt = typename mem_desc_zero_pt_t::dtype; - using matAcc_t = typename gemm_t::matAcc_t; + using matAcc_t = typename gemm_t::matC_t;
I think this is confusing
neural-speed
github_2023
cpp
261
intel
airMeng
@@ -24,6 +24,129 @@ namespace gpu::xetla::subgroup { /// @brief Is the tile mma operation functor, specialized for Xe and fpu engine. +template < + typename matDst_t_, + typename matSrc_t_, + typename matAcc_t_, + typename matB_t_, + typename matA_t_, + gpu_arch arch_tag_> +struct tile_fma_t { + ...
reduction along K dimensions should be the default behavior ```suggestion __XETLA_API static void mma(matAcc_t& matAcc, matDst_t_& matC) { ```
neural-speed
github_2023
cpp
261
intel
airMeng
@@ -24,6 +24,129 @@ namespace gpu::xetla::subgroup { /// @brief Is the tile mma operation functor, specialized for Xe and fpu engine. +template < + typename matDst_t_, + typename matSrc_t_, + typename matAcc_t_, + typename matB_t_, + typename matA_t_, + gpu_arch arch_tag_> +struct tile_fma_t { + ...
why different naming? ```suggestion __XETLA_API static void mma( ```
neural-speed
github_2023
cpp
261
intel
zhewang1-intc
@@ -89,14 +88,68 @@ struct compute_policy_int4_dequantize< static constexpr uint32_t block_size_y_a = 16; using mma_attr = mma_attr_t<arch_tag_, block_size_y_a>; - static constexpr uint32_t block_bytes_x_a = - (mma_engine == mma_engine::xmx) ? mma_attr::mma_k_in_bytes : 32; + static constexpr uint32_t bl...
looks like `arch_tag_ <= gpu_arch::XeHpc` is not necessaray.