show code js

2023年11月9日 星期四

Stable Diffusion for Win & Anaconda

 Install Env AI

  • Clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
    • Download model https://civitai.com/ and move to stable-diffusion-webui\models\Stable-diffusion
  • Download v1-5-pruned-emaonly.ckpt from https://huggingface.co/runwayml/stable-diffusion-v1-5 (use less vram), and move to stable-diffusion-webui\models\Stable-diffusion
  • Settings->Face restoration click GFPGAN
  • Run webui-user.bat
  • Open http://127.0.0.1:7860

Env for AI

 Install Python https://www.python.org/downloads/ (allow use admin and add path)

Install Anaconda https://www.anaconda.com/download

Install pytorch https://pytorch.org/get-started/locally/ find cuda version and dl pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Install Git, Lfs

2023年10月21日 星期六

gpt4all-j and use streamlit

 modify on 2023/10/26

git clone https://github.com/ajvikram/streamlit-gpt.git

cd streamlit-gpt 

create model directory and  download https://gpt4all.io/models/ggml-gpt4all-j.bin in this directory

back to streamlit-gpt directory


run adconda

conda create -n gptj python=='3.11.5'

conda activate -n gptj


pip install -r requirement.txt

streamlit run main.py --server.port=8080 --server.address=0.0.0.0<-your ip

2023年10月17日 星期二

GPT4All test

 Local


  • Website https://github.com/nomic-ai/gpt4all#readme
  • Use conda on win, and git
  • git clone https://github.com/nomic-ai/gpt4all.git
  • down gpt4all-lora-quantized.bin from https://github.com/nomic-ai/gpt4all/issues/246
  • move bin file to gpt4all-training/chat
  • run exe to test

2023年10月3日 星期二

CHT GPT on Local with Win


Note

  • Env
    • install python
    • install Anaconda3, or Miniconda
      • conda update conda
      • conda install pip3
    • install Git, Git LFS
  • Go and Choose https://pytorch.org/get-started/locally/ , Get a url for next
  • Run Anaconda powershell mode
    • pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
  • Create Directory for GPT (ex:GPT)
    • Langchain-Chatchat: git clone https://github.com/chatchat-space/Langchain-Chatchat.git
    • chatglm2-6b: git clone https://huggingface.co/THUDM/chatglm2-6b
    • m3e-base: git clone https://huggingface.co/moka-ai/m3e-base
  • Langchain-Chatchat/configs
    • *.py.example copyto *.py
    • modify server_config.py
      DEFAULT_BIND_HOST = "your ip"
    • modify model_config.py
      find: modify:embedding_model_dict = {
      "m3e-base": "/your_path/GPT/m3e-base",
      check: EMBEDDING_MODEL = "m3e-base"
      find: modify:llm_model_dict = { "chatglm2-6b": {
      "local_model_path": "/your_path/GPT/chatglm2-6b",
      check: modify:LLM_MODEL = "chatglm2-6b"
  • install Langchain-Chatchat and Run (Anaconda powershell mode)
    cd Langchain-Chatchat
    conda create -n Chatchat python==3.10
    conda active Chatchat
    pip3 install -r requirements.txt
    python init_database.py --recreate-vs (for first)
  • run Langchain-Chatchat
    python startup.py -a (Run All)[Input Email for first, and active service]
  • Check
    • Firewall pass python
    • Firewall pass 8501/TCP
  • INFO
    https://zhuanlan.zhihu.com/p/645807338?utm_id=0
    https://zhuanlan.zhihu.com/p/652530137
    https://zhuanlan.zhihu.com/p/617208490
    https://zhuanlan.zhihu.com/p/630049721?utm_id=0

2023年2月9日 星期四

BCD rebuild 0xc000000e

  • use rufus create usb win os
  • use this usb to start and into fix your computer
  • open cmd mode, start fix
    • diskpart
      • list disk
      • select disk 0 (target disk)
      • list volume
      • select volume 4 (target area, FAT32)
      • assign letter Z
      • exit
    • rd /s /q “Z:\EFI\”
    • bootrec /fixboot 
    • bcdboot “C:\Windows” /l zh-tw /s Z: /f UEFI
    • reboot and start your os on hdd
  • if happen access is denied, keep in cmd mode
    • format Z: /FS:FAT32 /y
    • bcdboot "C:\Windows" /s Z: /f UEFI /l zh-tw
    • reboot and start your os on hdd

link: https://thinker-evans.blogspot.com/2020/02/windows-10-uefi-bootloaderwindows-10.html

2023年2月3日 星期五

fail2ban for xrdp

 jail.conf

[rdp]

enabled = true

filter = rdp

action = iptables-multiport[name=rdp, port="3389", protocol=tcp]

logpath = /var/log/xrdp.log

maxretry = 5


filter.d/rdp.conf

[Definition]

failregex = connection received from <HOST>

ignoreregex =

datepattern = %%Y%%m%%d-%%H:%%M:%%S


link: https://stackoverflow.com/questions/65491510/regexp-for-fail2ban-for-xrdp-log


jail.local

[rdp]

enabled  = true

port     = rdp

filter   = rdp

logpath = /var/log/xrdp.log

maxretry = 5

findtime = 1d

bantime  = 1d

2023年2月2日 星期四

iredadmin Internal Server Error

 pip3 install web.py

restart 

centos steam iredmail

del pem to create new

amavisd -c /etc/amavisd/amavisd.conf genrsa /var/lib/dkim/domain.com.pem 1024

chown amavis:amavis /var/lib/dkim/domain.com.pem

chmod 0400 /var/lib/dkim/domain.com.pem

amavisd -c /etc/amavisd/amavisd.conf showkeys

amavisd -c /etc/amavisd/amavisd.conf testkeys

centos 8 to steam

 sudo dnf update

sudo dnf in centos-release-stream

sudo dnf repolist

sudo dnf distro-sync

cat /etc/centos-release

reboot

dnf yum update


link: https://www.cyberciti.biz/howto/upgrade-migrate-from-centos-8-to-centos-stream-conversion/

centos rdp

for centos 8


sudo dnf groupinstall "Server with GUI"

sudo dnf install epel-release

sudo dnf install xrdp

sudo systemctl enable xrdp --now

sudo systemctl status xrdp

sudo firewall-cmd --add-port=3389/tcp --permanent

sudo firewall-cmd --reload

Change Port: /etc/xrpd/xrdp.ini and restat service

link: https://www.myfreax.com/how-to-install-xrdp-on-centos-8/

Centos not support for update/upgrade

 INFO: Error: Failed to download metadata for repo 'AppStream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

Run:

  • sudo sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
  • sudo sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
  • link: https://www.cnblogs.com/axinno1/p/15884647.html
or
  • sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
  • sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
  • link: https://www.tecmint.com/error-failed-to-download-metadata-for-repo-appstream/