Skip to content

Commit

Permalink
[dicp][tops] Add dicp ci of tops. (#469)
Browse files Browse the repository at this point in the history
* Add dicp ci of tops.

* Fix dicp ci of tops.
  • Loading branch information
yao-fengchen authored and KevinfromTJ committed Dec 4, 2023
1 parent 65d3854 commit 7bd5c20
Show file tree
Hide file tree
Showing 92 changed files with 114 additions and 106 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/_runs-on-topsrider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,23 @@ jobs:
- name: Checkout Code
uses: DeepLink-org/deeplink.framework/.github/actions/checkout-code@main

build:
build_test:
runs-on: ${{ inputs.runner }}
needs: checkout_code
steps:
- name: build on topsrider
- name: build and test on topsrider
uses: DeepLink-org/deeplink.framework/.github/actions/code-build-test@main
with:
build_shell: "pwd" #Write the script you want to execute here,If you don't know which parameters to fill in, you can refer to the actions/code-build-test
job_name: "build"
build_shell: "
source dicp/scripts/ci/tops/ci_tops_build_env.sh && \
pip uninstall torch_dipu -y && \
pip uninstall dicp -y && \
cd dipu && python setup.py install --user && \
cd ../dicp && python setup.py install --user && \
cd .. && source dicp/scripts/ci/tops/ci_tops_test_env.sh /mnt/models/llama_models && \
export TEST_DIR=$(pwd)/dicp/test && echo ${TEST_DIR} && \
bash ${TEST_DIR}/tops_scripts/ops/run_test_ops.sh false && \
bash ${TEST_DIR}/tops_scripts/models/run_test_models.sh false
"
job_name: "build_test"
cover_job: "0"

test:
runs-on: ${{ inputs.runner }}
needs: build
steps:
- name: build on topsrider
uses: DeepLink-org/deeplink.framework/.github/actions/code-build-test@main
with:
build_shell: "pwd" #Write the script you want to execute here,If you don't know which parameters to fill in, you can refer to the actions/code-build-test
job_name: "build"
cover_job: "1"

Empty file added dicp/dicp/vendor/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions dicp/scripts/ci/tops/ci_tops_build_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

export DIPU_DEVICE=tops
export DIPU_WITH_DIOPI_LIBRARY=DISABLE
6 changes: 6 additions & 0 deletions dicp/scripts/ci/tops/ci_tops_test_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

LLAMA_MODEL_DIR=$1

export DIPU_MOCK_CUDA=false
export LLAMA_MODEL_DIR=$1
Empty file added dicp/test/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion dicp/test/common/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import parse_bool_arg
from ..common.utils import parse_bool_arg


def pytest_addoption(parser):
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/model/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from common.conftest import pytest_addoption, backend, dynamic # noqa F401
from ..common.conftest import pytest_addoption, backend, dynamic # noqa F401
4 changes: 2 additions & 2 deletions dicp/test/model/llama/generation.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import List

import torch
from model.llama.tokenizer import Tokenizer
from model.llama.model import Transformer, precompute_freqs_cis
from ...model.llama.tokenizer import Tokenizer
from ...model.llama.model import Transformer, precompute_freqs_cis


class LLaMA:
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/model/llama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch
from torch import nn
import torch.nn.functional as F
from common.utils import get_device
from ...common.utils import get_device
device = get_device()


Expand Down
6 changes: 3 additions & 3 deletions dicp/test/model/test_llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import torch
import os
import torch._dynamo as dynamo
from common import utils
from ..common import utils
import torch_dipu
import json
from pathlib import Path
from model.llama.generation import Tokenizer, LLaMA
from model.llama.model import Transformer, ModelArgs
from ..model.llama.generation import Tokenizer, LLaMA
from ..model.llama.model import Transformer, ModelArgs
dynamo.config.cache_size_limit = 128
utils.update_dynamo_config(False)
device = utils.get_device()
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/model/test_resnet50.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import mmcls
from mmcv import Config
from mmcls.models import build_classifier
from common import utils
from ..common import utils
import torch_dipu


Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from common.conftest import pytest_addoption, backend, dynamic # noqa F401
from ..common.conftest import pytest_addoption, backend, dynamic # noqa F401
2 changes: 1 addition & 1 deletion dicp/test/op/test__adaptive_avg_pool2d.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test__adaptive_avg_pool2d_backward.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test__log_softmax.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test__native_batch_norm_legit_functional.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test__softmax.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test__unsafe_view.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_abs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_add.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_alias.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_amax.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_arange.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_bernoulli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
random,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_bmm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_cat.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_clone.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_convert_element_type.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_convolution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_convolution_backward.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_copy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_copy_.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_div.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_embedding.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_empty_like.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_eq.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_exp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_expand.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_fill.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
random,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_full.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
random,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_full_like.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
random,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_gather.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_gelu.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_gelu_backward.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_getitem.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
import operator
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_hardswish.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_hardswish_backward.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_index.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_iota.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_le.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
random,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_lift_fresh_copy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
random,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_log.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
2 changes: 1 addition & 1 deletion dicp/test/op/test_lt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from common.utils import (
from ..common.utils import (
torch,
dynamo,
parse_args,
Expand Down
Loading

0 comments on commit 7bd5c20

Please sign in to comment.