forked from InternLM/lmdeploy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* temp * fix lint * csrc->src * remove clang-format * skip .rst * skip doc * clang-format version version * mat_B
- Loading branch information
Showing
100 changed files
with
3,837 additions
and
3,274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Copyright (c) MegFlow. All rights reserved. | ||
# /bin/python3 | ||
|
||
import argparse | ||
import os | ||
import re | ||
|
||
|
||
def make_parser(): | ||
parser = argparse.ArgumentParser('Doc link checker') | ||
parser.add_argument('--http', | ||
default=False, | ||
type=bool, | ||
help='check http or not ') | ||
parser.add_argument('--target', | ||
default='./docs', | ||
type=str, | ||
help='the directory or file to check') | ||
return parser | ||
|
||
|
||
pattern = re.compile(r'\[.*?\]\(.*?\)') | ||
|
||
|
||
def analyze_doc(home, path): | ||
print('analyze {}'.format(path)) | ||
problem_list = [] | ||
code_block = 0 | ||
with open(path) as f: | ||
lines = f.readlines() | ||
for line in lines: | ||
line = line.strip() | ||
if line.startswith('```'): | ||
code_block = 1 - code_block | ||
|
||
if code_block > 0: | ||
continue | ||
|
||
if '[' in line and ']' in line and '(' in line and ')' in line: | ||
all = pattern.findall(line) | ||
for item in all: | ||
# skip ![]() | ||
if item.find('[') == item.find(']') - 1: | ||
continue | ||
|
||
# process the case [text()]() | ||
offset = item.find('](') | ||
if offset == -1: | ||
continue | ||
item = item[offset:] | ||
start = item.find('(') | ||
end = item.find(')') | ||
ref = item[start + 1:end] | ||
|
||
if ref.startswith('http') or ref.startswith('#'): | ||
continue | ||
if '.md#' in ref: | ||
ref = ref[ref.find('#'):] | ||
fullpath = os.path.join(home, ref) | ||
if not os.path.exists(fullpath): | ||
problem_list.append(ref) | ||
else: | ||
continue | ||
if len(problem_list) > 0: | ||
print(f'{path}:') | ||
for item in problem_list: | ||
print(f'\t {item}') | ||
print('\n') | ||
raise Exception('found link error') | ||
|
||
|
||
def traverse(target): | ||
if os.path.isfile(target): | ||
analyze_doc(os.path.dirname(target), target) | ||
return | ||
for home, dirs, files in os.walk(target): | ||
for filename in files: | ||
if filename.endswith('.md'): | ||
path = os.path.join(home, filename) | ||
if os.path.islink(path) is False: | ||
analyze_doc(home, path) | ||
|
||
|
||
if __name__ == '__main__': | ||
args = make_parser().parse_args() | ||
traverse(args.target) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: lint | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
- name: Install pre-commit hook | ||
run: | | ||
python -m pip install pre-commit | ||
pre-commit install | ||
- name: Linting | ||
run: pre-commit run --all-files | ||
- name: Format c/cuda codes with clang-format | ||
uses: DoozyX/[email protected] | ||
with: | ||
source: src | ||
extensions: h,c,cpp,hpp,cu,cuh | ||
clangFormatVersion: 14 | ||
style: file | ||
- name: Check markdown link | ||
uses: gaurav-nelson/github-action-markdown-link-check@v1 | ||
with: | ||
use-quiet-mode: 'yes' | ||
use-verbose-mode: 'yes' | ||
# check-modified-files-only: 'yes' | ||
config-file: '.github/md-link-config.json' | ||
file-path: './README.md, ./LICENSE, ./README_zh-CN.md' | ||
- name: Check doc link | ||
run: | | ||
python .github/scripts/doc_link_checker.py --target README_zh-CN.md | ||
python .github/scripts/doc_link_checker.py --target README.md | ||
- name: Check docstring coverage | ||
run: | | ||
python -m pip install interrogate | ||
interrogate -v --ignore-init-method --ignore-module --ignore-private --ignore-nested-functions --ignore-nested-classes --fail-under 80 lmdeploy | ||
- name: Check pylint score | ||
run: | | ||
python -m pip install pylint | ||
pylint lmdeploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,5 +78,3 @@ rotary_embedding=128 | |
start_id=1 | ||
end_id=2 | ||
inter_size=22016 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from typing import List | ||
|
||
import fire | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
fire | ||
mmengine | ||
numpy | ||
safetensors | ||
setuptools | ||
tritonclient==2.33.0 | ||
safetensors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.