Skip to content

Commit

Permalink
Clean dependencies in requirements.txt and setup.py (#1389)
Browse files Browse the repository at this point in the history
  • Loading branch information
PenghuiCheng committed Mar 18, 2024
1 parent a8e5295 commit 4368478
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 48 deletions.
2 changes: 1 addition & 1 deletion examples/huggingface/pytorch/text-generation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Dataset: lambada-openai
| databricks/dolly-v2-3b | alpha 0.5 | 62.97% | 60.86% | 62.47% (w/o BF16) |


## Purpose of the Language Models Optimization for Intel Architecture
## Purpose of the Language Models Optimization for Intel Architecture


- Demonstrate the AI workloads and deep learning models Intel has optimized and validated to run on Intel hardware
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ python run_generation.py \
# # Weight Only Quantization for GPU device
>**Note**:
> 1. default search algorithm is beam search with num_beams = 1.
> 2. [ipex.optimize_transformers](https://github.com/intel/intel-extension-for-pytorch/blob/v2.1.10%2Bxpu/docs/tutorials/llm/llm_optimize_transformers.md) sSupport for the optimized inference of model types "gptj," "mistral," "qwen," and "llama" to achieve high performance and accuracy. Ensure accurate inference for other model types as well.
> 2. [ipex.optimize_transformers](https://github.com/intel/intel-extension-for-pytorch/blob/v2.1.10%2Bxpu/docs/tutorials/llm/llm_optimize_transformers.md) Support for the optimized inference of model types "gptj," "mistral," "qwen," and "llama" to achieve high performance and accuracy. Ensure accurate inference for other model types as well.
## Prerequisite​
### Create Environment​
Pytorch and Intel-extension-for-pytorch version for intel GPU > 2.1 are required, python version requests equal or higher than 3.9 due to [text evaluation library](https://github.com/EleutherAI/lm-evaluation-harness/tree/master) limitation, the dependent packages are listed in requirements_GPU.txt, we recommend create environment as the following steps. For Intel-exension-for-pytorch, we should install from source code now, and Intel-extension-for-pytorch will add weight-only quantization in the next version.
Expand Down
8 changes: 0 additions & 8 deletions intel_extension_for_transformers/llm/quantization/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,6 @@ def default_calib_func(model):
if config.quant_method.value not in ["awq"]:
calib_func = None

orig_dtype = torch.float32
for param in model.parameters():
orig_dtype = param.dtype
if orig_dtype != torch.float32:
model.to(dtype=torch.float32)
break
inc_model = quantization.fit(
model, conf, calib_func=calib_func, calib_dataloader=calib_dataloader
)
Expand All @@ -503,8 +497,6 @@ def default_calib_func(model):
q_model = replace_linear(
inc_model.model, None, None, config, device=device
)
if orig_dtype != torch.float32:
q_model.to(dtype=orig_dtype)

return q_model.to(device)

Expand Down
5 changes: 5 additions & 0 deletions requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/cpu
cmake
ninja
torch

11 changes: 0 additions & 11 deletions requirements-gpu.txt

This file was deleted.

7 changes: 0 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
--extra-index-url https://download.pytorch.org/whl/cpu
accelerate
cmake>=3.16
gguf
ninja
optimum-intel
py-cpuinfo
setuptools>=65
setuptools_scm[toml]>=6.2
torch==2.2.0+cpu
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
from setuptools.command.build_ext import build_ext


result = subprocess.Popen("pip install -r requirements.txt", shell=True)
result.wait()


def get_gpu_family():
''' Get gpu device family info.
Expand Down Expand Up @@ -57,6 +61,9 @@ def check_env_flag(name: str, default: bool = False) -> bool:
SKIP_RUNTIME = True
RUNTIME_ONLY = False
IS_INTEL_GPU = True
else:
result = subprocess.Popen("pip install -r requirements-cpu.txt", shell=True)
result.wait()

if not SKIP_RUNTIME:
from cmake import CMAKE_BIN_DIR
Expand Down
20 changes: 0 additions & 20 deletions setup_env_gpu.sh

This file was deleted.

0 comments on commit 4368478

Please sign in to comment.