Skip to content

Commit

Permalink
update code-server version
Browse files Browse the repository at this point in the history
  • Loading branch information
jianzfb committed Sep 20, 2024
1 parent 25514de commit 00caa76
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
10 changes: 5 additions & 5 deletions antgo/pipeline/functional/mixins/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ def convert_onnx_to_platform_engine(op_name, op_index, op_args, op_kwargs, outpu

prefix = os.path.basename(onnx_file_path)[:-5]
onnx_dir_path = os.path.dirname(onnx_file_path)
os.system(f'cd /tmp/onnx ; {"docker" if not is_in_colab() else "udocker --allow-root"} run --rm -v $(pwd):/workspace snpeconvert bash convert.sh --i={prefix}.onnx --o=./snpe/{prefix} --quantize --npu --data-folder=calibration-images')
os.system(f'cd /tmp/onnx ; {"docker" if not is_in_colab() else "udocker --allow-root"} run --rm -v $(pwd):/workspace registry.cn-hangzhou.aliyuncs.com/vibstring/snpeconvert:latest bash convert.sh --i={prefix}.onnx --o=./snpe/{prefix} --quantize --npu --data-folder=calibration-images')
converted_model_file = ''
for file_name in os.listdir('/tmp/onnx/snpe/'):
if file_name[0] != '.':
Expand All @@ -1449,7 +1449,7 @@ def convert_onnx_to_platform_engine(op_name, op_index, op_args, op_kwargs, outpu

prefix = os.path.basename(onnx_file_path)[:-5]
onnx_dir_path = os.path.dirname(onnx_file_path)
os.system(f'cd /tmp/onnx ; {"docker" if not is_in_colab() else "udocker --allow-root"} run --rm -v $(pwd):/workspace snpeconvert bash convert.sh --i={prefix}.onnx --o=./snpe/{prefix}')
os.system(f'cd /tmp/onnx ; {"docker" if not is_in_colab() else "udocker --allow-root"} run --rm -v $(pwd):/workspace registry.cn-hangzhou.aliyuncs.com/vibstring/snpeconvert:latest bash convert.sh --i={prefix}.onnx --o=./snpe/{prefix}')
converted_model_file = ''
for file_name in os.listdir('/tmp/onnx/snpe/'):
if file_name[0] != '.':
Expand All @@ -1470,7 +1470,7 @@ def convert_onnx_to_platform_engine(op_name, op_index, op_args, op_kwargs, outpu
onnx_dir_path = os.path.dirname(onnx_file_path)
mean_values = ','.join([str(v) for v in op_kwargs.get('mean')])
std_values = ','.join([str(v) for v in op_kwargs.get('std')])
os.system(f'cd /tmp/onnx ; {"docker" if not is_in_colab() else "udocker --allow-root"} run --rm -v $(pwd):/workspace rknnconvert bash convert.sh --i={prefix}.onnx --quantize --image-folder=./calibration-images --o=./rknn/{prefix} --device={platform_device} --mean-values={mean_values} --std-values={std_values}')
os.system(f'cd /tmp/onnx ; {"docker" if not is_in_colab() else "udocker --allow-root"} run --rm -v $(pwd):/workspace registry.cn-hangzhou.aliyuncs.com/vibstring/rknnconvert:latest bash convert.sh --i={prefix}.onnx --quantize --image-folder=./calibration-images --o=./rknn/{prefix} --device={platform_device} --mean-values={mean_values} --std-values={std_values}')
converted_model_file = ''
for file_name in os.listdir('/tmp/onnx/rknn/'):
if file_name[0] != '.':
Expand All @@ -1487,7 +1487,7 @@ def convert_onnx_to_platform_engine(op_name, op_index, op_args, op_kwargs, outpu
onnx_dir_path = os.path.dirname(onnx_file_path)
mean_values = ','.join([str(v) for v in op_kwargs.get('mean', [0,0,0])])
std_values = ','.join([str(v) for v in op_kwargs.get('std', [1,1,1])])
os.system(f'cd /tmp/onnx ; {"docker" if not is_in_colab() else "udocker --allow-root"} run --rm -v $(pwd):/workspace rknnconvert bash convert.sh --i={prefix}.onnx --o=./rknn/{prefix} --device={platform_device} --mean-values={mean_values} --std-values={std_values}')
os.system(f'cd /tmp/onnx ; {"docker" if not is_in_colab() else "udocker --allow-root"} run --rm -v $(pwd):/workspace registry.cn-hangzhou.aliyuncs.com/vibstring/rknnconvert:latest bash convert.sh --i={prefix}.onnx --o=./rknn/{prefix} --device={platform_device} --mean-values={mean_values} --std-values={std_values}')
converted_model_file = ''
for file_name in os.listdir('/tmp/onnx/rknn/'):
if file_name[0] != '.':
Expand All @@ -1500,7 +1500,7 @@ def convert_onnx_to_platform_engine(op_name, op_index, op_args, op_kwargs, outpu
os.system(f'mkdir /tmp/onnx ; mkdir /tmp/onnx/tnn ; cp {onnx_file_path} /tmp/onnx/')
prefix = os.path.basename(onnx_file_path)[:-5]
onnx_dir_path = os.path.dirname(onnx_file_path)
os.system(f'cd /tmp/onnx/ ; {"docker" if not is_in_colab() else "udocker --allow-root"} run --rm -v $(pwd):/workspace tnnconvert bash convert.sh --i={prefix}.onnx --o=./tnn/{prefix}')
os.system(f'cd /tmp/onnx/ ; {"docker" if not is_in_colab() else "udocker --allow-root"} run --rm -v $(pwd):/workspace registry.cn-hangzhou.aliyuncs.com/vibstring/tnnconvert:latest bash convert.sh --i={prefix}.onnx --o=./tnn/{prefix}')
converted_model_file = []
for file_name in os.listdir('/tmp/onnx/tnn/'):
if file_name[0] != '.' and '.tnnproto' in file_name:
Expand Down
11 changes: 7 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ sudo bash docker/build_dev.sh with-android-ndk with-vscode-server
### 创建运行环境容器
可以直接以命令行方式,运行相关实验
```
# sudo docker run -it --rm --name antgo-env-runtime --shm-size="20G" --gpus all --privileged antgo-env /bin/bash
# docker run -it --rm --shm-size="20G" --gpus all --privileged registry.cn-hangzhou.aliyuncs.com/vibstring/antgo-env-runtime /bin/bash
```

### 创建vscode-server服务
在线IDE环境,运行后你可以访问http://IP:8080,开始在线开发吧
```
sudo docker run --rm -d --name antgo-env-ide --shm-size="20G" -p 8080:8080 -e PASSWORD=123 -v /data:/dataset -v /tmp:/tmp -v $(pwd):/workspace -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker --gpus all,capabilities=video --privileged antgo-env-dev /opt/code-server --host 0.0.0.0 --auth password
docker run -d --shm-size="20G" -p 8080:8080 -e PASSWORD=123 -v /data:/dataset -v /tmp:/tmp -v $(pwd):/workspace -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker --gpus all --privileged registry.cn-hangzhou.aliyuncs.com/vibstring/antgo-env-dev /opt/code-server-4.92.2-linux-amd64/bin/code-server --host 0.0.0.0 --auth password
```


Expand Down Expand Up @@ -64,7 +64,7 @@ no-cgroups = false
然后,重启docker以及容器,
```
sudo systemctl restart docker
sudo docker run --rm -d --name antgo-env-ide -p 8080:8080 -e PASSWORD=123 -v /tmp:/tmp -v $(pwd):/workspace -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker --gpus all --privileged antgo-env-dev /opt/code-server --host 0.0.0.0 --auth password
docker run -d --name antgo-env-ide -p 8080:8080 -e PASSWORD=123 -v /tmp:/tmp -v $(pwd):/workspace -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker --gpus all --privileged antgo-env-dev /opt/code-server --host 0.0.0.0 --auth password
```

3. 如果Code Server页面 对于图片和markdown无法正常预览,可以通过如下方式解决
Expand Down Expand Up @@ -95,4 +95,7 @@ sudo docker run --rm -d --name antgo-env-ide -p 8080:8080 -e PASSWORD=123 -v /tm
* 重新安装 opencv-python
pip install opencv-python
* 安装 opencv-python-headless
pip install opencv-python-headless
pip install opencv-python-headless
6. 遇到编译运行ffmepg问题
启动容器时添加 --gpus all,capabilities=video
6 changes: 3 additions & 3 deletions docker/auto_inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def main():
content = content.strip()

while True:
if content == '# COPY code-server-4.0.2-linux-amd64 /opt/':
cmd_list.append('COPY code-server-4.0.2-linux-amd64 /opt/')
if content == 'COPY code-server-4.0.2-linux-amd64 /opt/':
if content == '# COPY code-server-4.92.2-linux-amd64 /opt/':
cmd_list.append('COPY code-server-4.92.2-linux-amd64 /opt/')
if content == 'COPY code-server-4.92.2-linux-amd64 /opt/':
content = fp.readline()
content = content.strip()
continue
Expand Down
8 changes: 4 additions & 4 deletions docker/build_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ fi

# download vscode-server
if [ "$1"x = "with-vscode-server"x -o "$2"x = "with-vscode-server"x ]; then
if [ ! -d "./code-server-4.0.2-linux-amd64" ];then
if [ ! -f "./code-server-4.0.2-linux-amd64.tar.gz" ];then
wget https://github.com/coder/code-server/releases/download/v4.0.2/code-server-4.0.2-linux-amd64.tar.gz
if [ ! -d "./code-server-4.92.2-linux-amd64" ];then
if [ ! -f "./code-server-4.92.2-linux-amd64.tar.gz" ];then
wget https://github.com/coder/code-server/releases/download/v4.92.2/code-server-4.92.2-linux-amd64.tar.gz
fi
tar -xf code-server-4.0.2-linux-amd64.tar.gz
tar -xf code-server-4.92.2-linux-amd64.tar.gz
fi

# 自动修改Dockerfile
Expand Down
8 changes: 4 additions & 4 deletions docker/build_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ fi

# download vscode-server
if [ "$1"x = "with-vscode-server"x -o "$2"x = "with-vscode-server"x ]; then
if [ ! -d "./code-server-4.0.2-linux-amd64" ];then
if [ ! -f "./code-server-4.0.2-linux-amd64.tar.gz" ];then
wget https://github.com/coder/code-server/releases/download/v4.0.2/code-server-4.0.2-linux-amd64.tar.gz
if [ ! -d "./code-server-4.92.2-linux-amd64" ];then
if [ ! -f "./code-server-4.92.2-linux-amd64.tar.gz" ];then
wget https://github.com/coder/code-server/releases/download/v4.92.2/code-server-4.92.2-linux-amd64.tar.gz
fi
tar -xf code-server-4.0.2-linux-amd64.tar.gz
tar -xf code-server-4.92.2-linux-amd64.tar.gz
fi

# 自动修改Dockerfile
Expand Down

0 comments on commit 00caa76

Please sign in to comment.