網頁

2026年11月25日 星期三

改變 Hugging Face 下載的模型與快取檔案存放位置

$ vi .bashrc 加入下列
export HF_HOME=/mnt/C1000SSD/hf_home

$ echo $HF_HOME
/mnt/C1000SSD/hf_home
$ rsync -avh ~/.cache/huggingface/ /mnt/C1000SSD/hf_home/
$ sudo chown -R $USER:$USER /mnt/C1000SSD/hf_home/
$ du -sh $HF_HOME
424M /mnt/C1000SSD/hf_home

$ hf cache ls
$ hf cache prune
$ hf cache rm model/gpt2
$ hf cache verify gpt2

$ find $HF_HOME -name "*.incomplete" -type f -delete

避免 Docker 用光系統碟

固定 USB 外接硬碟掛載點(以 UUID 綁定)
$ lsblk -f
sda1
     ext4   1.0   C1000SSD 7341cc35-6e1f-4b83-812a-fda33db6d52f  453.8G    45% /mnt/C1000SSD
sdb1
     ext4   1.0   480SSD   ea8e0352-cc6a-43c9-817a-1f23cc86499f  416.7G     0% /mnt/480SSD
$ sudo vi /etc/fstab 加入下列兩行
UUID=7341cc35-6e1f-4b83-812a-fda33db6d52f  /mnt/C1000SSD  ext4  defaults,nofail,x-systemd.device-timeout=10  0  2
UUID=ea8e0352-cc6a-43c9-817a-1f23cc86499f  /mnt/480SSD    ext4  defaults,nofail,x-systemd.device-timeout=10  0  2
nofail:若某次開機剛好沒接上其中一顆硬碟,系統仍可正常開機,不會卡在救援模式。
x-systemd.device-timeout=10:裝置未出現時最多等 10 秒就逾時略過,避免開機久等。
$ sudo mount -a
$ systemctl list-units --type=mount | grep mnt-
  mnt-480SSD.mount                                       loaded    active mounted /mnt/480SSD
  mnt-C1000SSD.mount                                     loaded    active mounted /mnt/C1000SSD
$ systemctl show -p DropInPaths docker.service
DropInPaths=/etc/systemd/system/docker.service.d/docker-override.conf
$ cat /etc/systemd/system/docker.service.d/docker-override.conf
[Unit]
After=nvidia-gpu-reset.target mnt-C1000SSD.mount
Wants=nvidia-gpu-reset.target
RequiresMountsFor=/mnt/C1000SSD

docker-override.conf 中使用 RequiresMountsFor=/mnt/C1000SSD
同時確保 /etc/fstab 該掛載列有加上 nofail
避免沒接硬碟時開機卡住,同時 docker.service 也會因掛載條件未滿足而不啟動(或啟動失敗停止),不會把資料寫回系統碟。

$ sudo cat /etc/docker/daemon.json
{
  "data-root": "/mnt/C1000SSD/docker",
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "50m",
    "max-file": "3"
  }
}
$ sudo systemctl stop docker docker.socket containerd
$ sudo mkdir -p /mnt/C1000SSD/docker
$ sudo rsync -aP /var/lib/docker/ /mnt/C1000SSD/docker/
$ sudo mv /var/lib/docker /var/lib/docker.bak
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          5         5         12.09GB   0B (0%)
Containers      5         0         63.1MB    63.1MB (100%)
Local Volumes   10        5         3.86GB    2.628GB (68%)
Build Cache     0         0         0B        0B
$ docker system prune
觀察幾天運作無虞後再執行 sudo rm -rf /var/lib/docker.bak

2026年11月20日 星期五

Cloudflare Tunnel 和 Cloudflare one Client 應用

申請免費 Domain 並用 Cloudflare 代理
https://dashboard.katabump.com/auth/login
ingrenn.kdns.fr 使用 katabump 的 nameservers, 新增 Type:A, Name:@ 的 DNS records

cf-ingrenn.kdns.fr 使用 cloudflare 的 nameservers
Cloudflare 網站選 Domains 按 Add domain, Add a site 要選 Connect a domain, 不是 Transfer a domain
方案選擇 Free
Replace your current nameservers with Cloudflare nameservers(用 Cloudflare 的 nameservers 替換 katabump 的 nameservers)
拷貝 Cloudflare 的 nameservers 到 katabump 的 nameservers

