end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

huggingfaceの modelを localにダウンロード

proxy配下で SentenceTransformer(model_name, device="cpu") したところ、 ssl errorとなった為、事前ダウンロードする為。

import httpx
from huggingface_hub import snapshot_download
from huggingface_hub import set_client_factory

def client_factory():
    return httpx.Client(verify=False)

set_client_factory(client_factory)

snapshot_download(
    repo_id="hotchpotch/static-embedding-japanese",
    local_dir="hf_models/static-embedding-japanese",
)

snapshot_download(
    repo_id="hotchpotch/japanese-reranker-cross-encoder-small-v1",
    local_dir="hf_models/japanese-reranker-cross-encoder-small-v1",
)