v0.0.0-20240926 #46
Workflow file for this run
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
name: Windows Pack | |
on: | |
release: | |
types: [created] | |
env: | |
HF_HOME: MaterialSearchWindows/huggingface | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: MaterialSearchWindows | |
- name: Download Python | |
run: Invoke-WebRequest "https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip" -OutFile python.zip | |
- name: Unzip Python | |
run: Expand-Archive python.zip -DestinationPath MaterialSearchWindows | |
- name: Fix python310._pth | |
uses: DamianReeves/write-file-action@master | |
with: | |
path: MaterialSearchWindows/python310._pth | |
write-mode: append | |
contents: | | |
import site | |
- name: Download FFMpeg | |
run: Invoke-WebRequest "https://github.com/GyanD/codexffmpeg/releases/download/7.0/ffmpeg-7.0-full_build.zip" -OutFile ffmpeg.zip | |
- name: Unzip FFMpeg | |
run: Expand-Archive ffmpeg.zip -DestinationPath . | |
- name: Copy FFMpeg | |
run: cp ffmpeg-7.0-full_build/bin/ffmpeg.exe MaterialSearchWindows | |
- name: Download pip | |
run: Invoke-WebRequest "https://bootstrap.pypa.io/pip/pip.pyz" -OutFile MaterialSearchWindows/pip.pyz | |
- name: Install requirements | |
run: MaterialSearchWindows/python.exe MaterialSearchWindows/pip.pyz install -r MaterialSearchWindows/requirements.txt # --index-url=https://download.pytorch.org/whl/cu118 --extra-index-url=https://pypi.org/simple/ | |
- name: Download model | |
run: MaterialSearchWindows/python.exe -c 'from transformers import AutoModelForZeroShotImageClassification, AutoProcessor; AutoModelForZeroShotImageClassification.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16"); AutoProcessor.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16");' | |
- name: Create .env | |
uses: DamianReeves/write-file-action@master | |
with: | |
path: MaterialSearchWindows/.env | |
write-mode: overwrite | |
contents: | | |
# 下面添加扫描路径,用逗号分隔 | |
ASSETS_PATH=C:\Users\Administrator\Pictures,C:\Users\Administrator\Videos | |
# 下面填写扫描设备,cpu或cuda(cuda会使用NVIDIA显卡进行加速)。注意:NVIDIA显卡才能选cuda,并且请先运行"CUDA加速安装.bat",等下载安装完毕之后再重新运行“run.bat”。AMD显卡不支持加速。 | |
DEVICE=cpu | |
DEVICE_TEXT=cpu | |
# 下面的不要改 | |
TRANSFORMERS_OFFLINE=1 | |
HF_HUB_OFFLINE=1 | |
HF_HOME=huggingface | |
- name: Create CUDA加速安装.bat | |
uses: DamianReeves/write-file-action@master | |
with: | |
path: MaterialSearchWindows/CUDA加速安装.bat | |
write-mode: overwrite | |
contents: | | |
.\python.exe pip.pyz install -U "torch>=2.0,<2.4" --index-url=https://download.pytorch.org/whl/cu118 | |
PAUSE | |
- name: Create run.bat | |
uses: DamianReeves/write-file-action@master | |
with: | |
path: MaterialSearchWindows/run.bat | |
write-mode: overwrite | |
contents: | | |
.\python.exe main.py | |
PAUSE | |
- name: Create 使用说明.txt | |
uses: DamianReeves/write-file-action@master | |
with: | |
path: MaterialSearchWindows/使用说明.txt | |
write-mode: overwrite | |
contents: | | |
!!!注意:如果你的电脑本来已经装过其它整合包(如 Stable Diffusion 等),可能会导致python环境冲突,进而使得本整合包无法使用。如遇到这种情况,请清理之前的环境,或者尝试双击“install.bat”更新环境。 | |
如果你是NVIDIA显卡且想使用显卡加速,则请先双击运行“CUDA加速安装.bat”。如果你是用AMD显卡,或者不想用显卡加速,则跳过这一步。 | |
右键“.env”文件进行编辑,配置扫描路径和设备,然后保存。 | |
最后双击运行“run.bat”即可,待看到"http://127.0.0.1:8085"的输出就可以浏览器打开对应链接进行使用。 | |
关闭“run.bat”的运行框即关闭程序。 | |
本软件是开源软件,免费下载使用,不用付款购买,切勿上当受骗! | |
最新版本下载和详细使用说明请看:https://github.com/chn-lee-yumi/MaterialSearch | |
- name: Download 7zr | |
run: Invoke-WebRequest "https://www.7-zip.org/a/7zr.exe" -OutFile 7zr.exe | |
- name: Compress (has bug) | |
run: Compress-Archive -CompressionLevel NoCompression -LiteralPath MaterialSearchWindows -DestinationPath MaterialSearchWindows.zip | |
# 下载模型的时候snapshot是链接到blobs的,但压缩的时候会将blobs和snapshot都压缩一次,导致解压后模型变成双倍大小。下面是临时解决办法,不过有点bug(目录不对),所以暂时不解决。 | |
- name: Unzip (solve zip issue) | |
run: Expand-Archive MaterialSearchWindows.zip -DestinationPath MaterialSearch_tmp; rm MaterialSearchWindows.zip; rm -r MaterialSearch_tmp/MaterialSearchWindows/huggingface/hub/models--OFA-Sys--chinese-clip-vit-base-patch16/blobs | |
# 改用7z压缩,提高压缩率 | |
- name: Compress (solve zip issue) | |
run: cd MaterialSearch_tmp; ../7zr.exe a ../MaterialSearchWindows.7z MaterialSearchWindows | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: MaterialSearchWindows.7z | |