Cloudflare Tunnel 應用
cloudflare 網站 Networking/Overview
Cloudflare Tunnel 按 Create a tunnel
Tunnel name 此名可以自訂
選 Debian 64-bit
依據指示拷貝命令執行 (選擇 Install as service)
$ sudo mkdir -p --mode=0755 /usr/share/keyrings
$ curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
$ echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared any main' | sudo tee /etc/apt/sources.list.d/cloudflared.list
$ sudo apt-get update && sudo apt-get install cloudflared
$ sudo cloudflared service install eyJhIjoiMjFkNjEzNTVhM2ExZTY3ZWQyYjEwYzA5OThmZWM4YmUiLCJ0IjoiODI5Y2M3MGItZDVlZS00ZmI2LWE4ZDgtZGU4NjY1ZDcwN2Q0IiwicyI6IlpEY3laVFZtWVRJdE5EaGpOeTAwWld
$ systemctl status cloudflared

Networking/Tunnels
點入 tunnel 的 configure

Add route: Private hostname 
hostname: 內網主機名稱
注意: split tunnel 需加入 172.64.128.0/20

Add route: Private CIDR
內網主機所在的區網: 192.168.50.0/24

Add a route 選 Published application
www.cf-ingrenn.kdns.fr: http://localhost:80(改成你的 HTTP port)
ssh.cf-ingrenn.kdns.fr: ssh://localhost:22
lssh.cf-ingrenn.kdns.fr: tcp://localhost:22
vnc.cf-ingrenn.kdns.fr: tcp://localhost:5900

C:\Program Files (x86)\cloudflared

在 ~/.ssh/config 或 C:\users/user_name/.ssh\config 加入:
Host ssh.cf-ingrenn.kdns.fr
    ProxyCommand cloudflared access ssh --hostname %h
    User 你的使用者名
C:\>  ssh ssh.cf-ingrenn.kdns.fr

C:\> cloudflared access tcp --hostname lssh.cf-ingrenn.kdns.fr --url localhost:2222
2026-11-12T03:44:44Z INF Start Websocket listener host=localhost:2222
C:\> ssh -p 2222 spark@localhost
注意:上面是 localhost,不是 lssh.cf-ingrenn.kdns.fr

C:\> cloudflared access tcp --hostname vnc.cf-ingrenn.kdns.fr --url localhost:5900
開啟 VNC Viewer, 填入 localhost:5900
注意:上面是 localhost,不是 vnc.cf-ingrenn.kdns.fr

瀏覽器 https://www.cf-ingrenn.kdns.fr 會自動將 http 轉成 https

Cloudflare one Client 應用
跟隨下列網址,設定 team name
https://developers.cloudflare.com/cloudflare-one/setup/
在下列網站選擇不同 OS 的版本客戶端 Cloudflare one Client
https://developers.cloudflare.com/cloudflare-one/team-and-resources/devices/cloudflare-one-client/download/
依據 team name 登入,並連線

兩個客戶端 Cloudflare one Client 直接互聯
Zero Trust/Team & Resources/Devices
按 Management
Mesh connectivity
開啟 Allow all Cloudflare One traffic to reach enrolled devices

客戶端 Cloudflare one Client 連線 Cloudflare Tunnel 和 瀏覽器連線 ssh vnc
Zero Trust/Team & Resources/Devices
按 Device profiles
按 General profiles, 點選正確的 profile
按 Split tunnels
按 Add split tunnel entries
加入 IP 172.64.128.0/20
加入 IP 100.96.0.0/12
加入 Domain *.cf-ingrenn.kdns.fr

Zero Trust/Access controls/Applications
Create Application
Destinations: ssh.cf-ingrenn.kdns.fr
Allow access through browser-based RDP, SSH, or VNC sessions
Select the protocol you want to render in a web browser: SSH
Access policies: Policy details: Include Warp
Accept all available identity providers

Zero Trust/Access controls/Applications
Create Application
Destinations: vnc.cf-ingrenn.kdns.fr
Allow access through browser-based RDP, SSH, or VNC sessions
Select the protocol you want to render in a web browser: VNC
Access policies: Policy details: Include Warp
Accept all available identity providers

Access policies: Policy details: Include Emails username@gmail.com
建議 policy 加入 email, 避免使用 
C:\> cloudflared access tcp --hostname vnc.cf-ingrenn.kdns.fr --url localhost:5900
C:\> cloudflared access tcp --hostname lssh.cf-ingrenn.kdns.fr --url localhost:2222
失效

客戶端安裝並執行 Cloudflare one Client 連線
透過瀏覽器執行
ssh.cf-ingrenn.kdns.fr
vnc.cf-ingrenn.kdns.fr

2026年7月27日 星期一

試著玩轉 comfyui

