2024年5月10日 星期五

在Kaggle執行PaddleOCR(百度的OCR library)

1.安裝PaddlePaddle
!python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple
2.安裝PaddleOCR whl包
!pip install "paddleocr>=2.0.1"
3.下載測試用圖片(可自定義)
!wget https://paddleocr.bj.bcebos.com/dygraph_v2.1/ppocr_img.zip
4.解壓縮圖片
!unzip ppocr_img.zip
5.執行識別指令
!paddleocr --image_dir <圖片路徑> --use_angle_cls true --use_gpu true

2024年5月6日 星期一

在Kaggle執行QAnything(支援任意格式檔或資料庫的本地知識庫問答系統)

1.複製QAnything倉庫
!git clone -b develop_for_v1.3.1 https://github.com/netease-youdao/QAnything.git
2.切換工作目錄
%cd '/kaggle/working/QAnything'
3.更新Kaggle vllm版本
!pip install vllm -U
4.更新Kaggle pydantic版本
!pip install -U pydantic
5.安裝QAnything所需元件
!pip install -e .
6.安裝ngrok執行檔
 !curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
7.新增ngrok認證token(需預先註冊)
!ngrok config add-authtoken <ngrok認證token>
8.安裝pyngrok
!pip install pyngrok
9.執行完成後會顯示public_url="<公開網址>"

from pyngrok import ngrok, conf

conf.get_default().auth_token = "<ngrok認證token>"
port = "8777"
public_url = ngrok.connect(port).public_url
print(f"public_url=\"{public_url}\"")
10.執行完成後即可連至<公開網址>/qanything/進行知識庫問答
!bash scripts/run_for_3B_in_Linux_or_WSL.sh

2024年4月17日 星期三

LimeSurvey特定問題依其他題目的答案而變更為選填或必填

1.特定問題(本例為Q02意見題)的設定>一般化設置>必填改為'關'(='選填'),用後續的公式來控制'選填'或'必填'。


2.在Q02意見題的設定>邏輯>問題驗證方程式填入驗證公式:

(

Q01 >= 3                                    #當Q01等級大於等於3

or                                                 #或

(Q01 < 3 and !is_empty(Q02))  #當Q01等級小於3 以及 Q02意見題 不得為空

)

並在設定>邏輯>問題驗證提示填入"Q01如果是3顆星以下則此題必填"。



3.當不通過驗證公式時將會無法送出,如下圖:



2024年3月28日 星期四

Docker v.26開啟管理port:2375

官方文件有2種修改方法:

Configuring remote access with systemd unit file

└→不想動到服務設定,不管是docker.service設定檔本身或是override.conf。

Configuring remote access with daemon.json

└→無法啟動服務,因為設定與docker.service設定檔沖突。


解決方法:

編輯/etc/default/docker,新增DOCKER_OPTS="-H tcp://0.0.0.0:2375"

再執行sudo systemctl daemon-reload && sudo systemctl restart docker,

並驗證如下:

$ sudo netstat -lntp | grep dockerd

tcp6       0      0 :::2375                 :::*                    LISTEN      534451/dockerd

2024年3月24日 星期日

Windows 10啟動資料夾路徑

 1.全部使用者:Windows鍵 + R鍵→輸入shell:common startup

或路徑C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

2.個別使用者:Windows鍵 + R鍵→輸入shell:startup

或路徑C:\Users\<使用者帳號>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

2024年3月20日 星期三

Git on Linux: server certificate verification failed. CAfile: none CRLfile: none

 狀況:

在Linux平台使用git push/pull/clone等指令遇到錯誤如下,

SomeUser@SomeServer:~/SomeRepogit pull

fatal: unable to access 'https://mygit.com/SomeRepo.git/': server certificate verification failed. CAfile: none CRLfile: none



解法:

SomeRepo主機SSL憑證上傳至該Linux平台主機存放憑證處即可。

(本例為/etc/ssl/certs/,可用`curl-config --ca`查詢存放處。)

2024年3月19日 星期二

Git on Windows: SSL certificate problem: unable to get local issuer certificate

狀況:

在Windows平台使用git push/pull/clone等指令遇到錯誤如下,

D:\SomeRepo>git pull

fatal: unable to access 'https://mygit.com/SomeRepo.git/': SSL certificate problem: unable to get local issuer certificate


解法:

設定Windows憑證儲存機制即可。

D:\SomeRepo>git config --system http.sslbackend "schannel"