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
python
204
intel
minmingzhu
@@ -193,92 +242,43 @@ def train_func(config: Dict[str, Any]): } ) - optimizer = common.optimizer.Optimizer.registory.get("DefaultOptimizer")()( - model, - config={ - "name": config["Training"]["optimizer"], - "config": {"lr": config["Training"]["learning_rate"]}, -...
transformers.Trainer how to distinguish FSDP and Deepspeed?
llm-on-ray
github_2023
python
204
intel
KepingYan
@@ -130,6 +121,52 @@ def get_accelerate_environment_variable(config: Dict[str, Any]) -> dict: return mode_env_vars[device][accelerate_mode] +def convert_to_training_args(cls, config): + device = config["Training"]["device"] + accelerate_mode = config["Training"]["accelerate_mode"] + checkpoint_dir = c...
Can you add the max_train_steps parameter, otherwise, the UI will not be able to demo finetuning task in a short time. https://github.com/intel/llm-on-ray/blob/b0a5840df2675bc797040e24c4ec4aa6043001cd/llm_on_ray/ui/start_ui.py#L631-L632 In addition, can other parameters of lr_scheduler such as num_warmup_steps be s...
llm-on-ray
github_2023
python
204
intel
KepingYan
@@ -339,27 +339,22 @@ def main(external_config=None): "FI_PROVIDER": "tcp", } } - accelerate_env_vars = get_accelerate_environment_variable(config) - runtime_env["env_vars"].update(accelerate_env_vars) + # accelerate_env_vars = get_accelerate_environment_varia...
Is get_accelerate_environment_variable no longer needed? Let us remove this function.
llm-on-ray
github_2023
python
204
intel
KepingYan
@@ -176,13 +173,22 @@ def group_texts(examples): desc=f"Grouping texts in chunks of {block_size}", ) + return tokenized_datasets + + def convert_dataset(self, tokenizer, dataset):
general_processer is just generating dataloader, it may be better to call it 'prepare' or 'prepare_dataloader'. And please align function names in other files such as pretrain modules'.
llm-on-ray
github_2023
python
204
intel
KepingYan
@@ -130,7 +130,7 @@ def prepare(self, model, tokenizer, dataset, optimizer, accelerator): f"model embedding size resize to {len(tokenizer)} because of tokenizer size" ) - train_dataloader, eval_dataloader = self.dataprocesser.prepare(tokenizer, dataset) + train_dataloader, ...
If we no longer use default_trainer, should this file be removed?
llm-on-ray
github_2023
python
204
intel
KepingYan
@@ -193,92 +242,43 @@ def train_func(config: Dict[str, Any]): } ) - optimizer = common.optimizer.Optimizer.registory.get("DefaultOptimizer")()( - model, - config={ - "name": config["Training"]["optimizer"], - "config": {"lr": config["Training"]["learning_rate"]}, -...
How is resuming finetuning from checkpoint supported?
llm-on-ray
github_2023
python
204
intel
KepingYan
@@ -193,92 +242,43 @@ def train_func(config: Dict[str, Any]): } ) - optimizer = common.optimizer.Optimizer.registory.get("DefaultOptimizer")()( - model, - config={ - "name": config["Training"]["optimizer"], - "config": {"lr": config["Training"]["learning_rate"]}, -...
Why remove optimizer?
llm-on-ray
github_2023
python
204
intel
KepingYan
@@ -193,92 +242,43 @@ def train_func(config: Dict[str, Any]): } ) - optimizer = common.optimizer.Optimizer.registory.get("DefaultOptimizer")()( - model, - config={ - "name": config["Training"]["optimizer"], - "config": {"lr": config["Training"]["learning_rate"]}, -...
I think we should pass optimizer parameter into the Trainer according to the user's configuration.
llm-on-ray
github_2023
python
204
intel
carsonwang
@@ -130,6 +121,52 @@ def get_accelerate_environment_variable(config: Dict[str, Any]) -> dict: return mode_env_vars[device][accelerate_mode] +def convert_to_training_args(cls, config): + device = config["Training"]["device"] + accelerate_mode = config["Training"]["accelerate_mode"] + checkpoint_dir = c...
The above three configs are hard coded? Are these values also used in our previous implementation?
llm-on-ray
github_2023
python
204
intel
carsonwang
@@ -130,6 +121,52 @@ def get_accelerate_environment_variable(config: Dict[str, Any]) -> dict: return mode_env_vars[device][accelerate_mode] +def convert_to_training_args(cls, config): + device = config["Training"]["device"] + accelerate_mode = config["Training"]["accelerate_mode"] + checkpoint_dir = c...
It seems this is not set.
llm-on-ray
github_2023
python
204
intel
carsonwang
@@ -130,6 +121,52 @@ def get_accelerate_environment_variable(config: Dict[str, Any]) -> dict: return mode_env_vars[device][accelerate_mode] +def convert_to_training_args(cls, config): + device = config["Training"]["device"] + accelerate_mode = config["Training"]["accelerate_mode"] + checkpoint_dir = c...
Do we have default values for all these configurations in `config`? Previously we wrote `config["Training"].get("gradient_accumulation_steps", 1)`
llm-on-ray
github_2023
python
204
intel
KepingYan
@@ -322,44 +323,27 @@ def main(external_config=None): "accelerate_mode" ] = "DDP" # will use DDP to accelerate if no method specified - ccl_worker_count = 1 device = config["Training"]["device"] if device != "cpu": - ccl_worker_count = num_training_workers + pass ...
Why are these ccl configurations no longer needed?
llm-on-ray
github_2023
python
165
intel
xwu99
@@ -187,9 +130,7 @@ def main(argv=None): # all models are served under the same URL and then accessed # through model_id, so it needs to pass in a unified URL. host = "127.0.0.1" if args.serve_local_only else "0.0.0.0" - rp = args.route_prefix if args.route_prefix else "" - rout...
we can't use a fixed port here as the previous port is configurable.
llm-on-ray
github_2023
python
165
intel
xwu99
@@ -31,7 +30,7 @@ def get_deployed_models(args): 2. Use relevant configuration parameters to generate `InferenceConfig` if model_id_or_path is set, 3. Serve all pre-defined models in inference/models/*.yaml, or part of them if models is set.
I don't think we are serving all models by default if none were chosen. Due to the resource constraint, it's default to serving gpt2 if none where chosen.
llm-on-ray
github_2023
python
165
intel
xwu99
@@ -31,7 +30,7 @@ def get_deployed_models(args): 2. Use relevant configuration parameters to generate `InferenceConfig` if model_id_or_path is set,
The comments also need to be update.
llm-on-ray
github_2023
python
165
intel
xwu99
@@ -89,57 +71,13 @@ def main(argv=None): type=str, help="Inference configuration file in YAML. If specified, all other arguments will be ignored.", ) - parser.add_argument("--model_id_or_path", default=None, type=str, help="Model name or path.") - parser.add_argument( - "--tokenizer_...
help doc like this needed to be revised.
llm-on-ray
github_2023
python
165
intel
xwu99
@@ -89,57 +71,13 @@ def main(argv=None): type=str, help="Inference configuration file in YAML. If specified, all other arguments will be ignored.",
need to revise
llm-on-ray
github_2023
python
165
intel
xwu99
@@ -47,23 +46,6 @@ def get_deployed_models(args): print("reading from config file, " + args.config_file)
```suggestion print("Reading from config file: " + args.config_file) ```
llm-on-ray
github_2023
others
165
intel
xwu99
@@ -32,11 +32,8 @@ We support three methods to specify the models to be served, and they have the f ``` llm_on_ray-serve --config_file llm_on_ray/inference/models/gpt2.yaml ``` -2. Use relevant configuration parameters if model_id_or_path is set. ``` -llm_on_ray-serve --model_id_or_path gpt2 [--tokenizer_id_or_path...
```suggestion 2. If --config_file is None, it will serve GPT2 by default, or the models specified by --models. ```
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -68,8 +68,10 @@ jobs: - name: Build Docker Image run: | - docker build ./ --build-arg CACHEBUST=1 --build-arg http_proxy=${{ inputs.http_proxy }} --build-arg https_proxy=${{ inputs.https_proxy }} -f dev/docker/Dockerfile.cpu_and_deepspeed -t finetune:latest && yes | docker container prune ...
I think you can move some environment constants to .github/workflows/config/docker.sh, let the function focus on the key parameters regarding to docker.
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -0,0 +1,54 @@ +set -eo pipefail
need to add a shebang like `#!/usr/bin/env bash`, please check other scripts.
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -83,6 +83,10 @@ jobs: echo "target is ${target}" echo "target=$target" >> $GITHUB_OUTPUT + - name: Source build script + run: | + cp .github/workflows/scripts/docker.sh .
move the script to dev/scripts, source directly not need to copy
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -83,6 +83,10 @@ jobs: echo "target is ${target}" echo "target=$target" >> $GITHUB_OUTPUT + - name: Source build script + run: | + cp .github/workflows/scripts/docker.sh . + - name: Build Docker Image run: | if [[ ${{ matrix.model }} == "mpt-7b...
also move this block to a function to return DF_SUFFIX
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -95,23 +99,31 @@ jobs: DF_SUFFIX=".cpu_and_deepspeed" fi TARGET=${{steps.target.outputs.target}} - docker build ./ --build-arg CACHEBUST=1 --build-arg http_proxy=${{ inputs.http_proxy }} --build-arg https_proxy=${{ inputs.https_proxy }} -f dev/docker/Dockerfile${DF_SUFFIX}...
rename to docker_exec
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -95,23 +99,31 @@ jobs: DF_SUFFIX=".cpu_and_deepspeed" fi TARGET=${{steps.target.outputs.target}} - docker build ./ --build-arg CACHEBUST=1 --build-arg http_proxy=${{ inputs.http_proxy }} --build-arg https_proxy=${{ inputs.https_proxy }} -f dev/docker/Dockerfile${DF_SUFFIX}...
I don't like this. Could we provide a file template and use sed to replace the variables? Also could we define a map from model to the yaml file in bash and move the logic into bash?
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -0,0 +1,76 @@ +#!/usr/bin/env bash +set -eo pipefail + +HTTP_PROXY='http://10.24.221.149:911' +HTTPS_PROXY='http://10.24.221.149:911' +MODEL_CACHE_PATH_LOACL='/root/.cache/huggingface/hub' +CODE_CHECKOUT_PATH_LOCAL='/root/llm-on-ray' + +build_and_prune() { + # Set TARGET and DF-SUFFIX using the passed in paramete...
Could you use $1, $2 to denote the arguments? it looks like this is not the standard way to pass in arguments?
llm-on-ray
github_2023
python
123
intel
xwu99
@@ -0,0 +1,90 @@ +# +# 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 by...
argv is no necessary as argparse.ArgumentParser() will get the command line?
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -0,0 +1,269 @@ +#!/usr/bin/env bash +set -eo pipefail + +HTTP_PROXY='http://10.24.221.149:911' +HTTPS_PROXY='http://10.24.221.149:911' +MODEL_CACHE_PATH_LOACL='/root/.cache/huggingface/hub' +CODE_CHECKOUT_PATH_LOCAL='/root/llm-on-ray' + +build_and_prune_test() { + # Set TARGET and DF-SUFFIX using the passed in pa...
pls use test_ as suffix or test_ as prefix for all test functions.
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -70,122 +70,46 @@ jobs: - name: Build Docker Image run: | - docker build ./ --build-arg CACHEBUST=1 --build-arg http_proxy=${{ inputs.http_proxy }} --build-arg https_proxy=${{ inputs.https_proxy }} -f dev/docker/Dockerfile.cpu_and_deepspeed -t finetune:latest - docker container pr...
Could we use USE_PROXY=1 or 0 instead of using "USE_PROXY" as input?
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -70,122 +70,46 @@ jobs: - name: Build Docker Image run: | - docker build ./ --build-arg CACHEBUST=1 --build-arg http_proxy=${{ inputs.http_proxy }} --build-arg https_proxy=${{ inputs.https_proxy }} -f dev/docker/Dockerfile.cpu_and_deepspeed -t finetune:latest - docker container pr...
could we move huggingface login to docker container start as it will be used for all the rest of steps? Start Docker Container can be renamed to Start Docker Container and Initialize
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -150,43 +150,47 @@ jobs: echo "target is ${target}" echo "target=$target" >> $GITHUB_OUTPUT + # - name: Source build script + # run: | + # cp .github/workflows/scripts/docker.sh . + - name: Build Docker Image run: | DF_SUFFIX=".tests_cpu" ...
unnecessary comment
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -0,0 +1,269 @@ +#!/usr/bin/env bash +set -eo pipefail + +HTTP_PROXY='http://10.24.221.149:911' +HTTPS_PROXY='http://10.24.221.149:911' +MODEL_CACHE_PATH_LOACL='/root/.cache/huggingface/hub' +CODE_CHECKOUT_PATH_LOCAL='/root/llm-on-ray' + +build_and_prune_test() { + # Set TARGET and DF-SUFFIX using the passed in pa...
better to print out some info about what test we are conducting before each docker exec
llm-on-ray
github_2023
others
123
intel
xwu99
@@ -0,0 +1,269 @@ +#!/usr/bin/env bash +set -eo pipefail + +HTTP_PROXY='http://10.24.221.149:911' +HTTPS_PROXY='http://10.24.221.149:911' +MODEL_CACHE_PATH_LOACL='/root/.cache/huggingface/hub' +CODE_CHECKOUT_PATH_LOCAL='/root/llm-on-ray' + +build_and_prune_test() { + # Set TARGET and DF-SUFFIX using the passed in pa...
it looks it's not get mapper but get suffix
llm-on-ray
github_2023
python
179
intel
carsonwang
@@ -32,13 +33,17 @@ def __init__(self, infer_conf: InferenceConfig, max_num_seqs): model_config = model_desc.config dtype = "bfloat16" if infer_conf.vllm.precision == PRECISION_BF16 else "float32" + # Set environment variable VLLM_CPU_KVCACHE_SPACE to control the size of the CPU key-value cac...
This should have been fixed and need to pass the device, right?
llm-on-ray
github_2023
python
179
intel
carsonwang
@@ -25,20 +26,25 @@ class VllmPredictor(Predictor): + VLLM_CPU_KVCACHE_SPACE_DEFAULT = 40 + def __init__(self, infer_conf: InferenceConfig, max_num_seqs): super().__init__(infer_conf) model_desc = infer_conf.model_description model_config = model_desc.config dtype = "b...
We should expose this config in the yaml file
llm-on-ray
github_2023
python
167
intel
carsonwang
@@ -0,0 +1,189 @@ +import openai +import pytest +import os +import subprocess +from openai import OpenAI + +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:800...
The same function also appears in `test_example_simple.py`. Can we put it in a common place?
llm-on-ray
github_2023
python
167
intel
carsonwang
@@ -0,0 +1,189 @@ +import openai +import pytest +import os +import subprocess +from openai import OpenAI + +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:800...
We can remove 4 methods here starting with `completions_` as they are not used.
llm-on-ray
github_2023
python
167
intel
carsonwang
@@ -0,0 +1,189 @@ +import openai +import pytest +import os +import subprocess +from openai import OpenAI + +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:800...
Can we enable these two starting with `chat_` and remove others starting with `completions_` ?
llm-on-ray
github_2023
python
69
intel
carsonwang
@@ -0,0 +1,256 @@ +# Adapted from https://github.com/vllm-project/vllm/blob/main/benchmarks/benchmark_serving.py + +import argparse +import asyncio +import json +import random +import time +from tqdm import tqdm +from typing import AsyncGenerator, Dict, List, Tuple, Union + +import aiohttp +import numpy as np +from tra...
If max_new_tokens is specified in config, the value is not set to config["max_tokens"]. Remove the else word so this line always runs?
llm-on-ray
github_2023
python
69
intel
carsonwang
@@ -0,0 +1,256 @@ +# Adapted from https://github.com/vllm-project/vllm/blob/main/benchmarks/benchmark_serving.py + +import argparse +import asyncio +import json +import random +import time +from tqdm import tqdm +from typing import AsyncGenerator, Dict, List, Tuple, Union + +import aiohttp +import numpy as np +from tra...
Are these prints only for debug? Remove them so they are not included in the latency.
llm-on-ray
github_2023
python
69
intel
carsonwang
@@ -0,0 +1,256 @@ +# Adapted from https://github.com/vllm-project/vllm/blob/main/benchmarks/benchmark_serving.py + +import argparse +import asyncio +import json +import random +import time +from tqdm import tqdm +from typing import AsyncGenerator, Dict, List, Tuple, Union + +import aiohttp +import numpy as np +from tra...
If you start using command `python inference/serve.py --config_file <model_config_file.yaml> --simple --keep_serve_terminal` as described in the doc, the yaml file might not in the models directory. So we should use the `route_prefix` and `tokenizer_name_or_path` etc specified in the user conf file instead of `all_mode...
llm-on-ray
github_2023
python
69
intel
carsonwang
@@ -0,0 +1,256 @@ +# Adapted from https://github.com/vllm-project/vllm/blob/main/benchmarks/benchmark_serving.py
Can we use the same format like files we implemented the openAI API? Adding the apache license header.
llm-on-ray
github_2023
python
69
intel
KepingYan
@@ -0,0 +1,589 @@ +# +# Copyright 2024 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...
Maybe we need to make a deep copy of the parameter config in this loop.
llm-on-ray
github_2023
python
69
intel
KepingYan
@@ -0,0 +1,589 @@ +# +# Copyright 2024 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...
Or make a deep copy of the config parameters here. Otherwise, when passing through line 231 for the first time, the value of `config` will become {'max_new_tokens': 37}, so that the output_len will be 37 every time in the future. This is why total_time is reduced a lot
llm-on-ray
github_2023
python
109
intel
xwu99
@@ -57,10 +64,15 @@ def script_with_args(api_base, model_name, streaming_response, max_new_tokens, t result_openai = subprocess.run(cmd_openai, capture_output=True, text=True) + # Ensure there are no errors in the OpenAI API query script execution + try:
this is a test, you need to raise the assert exception rather than capture it.
llm-on-ray
github_2023
python
109
intel
xwu99
@@ -57,10 +64,15 @@ def script_with_args(api_base, model_name, streaming_response, max_new_tokens, t result_openai = subprocess.run(cmd_openai, capture_output=True, text=True) + # Ensure there are no errors in the OpenAI API query script execution + try: + assert result_openai.returncode == 0, pri...
this seems strange to me to use ` ,` to seperate two statements.
llm-on-ray
github_2023
others
166
intel
carsonwang
@@ -5,7 +5,7 @@ General: checkpoint_dir: /tmp/llm-ray/checkpoint config: trust_remote_code: false - use_auth_token: null + use_auth_tokenuth_token: null
Is this unintended modification?
llm-on-ray
github_2023
python
166
intel
carsonwang
@@ -57,10 +57,10 @@ def test_max_input_len(): # Add more tests for edge cases -def test_get_torch_dtype_cpu_without_ipex(mock_infer_conf): - hf_config = None - dtype = get_torch_dtype(mock_infer_conf, hf_config) - assert dtype == torch.get_default_dtype() +def test_decide_torch_dtype_cpu_without_ipex(mock...
can you please cover more test cases in your implementation, for example device is HPU?
llm-on-ray
github_2023
python
166
intel
carsonwang
@@ -23,6 +23,8 @@ class ModelConfig(BaseModel): trust_remote_code: bool = False use_auth_token: Union[str, None] = None load_in_4bit: bool = False + torch_dtype: Union[str, None] = None
IPEX has a `precision` config, vLLM has a `precision` config too. Here we are adding a new one. All should use this single config, right? @kira-lin @KepingYan @xwu99
llm-on-ray
github_2023
others
189
intel
xwu99
@@ -0,0 +1,22 @@ +## Deploying and Serving LLMs with ipex-LLM +[ipex-LLM](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/index.html) is a library for running LLM (large language model) on Intel XPU (from Laptop to GPU to Cloud) using INT4 with very low latency (for any PyTorch model).
Pls honor the original capitalization. ipex-LLM should be IPEX-LLM when refer to the product. When refer to library, you can use ipex-llm. See: https://ipex-llm.readthedocs.io/en/latest/doc/LLM/index.html for styles. Pls update other cases as well.
llm-on-ray
github_2023
others
190
intel
carsonwang
@@ -0,0 +1,25 @@ +port: 8000 +name: deepseek-coder-33b-instruct +route_prefix: /deepseek-coder-33b-instruct +num_replicas: 1 +cpus_per_worker: 24 +gpus_per_worker: 0 +deepspeed: false +workers_per_group: 2 +device: "cpu"
```suggestion device: cpu ```
llm-on-ray
github_2023
others
190
intel
KepingYan
@@ -0,0 +1,25 @@ +port: 8000 +name: deepseek-coder-33b-instruct +route_prefix: /deepseek-coder-33b-instruct +num_replicas: 1 +cpus_per_worker: 24 +gpus_per_worker: 0 +deepspeed: false +workers_per_group: 2 +device: CPU
Please change this to lowercase letters.
llm-on-ray
github_2023
others
196
intel
carsonwang
@@ -1,4 +1,4 @@ -FROM vault.habana.ai/gaudi-docker/1.14.0/ubuntu22.04/habanalabs/pytorch-installer-2.1.1:latest +FROM vault.habana.ai/gaudi-docker/1.15.1/ubuntu22.04/habanalabs/pytorch-installer-2.2.0:latest
Should we also update to 1.15.1 in line 15 `pip install git+https://github.com/HabanaAI/DeepSpeed.git@1.14.0`?
llm-on-ray
github_2023
others
154
intel
xwu99
@@ -26,3 +26,11 @@ jobs: - name: Run Lint run: ./format.sh -a + + - name: Install dependencies for license check + run: | + python -m pip install --upgrade pip + pip install regex + + - name: Run License Check + run: python .github/license/license-header.py fi...
It is better to use --files, otherwise it will be confused with the a file named `files`
llm-on-ray
github_2023
python
154
intel
xwu99
@@ -0,0 +1,237 @@ +# +# 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...
It's OK to raise exception from where the error happened instead rather than using global variable to mark a failure.
llm-on-ray
github_2023
python
153
intel
carsonwang
@@ -244,20 +244,34 @@ 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): - input_ids, input_length = self.toke...
Can we simplify this method by always accepting prompts as List[str] like below? We can write another method that accepts a prompt: str and returns `self.generate([prompt], **config)[0]` ```suggestion def generate( self, prompts: List[str], **config ) -> List[GenerateResult]: input_ids, i...
llm-on-ray
github_2023
python
153
intel
carsonwang
@@ -115,20 +116,34 @@ def streaming_generate(self, prompt, streamer, **config): **config, ) - def generate(self, prompt, **config): + def generate(
same here.
llm-on-ray
github_2023
python
153
intel
carsonwang
@@ -93,145 +104,253 @@ async def consume_streamer_async(self, streamer: TextIteratorStreamer): # back to the event loop so other coroutines can run. await asyncio.sleep(0.001) - async def __call__(self, http_request: Request) -> Union[StreamingResponse, JSONResponse, str]: - ...
Update `prompt: str` to include list in the method definition.
llm-on-ray
github_2023
python
153
intel
carsonwang
@@ -93,145 +104,253 @@ async def consume_streamer_async(self, streamer: TextIteratorStreamer): # back to the event loop so other coroutines can run. await asyncio.sleep(0.001) - async def __call__(self, http_request: Request) -> Union[StreamingResponse, JSONResponse, str]: - ...
I feel this file is too complex, too many if else. Can we further simplify this? For example, if we are returning ModelResponse for openai, can we return SimpleModelResponse for simple serving server, but the logic to create the response can be the same. So you can create a method to generate the response without if el...
llm-on-ray
github_2023
python
153
intel
KepingYan
@@ -0,0 +1,102 @@ +# +# 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...
Please modify the endpoint according to parameter --model_endpoint.
llm-on-ray
github_2023
python
153
intel
KepingYan
@@ -93,145 +104,253 @@ async def consume_streamer_async(self, streamer: TextIteratorStreamer): # back to the event loop so other coroutines can run. await asyncio.sleep(0.001) - async def __call__(self, http_request: Request) -> Union[StreamingResponse, JSONResponse, str]: - ...
This should be str(dict(sorted(config.items()))), now if config is different from sorted(config.items()), batched_prompts[key] will have only one prompt.
llm-on-ray
github_2023
others
153
intel
carsonwang
@@ -116,6 +116,7 @@ The following are detailed guidelines for pretraining, finetuning and serving LL * [Deploy and Serve LLMs on Intel CPU/GPU/Gaudi](docs/serve.md) * [Deploy and Serve LLMs with Deepspeed](docs/serve_deepspeed.md) * [Deploy and Serve LLMs with BigDL-LLM](docs/serve_bigdl.md) +* [Enable Continuous, S...
Let's remove this and the file for now.
llm-on-ray
github_2023
python
181
intel
carsonwang
@@ -155,6 +155,10 @@ def train_func(config: Dict[str, Any]): gradient_accumulation_steps = config["Training"].get("gradient_accumulation_steps", 1) base_model = config["General"]["base_model"] + if config["General"].get("tokenizer_name") is not None: + tokenizer_name = config["General"].get("token...
```suggestion tokenizer_name = config["General"].get("tokenizer_name", base_model) ```
llm-on-ray
github_2023
python
158
intel
carsonwang
@@ -22,11 +22,10 @@ def serve_run(deployments, model_list): for model_id, infer_conf in model_list.items(): print("deploy model: ", model_id) deployment = deployments[model_id] + + serve.start(http_options={"host": infer_conf.host, "port": infer_conf.port}) serve.run( ...
can we pass `keep_serve_terminal` and set it to the new `blocking` parameter in serve.run? Better to also rename `keep_serve_terminal` to `blocking` in our script which will be more consistent and easy to understand.
llm-on-ray
github_2023
python
170
intel
carsonwang
@@ -208,7 +208,7 @@ def train(self): if step % logging_steps == 0: loss = loss.item() ppl = math.exp(loss) - epochs = (step + idx * total_steps) / (num_train_epochs * total_steps) + epochs = idx + step /...
What about update `total_steps` to `steps_per_epoch`? Otherwise it was confusing. Also check line 222 when we report the total steps, that should be steps_per_epoch * num_train_epochs?
llm-on-ray
github_2023
python
170
intel
carsonwang
@@ -219,9 +219,9 @@ def train(self): "train_epoch": idx, "total_epochs": num_train_epochs, "train_step": step, - "total_steps": min(max_train_step, total_steps) + ...
```suggestion "total_steps": min(max_train_step, steps_per_epoch * num_train_epochs) if max_train_step else steps_per_epoch * num_train_epochs, ```
llm-on-ray
github_2023
others
160
intel
carsonwang
@@ -46,21 +46,30 @@ Training: GPU: 1 accelerate_mode: GPU_DDP ``` +For HPU, set `device` to HPU, set HPU number in `resources_per_worker` and set `accelerate_mode` to HPU_DDP or HPU_DEEPSPEED. +``` +Training: + device: HPU + resources_per_worker: + CPU: 1 + HPU: 1 + accelerate_mode: HPU_DDP +``` Plea...
Also update the description above, "The following models have been verified on Intel CPUs, GPUs and HPUs."
llm-on-ray
github_2023
others
160
intel
carsonwang
@@ -46,21 +46,30 @@ Training: GPU: 1 accelerate_mode: GPU_DDP ``` +For HPU, set `device` to HPU, set HPU number in `resources_per_worker` and set `accelerate_mode` to HPU_DDP or HPU_DEEPSPEED. +``` +Training: + device: HPU + resources_per_worker: + CPU: 1 + HPU: 1 + accelerate_mode: HPU_DDP +``` Plea...
Did you run and verify gpt-j on Gaudi?
llm-on-ray
github_2023
others
160
intel
carsonwang
@@ -46,21 +46,30 @@ Training: GPU: 1 accelerate_mode: GPU_DDP ``` +For HPU, set `device` to HPU, set HPU number in `resources_per_worker` and set `accelerate_mode` to HPU_DDP or HPU_DEEPSPEED. +``` +Training: + device: HPU + resources_per_worker: + CPU: 1 + HPU: 1 + accelerate_mode: HPU_DDP
I am wondering if we can just use DDP,FSDP, and Deepspeed for this parameter without adding CPU_, GPU_ and HPU_. Because we can already know the device from `device` parameter, right?
llm-on-ray
github_2023
python
160
intel
carsonwang
@@ -137,13 +137,12 @@ def train_func(config: Dict[str, Any]): config={ "name": base_model, "dtype": convert_dtype(config["Training"].get("mixed_precision", "no")), + "device": torch.device(config["Training"]["device"].lower()),
Can you please do the lower conversion in finetune_config.py, referring to https://github.com/intel/llm-on-ray/blob/main/llm_on_ray/inference/inference_config.py#L137
llm-on-ray
github_2023
others
160
intel
carsonwang
@@ -2,7 +2,7 @@ General: base_model: EleutherAI/gpt-j-6b gpt_base_model: true output_dir: /tmp/llm-ray/output - checkpoint_dir: /tmp/llm-ray/checkpoint + checkpoint_dir: null
Why do we change this?
llm-on-ray
github_2023
python
160
intel
carsonwang
@@ -1771,10 +1771,11 @@ def _init_ui(self): "optimizer": "AdamW", "lr_scheduler": "linear", "weight_decay": 0.0, - "device": "CPU", + "device": "cpu",
The document says "CPU". Let's be consistent to use "CPU"
llm-on-ray
github_2023
python
160
intel
carsonwang
@@ -69,11 +69,11 @@ def check_device(cls, v: str): devices = ["CPU", "GPU", "HPU"] if v not in devices: raise ValueError(f"device must be one of {devices}") - return v + return v.lower()
```suggestion DEVICE_CPU = "cpu" DEVICE_HPU = "hpu" DEVICE_GPU = "gpu" @validator("device") def _check_device(cls, v: str): if v: assert v.lower() in [DEVICE_CPU, DEVICE_GPU, DEVICE_HPU] return v.lower() ```
llm-on-ray
github_2023
python
160
intel
carsonwang
@@ -68,23 +71,23 @@ def get_accelerate_environment_variable(mode: str, config: Union[Dict[str, Any], "FSDP_SYNC_MODULE_STATES": "true", "ACCELERATE_MIXED_PRECISION": mixed_precision, }, - "GPU_DEEPSPEED": { + "gpu_DEEPSPEED": { "ACCELERATE_USE_CPU": "false",...
The error message above is no longer correct because accelerate mode can only be CPU, GPU or Deepspeed now. Can you please print something like Accelerate mode xxx is not supported on device xxx?
llm-on-ray
github_2023
others
160
intel
carsonwang
@@ -0,0 +1,25 @@ +{ + "steps_per_print": 64, + "train_batch_size": "auto", + "train_micro_batch_size_per_gpu": "auto", + "gradient_accumulation_steps": "auto", + "bf16": { + "enabled": true + }, + "optimizer": {
We already have optimizer configured in the yaml, why it appears again in this json file? This should only include deepspeed config, right?
llm-on-ray
github_2023
python
163
intel
xwu99
@@ -47,7 +50,10 @@ async def _get_generator_output(self, results_generator): async def generate_async(self, prompts: Union[str, List[str]], **config) -> GenerateResult: config = self.update_vllm_config(**config) + # In order to align with vllm test parameters + config["ignore_eos"] = True ...
remove this
llm-on-ray
github_2023
python
163
intel
xwu99
@@ -148,6 +150,12 @@ def main(argv=None): action="store_true", help="Whether to keep serve terminal.", ) + parser.add_argument( + "--ray_max_concurrent_queries", required=True, type=int, help="The batch size in Ray."
need better help. the batch size here causes more confusions. just say "Max concurrent requests the serving system can process." --ray_max_concurrent_queries no need to add ray here. user just need to know it's the limit to the serving system.
llm-on-ray
github_2023
python
141
intel
carsonwang
@@ -70,6 +70,13 @@ def get_deployed_models(args): deployments = {} for model_id, infer_conf in model_list.items(): ray_actor_options = get_deployment_actor_options(infer_conf) + if args.model_id_or_path is None and args.config_file is None: + if "mistral-7b-v0.1" in args.models: + ...
Please see if we can disable IPEX and make Mistral work without pinning transformer to 4.35.
llm-on-ray
github_2023
python
134
intel
carsonwang
@@ -355,26 +369,42 @@ async def chat( status_code=results.error.code, type=results.error.type, ) - results = results.dict() - choices: List[ChatCompletionResponseChoice] = [ - ...
```suggestion if results.tool_calls is not None: msg = ChatMessage(role="assistant", tool_calls=results.tool_calls) # deleting this fields so that they don't appear in the response del msg.tool_call_id e...
llm-on-ray
github_2023
python
134
intel
carsonwang
@@ -1713,6 +1718,12 @@ def _init_ui(self): type=str, help="The ip:port of head node to connect when restart a worker node.", ) + parser.add_argument( + "--ref_app_url", + default="http://127.0.0.1:8501",
How can other external users make this work by default? can you please add document how to launch it? If not, can you please remove and add an option to make it work for you only for now?
llm-on-ray
github_2023
others
134
intel
carsonwang
@@ -188,6 +188,14 @@ jobs: docker exec "${TARGET}" bash -c "python examples/inference/api_server_openai/query_http_requests.py --model_name ${{ matrix.model }}" fi + - name: Run Agent tool Inference Test with REST API + run: | + TARGET=${{steps.target.outputs.target}} + ...
This is to run the example, can we test and verify the LLM response is a correct Json to call the function?
llm-on-ray
github_2023
python
87
intel
carsonwang
@@ -0,0 +1,208 @@ +# Reference: https://github.com/huggingface/optimum-habana/blob/main/examples/text-generation/utils.py +import os +import tempfile +import ray +from torch_dist import ( + TorchDistributedWorker, + init_torch_dist_process_group, +) +from ray.util.scheduling_strategies import PlacementGroupSchedu...
can we use get_torch_dtype in utils? Update that function if needed.
llm-on-ray
github_2023
python
87
intel
carsonwang
@@ -0,0 +1,208 @@ +# Reference: https://github.com/huggingface/optimum-habana/blob/main/examples/text-generation/utils.py
can you follow our openAI API code and use the same way to write the license and header here?
llm-on-ray
github_2023
python
87
intel
carsonwang
@@ -0,0 +1,208 @@ +# Reference: https://github.com/huggingface/optimum-habana/blob/main/examples/text-generation/utils.py +import os +import tempfile +import ray +from torch_dist import ( + TorchDistributedWorker, + init_torch_dist_process_group, +) +from ray.util.scheduling_strategies import PlacementGroupSchedu...
Do we need this kind of configs for other larger models? Does it work with other modes right now?
llm-on-ray
github_2023
python
87
intel
carsonwang
@@ -0,0 +1,208 @@ +# Reference: https://github.com/huggingface/optimum-habana/blob/main/examples/text-generation/utils.py +import os +import tempfile +import ray +from torch_dist import ( + TorchDistributedWorker, + init_torch_dist_process_group, +) +from ray.util.scheduling_strategies import PlacementGroupSchedu...
Is this always true? Otherwise, we need to add a config in the yaml.
llm-on-ray
github_2023
python
87
intel
carsonwang
@@ -0,0 +1,194 @@ +"""This file is modeled after ray/python/ray/train/torch/config.py + +The logics are duplicated right now to allow maximum flexibility for +setting up PyTorch DDP process groups outside the context of Ray Train. +Eventually, these use cases should be consolidated. +""" + +from abc import ABC +from co...
Do we need to clean up for HPU?
llm-on-ray
github_2023
others
87
intel
carsonwang
@@ -0,0 +1,24 @@ +port: 8000 +name: llama-2-70b-chat-hf +route_prefix: /llama-2-70b-chat-hf
Add `num_replicas: 1` after `route_prefix` that was recently introduced.
llm-on-ray
github_2023
python
87
intel
carsonwang
@@ -0,0 +1,194 @@ +"""This file is modeled after ray/python/ray/train/torch/config.py
same here.
llm-on-ray
github_2023
others
87
intel
carsonwang
@@ -2,9 +2,34 @@ FROM vault.habana.ai/gaudi-docker/1.14.0/ubuntu22.04/habanalabs/pytorch-installe ENV LANG=en_US.UTF-8 -COPY ../../ /root/llm-on-ray - WORKDIR /root/llm-on-ray -RUN pip install . && \ - pip install --upgrade-strategy eager optimum[habana] \ No newline at end of file +COPY ./pyproject.toml . +...
```suggestion # Required by DeepSpeed ```
llm-on-ray
github_2023
others
87
intel
carsonwang
@@ -56,19 +56,24 @@ For Gaudi: Please use the [Dockerfile](../dev/docker/Dockerfile.habana) to build the image. Alternatively, you can install the dependecies on a bare metal machine. In this case, please refer to [here](https://docs.habana.ai/en/latest/Installation_Guide/Bare_Metal_Fresh_OS.html#build-docker-bare). ...
can we add the following options as we used in our demo? `-e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --cap-add sys_ptrace --net=host --ipc=host llm-on-ray:habana`
llm-on-ray
github_2023
python
87
intel
carsonwang
@@ -0,0 +1,281 @@ +# Reference: https://github.com/huggingface/optimum-habana/blob/main/examples/text-generation/utils.py
Also add license header for this file
llm-on-ray
github_2023
python
87
intel
carsonwang
@@ -0,0 +1,313 @@ +# +# 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...
Need to import from llm_on_ray.xxx like below. can you please update all of others in your PR? ``` from llm_on_ray.inference.inference_config import InferenceConfig, GenerateResult ```
llm-on-ray
github_2023
python
93
intel
xwu99
@@ -0,0 +1,77 @@ +import subprocess +import pytest + +# Config matrix +# models_array = ["gpt2", "gpt2 gpt-j-6b", "gpt2 bloom-560m", "falcon-7b"] +# model_endpoint_array = ["http://127.0.0.1:8000", None] +# streaming_response_array = [True, False] +# max_new_tokens_array = [10, None] +# temperature_array = [0.7, None] ...
I think you can use list directly without defining another models_array above. it's the same and more clearer.
llm-on-ray
github_2023
python
93
intel
xwu99
@@ -0,0 +1,77 @@ +import subprocess +import pytest + +# Config matrix +# models_array = ["gpt2", "gpt2 gpt-j-6b", "gpt2 bloom-560m", "falcon-7b"] +# model_endpoint_array = ["http://127.0.0.1:8000", None] +# streaming_response_array = [True, False] +# max_new_tokens_array = [10, None] +# temperature_array = [0.7, None] ...
could we test all config matrix above and report what don't work?
llm-on-ray
github_2023
python
93
intel
xwu99
@@ -0,0 +1,68 @@ +import subprocess +import pytest + +# Config matrix +# models_array = ["gpt2", "gpt2 gpt-j-6b", "gpt2 bloom-560m", "falcon-7b"] +# model_endpoint_array = ["http://127.0.0.1:8000", None] +# streaming_response_array = [True, False] +# max_new_tokens_array = [10, None] +# temperature_array = [0.7, None] ...
I think you can check the exit code of the processes. Successful run is 0. If exception thrown, it should be non-zero.
llm-on-ray
github_2023
others
84
intel
xwu99
@@ -0,0 +1,50 @@ +#!/bin/bash +set -eo pipefail + +# Step 1: Python environment +# Check Python version is or later than 3.9 +if ! python -c 'import sys; assert sys.version_info >= (3,9)' > /dev/null; then + exit "Python should be 3.9 or later!" +fi + +# Clone repo +git clone https://github.com/intel/llm-on-ray.git ...
we have updated the way to start serving by using llm_on_ray-serve, please check README.md for details.
llm-on-ray
github_2023
others
84
intel
xwu99
@@ -50,6 +50,7 @@ jobs: - name: Run Tests run: | ./tests/run-tests.sh + ./tests/test_getting_started.sh
pls run this in a separate Step: ```code - name: Run Test for Getting Started run: | xxx ```
llm-on-ray
github_2023
others
84
intel
xwu99
@@ -0,0 +1,45 @@ +#!/bin/bash +set -eo pipefail + +# Step 1: Python environment +# Check Python version is or later than 3.9 +if ! python -c 'import sys; assert sys.version_info >= (3,9)' > /dev/null; then + exit "Python should be 3.9 or later!" +fi + +# Clone repo +git clone https://github.com/intel/llm-on-ray.git ...
better to print some output message for what is being tested for each step in the script then we can check CI log later.
llm-on-ray
github_2023
others
84
intel
xwu99
@@ -1,7 +1,7 @@ port: 8000 name: gpt2 route_prefix: /gpt2 -cpus_per_worker: 2 +cpus_per_worker: 1
Is it OK to use 2 cores, it will be much faster?
llm-on-ray
github_2023
others
84
intel
xwu99
@@ -0,0 +1,57 @@ +#!/bin/bash +set -eo pipefail + +# Usage: ./test_setup [CPU, GPU, Gaudi] [Deepspeed] + +# Step 1: Clone and create conda environment
also we can print out those step instead of comments that can be checked in the CI log.