直到目前還不是我玩轉 comfyui 的時機,沒試過使用計費的 api, 使用在 dgx spark 上執行的 comfyui, 因為還要執行 Qwen3.6-35B-A3B-NVFP4, 所以只使用了 SDXL, 沒有使用 FLUX 1 和 FLUX 2
comfyui 版本更新快,不同版本,有不同的操作方式,不同的名稱,常常需要詢問可能的名稱,甚至需要去嘗試參數的真實作用,每次測試又需要等待長久時間,有影響的參數又非常多,甚至並不是直覺的越大越..., 越小越..., 可能是在中間的某一值,才有效果
一開始我是使用 openclaw 操作 comfyui, 浪費了很多時間才發現 Qwen3.6-35B-A3B-NVFP4 不夠聰明去操作 comfyui, 所以只能手動操作 comfyui, 不懂得問 ai

2026年6月9日 星期二

Open-webui 歷史對話過多,卡死

Admin Panel/Settings/Models
點選 模型 的編輯
點開 Advanced Params
max_tokens: 4096
num_ctx (Ollama): 32768
按 Save & Update

2026年4月27日 星期一

DGX Spark 安裝 faster-qwen3-tts

$ git clone https://github.com/andimarafioti/faster-qwen3-tts.git
$ cd faster-qwen3-tts/
$ uv venv
$ source .venv/bin/activate
$ python -c "import torch; assert torch.cuda.is_available(), 'CUDA not available'; print(f'PyTorch {torch.__version__}, CUDA {torch.version.cuda}, GPU: {torch.cuda.get_device_name(0)}')" || {
    echo ""
    echo "WARNING: CUDA not available. You may need to install a CUDA-enabled PyTorch wheel."
    echo "  uv pip install torch --index-url https://download.pytorch.org/whl/cu128 --python .venv/bin/python"
    echo "  Note: RTX 50xx / Blackwell GPUs need CUDA 12.8 wheels (PyTorch 2.7+)."
}
$ MAX_JOBS=6 uv pip install flash-attn --no-build-isolation
$ python3 -c "import flash_attn; print(f'Flash Attention version: {flash_attn.__version__}')"

$ uv pip install sounddevice
$ faster-qwen3-tts clone \
  --model /mnt/480SSD/models/Qwen3-TTS-12Hz-1.7B-Base \
  --text "你好,這是中英文語音 Zero-shot TTS 測試" \
  --language English \
  --ref-audio ref_audio.wav \
  --ref-text "I'm confused why some people have super short timelines, yet at the same time are bullish on scaling up reinforcement learning atop LLMs. If we're actually close to a human-like learner, then this whole approach of training on verifiable outcomes is doomed." \
  --output out.wav
$ faster-qwen3-tts custom --model /mnt/480SSD/models/Qwen3-TTS-12Hz-1.7B-CustomVoice --list-speakers --text aaa --output out.wav
$ faster-qwen3-tts custom \
  --model /mnt/480SSD/models/Qwen3-TTS-12Hz-1.7B-CustomVoice \
  --speaker aiden \
  --text "你好,這是中英文語音 Zero-shot TTS 測試" \
  --language English \
  --output out.wav
$ uv pip install -e ".[demo]"
$ uv pip install nano_parakeet
$ python demo/server.py --model /mnt/480SSD/models/Qwen3-TTS-12Hz-1.7B-Base
# open http://localhost:7860
$ uv pip install "faster-qwen3-tts[demo]"
$ ffmpeg -i /home/spark/DiskD/audio_llm/audio_openai/audio_openai/audio_files/6551d5b0-e35f-43ee-b262-79c55ad548ea.webm \
  -vn -acodec pcm_s16le -ar 44100 -ac 2 examples/hard_way.wav
$ python examples/openai_server.py \
    --model /mnt/480SSD/models/Qwen3-TTS-12Hz-1.7B-Base \
    --ref-audio examples/hard_way.wav \
    --ref-text "行路難,行路難,多歧路,今安在?長風破浪會有時,直掛雲帆濟滄海。" \
    --language English --port 8102
$ curl http://localhost:8102/v1/audio/speech \
    -H "Content-Type: application/json" \
    -d '{"model": "tts-1", "input": "你好,這是中英文語音 Zero-shot TTS 測試", "voice": "alloy", "response_format": "wav"}' \
    --output speech.wav

2026年4月17日 星期五

DGX Spark 安裝 VibeVoice

https://github.com/microsoft/VibeVoice/tree/main
但發現 TTS (語音合成) 的核心實作代碼已被移除。
https://github.com/vibevoice-community/VibeVoice/tree/main
https://github.com/dontriskit/VibeVoice-FastAPI/tree/main

$ git clone https://github.com/microsoft/VibeVoice.git
$ cd VibeVoice
$ uv venv --python 3.12
$ source .venv/bin/activate
$ vi pyproject.toml 移除 dependencies 下的 torch
$ uv sync
$ uv pip install --force-reinstall torch \
  --index-url https://download.pytorch.org/whl/cu130
