Skip to content

Commit

Permalink
Merge branch 'hidet-org:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
BolinSNLHM committed Apr 4, 2024
2 parents 65fc51b + 531b8d3 commit 3447b84
Show file tree
Hide file tree
Showing 66 changed files with 1,809 additions and 314 deletions.
2 changes: 1 addition & 1 deletion .github/requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mysql-connector-python
transformers
transformers==4.37
accelerate
sentencepiece
59 changes: 0 additions & 59 deletions .github/scripts/bench/bench_transformer.py

This file was deleted.

44 changes: 0 additions & 44 deletions .github/scripts/bench/bench_utils.py

This file was deleted.

52 changes: 0 additions & 52 deletions .github/scripts/bench/bench_vision.py

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
format-and-lint:
if: github.repository == 'hidet-org/hidet'
if: github.repository == 'hidet-org/hidet' || github.repository == 'CentML/hidet'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
Expand Down
32 changes: 18 additions & 14 deletions .github/workflows/regression.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1

- name: Upload run configs
uses: actions/upload-artifact@v3
with:
name: run_configs
path: run_configs.json
retention-days: 1
#- name: Upload run configs
# uses: actions/upload-artifact@v3
# with:
# name: run_configs
# path: run_configs.json
# retention-days: 1

run_tests:
needs: start_instances
Expand Down Expand Up @@ -85,12 +85,16 @@ jobs:
path: models
ref: ci

- name: Download run configs
uses: actions/download-artifact@v3
with:
name: run_configs
path: ./mount

#- name: Download run configs
# uses: actions/download-artifact@v3
# with:
# name: run_configs
# path: ./mount

# Put run_configs.json in shared folder. Intup and output of tests is saved in it.
- name: Copy run_config.json
run: cp hidet/tests/benchmarks/run_configs.json ./mount

# Build the image
- name: Build docker image from base image
run: docker build -t hidet-ci -f hidet/.github/Dockerfile .
Expand All @@ -105,7 +109,7 @@ jobs:
-e HW_CONFIG -e REPO_NAME -e REPO_BRANCH -e CI_CS_HOSTNAME -e CI_CS_PORT
-e CI_CS_USERNAME -e CI_CS_PASSWORD -e HF_TOKEN
-v ./mount:/workspace/mount
hidet-ci python hidet/.github/scripts/run_tests.py --configs /workspace/mount/run_configs.json'
hidet-ci python hidet/tests/benchmarks/run_tests.py --configs /workspace/mount/run_configs.json'
env:
HW_CONFIG: ${{ matrix.hw_configs }}
REPO_NAME: ${{ inputs.source_repo == 'this' && github.repository || inputs.source_repo }}
Expand Down Expand Up @@ -162,7 +166,7 @@ jobs:
CI_DB_PASSWORD: ${{ secrets.CI_DB_PASSWORD }}

stop_instances:
if: inputs.shutdown_instances
if: ${{ always() && inputs.shutdown_instances }}
runs-on: ubuntu-latest
needs: [start_instances, run_tests]
steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:

- name: Run tests
run: |
rm -rf ~/.config/hidet
python -m pytest -v --durations=20 --clear-cache ./tests
# Build the docs
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# Ignore VSCode files
.vscode/*

# pycharm line profiler result
**/*.pclprof

Expand Down Expand Up @@ -213,3 +216,6 @@ build-release

# experiments folder
/experiments

# vscode
.vscode
4 changes: 2 additions & 2 deletions apps/compile_server/resources/compile_worker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, Any, List, Tuple
from typing import Dict, Any, List, Tuple, Sequence, Union
import os
import traceback
import argparse
Expand Down Expand Up @@ -51,7 +51,7 @@ def compile_job(job_id: str):

# load the workload
workload: Dict[str, Any] = pickle.loads(job['workload'])
ir_module: hidet.ir.IRModule = workload['ir_module']
ir_module: Union[hidet.ir.IRModule, Sequence[hidet.ir.IRModule]] = workload['ir_module']
target: str = workload['target']
output_kind: str = workload['output_kind']

Expand Down
7 changes: 7 additions & 0 deletions python/hidet/apps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .pretrained import PretrainedModel

# from .pipeline import Pipeline
from .registry import Registry, RegistryEntry

# from .processing import BaseProcessor
5 changes: 4 additions & 1 deletion python/hidet/apps/compile_server/compilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Sequence, Union
import zipfile
import shutil
import tempfile
Expand All @@ -21,7 +22,9 @@
from .core import api_url, access_token


def remote_build(ir_module: IRModule, output_dir: str, *, target: str, output_kind: str = '.so'):
def remote_build(
ir_module: Union[IRModule, Sequence[IRModule]], output_dir: str, *, target: str, output_kind: str = '.so'
):
# upload the IRModule
if 'cuda' in target:
if 'arch' not in target:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from hidet.graph import nn
from hidet.graph.tensor import Tensor


class Downsample2D(nn.Module):
def __init__(self, channels: int, **kwargs):
super().__init__()

self.channels = channels
self.out_channels = kwargs.get("output_channels", None) or channels

self.conv = nn.Conv2d(
self.channels, self.out_channels, kernel_size=3, stride=2, padding=kwargs["downsample_padding"], bias=True
)

def forward(self, hidden_states: Tensor) -> Tensor:
assert hidden_states.shape[1] == self.channels

return self.conv(hidden_states)
Loading

0 comments on commit 3447b84

Please sign in to comment.