Skip to content

Commit

Permalink
Fix packaging (quic#68)
Browse files Browse the repository at this point in the history
* Fix pyproject.toml not including all source files

Signed-off-by: Ilango Rajagopal <quic_irajagop@quicinc.com>

* Remove setup.py

Signed-off-by: Ilango Rajagopal <quic_irajagop@quicinc.com>

* Added missing __init__.py files

Signed-off-by: Ilango Rajagopal <quic_irajagop@quicinc.com>

* CI: Package install instead of editable install

Signed-off-by: Ilango Rajagopal <quic_irajagop@quicinc.com>

* Remove duplicate code checkout stage

Signed-off-by: Ilango Rajagopal <quic_irajagop@quicinc.com>

* Tests should not refer to ROOT_DIR

Signed-off-by: Ilango Rajagopal <quic_irajagop@quicinc.com>

* Use direct path for test json files

Signed-off-by: Ilango Rajagopal <quic_irajagop@quicinc.com>

* Add minimum version for setuptools

Signed-off-by: Ilango Rajagopal <quic_irajagop@quicinc.com>

* Update installation instructions

Signed-off-by: Ilango Rajagopal <quic_irajagop@quicinc.com>

---------

Signed-off-by: Ilango Rajagopal <quic_irajagop@quicinc.com>
  • Loading branch information
irajagop authored Jul 17, 2024
1 parent 8265edf commit 2c44851
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.4
rev: v0.5.2
hooks:
# Run the linter.
- id: ruff
Expand Down
6 changes: 6 additions & 0 deletions QEfficient/compile/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -----------------------------------------------------------------------------
#
# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# -----------------------------------------------------------------------------
6 changes: 6 additions & 0 deletions QEfficient/transformers/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -----------------------------------------------------------------------------
#
# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# -----------------------------------------------------------------------------
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,8 @@ System Requirements:

## Installation
```bash
# Create Python virtual env and activate it. (Required Python 3.8)

# Login to the Cloud AI 100 Server.
ssh -X username@hostname

python3.8 -m venv qeff_env
source qeff_env/bin/activate

# Clone the QEfficient Repo.

# Install the qefficient-library in Host machine (Used for CLI APIs) (Until we have docker integrated in Apps SDK)
pip install -e .
pip install -U pip
pip install git+https://github.com/quic/efficient-transformers
```

# Quick Start Guide
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ test = ["pytest","pytest-mock"]
quality = ["black", "ruff", "hf_doc_builder@git+https://github.com/huggingface/doc-builder.git"]

[build-system]
requires = ["setuptools"]
requires = ["setuptools>=62.0.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["QEfficient"]
[tool.setuptools.packages.find]
include = ["QEfficient*"]
namespaces = false

[tool.setuptools.dynamic.version]
attr = "QEfficient.__version__"

[tool.ruff]
line-length = 120
Expand Down
25 changes: 4 additions & 21 deletions scripts/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,16 @@ pipeline

stages
{
stage('Code Checkout')
{
steps
{
checkout scm
}
}
stage('Env Activation')
{
steps
{
sh '''
mkdir -p preflight_qeff
python3.8 -m venv preflight_qeff
. preflight_qeff/bin/activate
'''
}
}
stage('Install requirments')
stage('Install QEfficient')
{
steps
{
sh '''
python3.8 -m venv preflight_qeff
. preflight_qeff/bin/activate
pip install --upgrade pip setuptools
pip install /opt/qti-aic/dev/lib/x86_64/qaic-0.0.1-py3-none-any.whl
pip install -e .[test]
pip install .[test]
rm -rf QEfficient
'''
}
}
Expand Down
17 changes: 0 additions & 17 deletions setup.py

This file was deleted.

8 changes: 3 additions & 5 deletions tests/cloud/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from QEfficient.generation.text_generation_inference import check_batch_size_and_num_prompts
from QEfficient.utils import get_qpc_dir_path
from QEfficient.utils.constants import QEFF_MODELS_DIR, ROOT_DIR, Constants
from QEfficient.utils.constants import QEFF_MODELS_DIR, Constants
from QEfficient.utils.logging_utils import logger


Expand Down Expand Up @@ -66,9 +66,7 @@ def __init__(
self.model_name = model_name
self.num_cores = num_cores
self.prompt = prompt
self.prompts_txt_file_path = (
os.path.join(ROOT_DIR, prompts_txt_file_path) if prompts_txt_file_path is not None else None
)
self.prompts_txt_file_path = prompts_txt_file_path if prompts_txt_file_path is not None else None
self.aic_enable_depth_first = aic_enable_depth_first
self.mos = mos
self.cache_dir = cache_dir
Expand Down Expand Up @@ -177,7 +175,7 @@ def pytest_generate_tests(metafunc):
-----------
Ref: https://docs.pytest.org/en/7.3.x/how-to/parametrize.html
"""
json_file = os.path.join(ROOT_DIR, "tests", "cloud", "high_level_testing.json")
json_file = "tests/cloud/high_level_testing.json"
with open(json_file, "r") as file:
json_data = json.load(file)

Expand Down
5 changes: 2 additions & 3 deletions tests/transformers/models/test_causal_lm_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
# -----------------------------------------------------------------------------

import json
import os

import pytest
from transformers import AutoConfig, AutoModelForCausalLM

from QEfficient.utils.constants import ROOT_DIR, Constants
from QEfficient.utils.constants import Constants
from QEfficient.utils.device_utils import get_available_device_id
from tests.utils import get_cloud_ai_100_tokens, set_up

TEST_CONFIG_FILE_PATH = os.path.join(ROOT_DIR, "tests", "config.json")
TEST_CONFIG_FILE_PATH = "tests/config.json"


def get_config(model_config):
Expand Down
4 changes: 2 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from QEfficient.exporter.export_hf_to_cloud_ai_100 import qualcomm_efficient_converter
from QEfficient.transformers.transform import transform_lm
from QEfficient.utils import hf_download, load_hf_tokenizer
from QEfficient.utils.constants import QEFF_MODELS_DIR, ROOT_DIR, Constants
from QEfficient.utils.constants import QEFF_MODELS_DIR, Constants
from QEfficient.utils.device_utils import get_available_device_id, is_multi_qranium_setup_available, is_qpc_size_gt_32gb
from QEfficient.utils.run_utils import ApiRunner

Expand Down Expand Up @@ -180,7 +180,7 @@ def get_cloud_ai_100_tokens(setup_info):
if device_id:
_, test_qpcs_path = compile_kv_model_on_cloud_ai_100(
onnx_path=setup_info["onnx_model_path"],
specializations_json=f"{ROOT_DIR}/scripts/specializations.json",
specializations_json="scripts/specializations.json",
num_cores=14,
base_path=tests_qpc_dir,
mxfp6=False,
Expand Down

0 comments on commit 2c44851

Please sign in to comment.