$ uv pip install --upgrade setuptools wheel pip ninja
$ MAX_JOBS=2 uv pip install flash-attn --no-build-isolation

microsoft/VibeVoice-ASR

  --model_path microsoft/VibeVoice-Realtime-0.5B \
  --model_path microsoft/VibeVoice-1.5B \ xxx
$ python demo/realtime_model_inference_from_file.py \
  --model_path microsoft/VibeVoice-1.5B \
  --speaker_name Carter \
  --txt_path demo/text_examples/1p_vibevoice.txt

$ vi demo/vibevoice_asr_inference_from_file.py 將 dtype 改成 torch_dtype
        self.model = VibeVoiceASRForConditionalGeneration.from_pretrained(
            model_path,
            dtype=dtype,
            device_map=device if device == "auto" else None,
            attn_implementation=attn_implementation,
            trust_remote_code=True
        )
$ python demo/vibevoice_asr_inference_from_file.py \
  --model_path microsoft/VibeVoice-ASR \
  --audio_files=outputs/1p_vibevoice_generated.wav 


======================================
https://github.com/microsoft/VibeVoice/tree/main
但發現 TTS (語音合成) 的核心實作代碼已被移除。
https://github.com/vibevoice-community/VibeVoice/tree/main
https://github.com/dontriskit/VibeVoice-FastAPI/tree/main

$ git clone https://github.com/vibevoice-community/VibeVoice.git VibeVoice-community
$ cd VibeVoice-community
$ uv venv --python 3.12
$ source .venv/bin/activate
$ vi pyproject.toml 移除 dependencies 下的 torch, requires-python 改成 3.10
$ uv sync
$ uv pip install --force-reinstall torch \
  --index-url https://download.pytorch.org/whl/cu130
$ uv pip install --upgrade setuptools wheel pip ninja
$ MAX_JOBS=4 uv pip install flash-attn --no-build-isolation

#  --model_path vibevoice/VibeVoice-1.5B \
#  --model_path microsoft/VibeVoice-1.5B \ 也可使用
#  多人語音,單 speaker 可以,但多 speaker 會不清楚
$ python demo/inference_from_file.py \
  --model_path /mnt/480SSD/models/VibeVoice-1.5B \
  --speaker_name Xinran \
  --txt_path demo/text_examples/2p_yayi.txt

$ vi vibevoice/modular/modeling_vibevoice_asr.py 將 is_final_chunk 註解掉
                    # Encode chunk for acoustic tokenizer (don't sample yet)
                    acoustic_encoder_output = self.model.acoustic_tokenizer.encode(
                        chunk.unsqueeze(1),
                        cache=acoustic_encoder_cache,
                        sample_indices=sample_indices,
                        use_cache=True,
                        is_final_chunk=is_final,
                    )
                    acoustic_mean_segments.append(acoustic_encoder_output.mean)
                    
                    # Encode chunk for semantic tokenizer (take mean directly)
                    semantic_encoder_output = self.model.semantic_tokenizer.encode(
                        chunk.unsqueeze(1),
                        cache=semantic_encoder_cache,
                        sample_indices=sample_indices,
                        use_cache=True,
                        is_final_chunk=is_final,
                    )
                    semantic_mean_segments.append(semantic_encoder_output.mean)
$ vi vibevoice/modular/modular_vibevoice_text_tokenizer.py
參考 https://github.com/microsoft/VibeVoice/tree/main 的檔案,加入 VibeVoiceASRTextTokenizerFast 部分程式碼

$ python demo/vibevoice_asr_inference_from_file.py \
  --model_path /mnt/480SSD/models/VibeVoice-ASR \
  --audio_files=outputs/2p_yayi_generated.wav

$ python demo/vibevoice_asr_inference_from_file.py \
  --model_path /mnt/480SSD/models/VibeVoice-ASR \
  --audio_files=outputs/1p_Ch2EN_generated.wav

$ python demo/server.py
$ curl http://localhost:8100/v1/models
$ curl http://localhost:8100/v1/audio/voices
$ curl http://localhost:8100/v1/audio/transcriptions \
  -H "Content-Type: multipart/form-data" \
  -F "file=@/home/spark/DiskD/audio_llm/GPT-SoVITS/GPT-SoVITS/samples/output.wav" \
  -F "model=whisper-1"
$ curl http://localhost:8100/v1/audio/speech \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "input": "大家好,今天我們要測試 OpenAI 的語音合成功能。",
    "voice": "Xinran"
  }' \
  --output speech.wav
$ curl http://localhost:8100/v1/audio/voices

==========================================
建立安裝 wheel
$ uv pip install build
$ python -m build --wheel
$ ls dist
$ uv pip install path_to/VibeVoice-community/dist/vibevoice-0.1.0-py3-none-any.whl

$ python demo/tts_server.py