{"id":82829,"date":"2026-07-25T13:09:31","date_gmt":"2026-07-25T05:09:31","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/82829.html"},"modified":"2026-07-25T13:09:31","modified_gmt":"2026-07-25T05:09:31","slug":"qwen3-reranker-0-6b%e9%83%a8%e7%bd%b2%e6%95%99%e7%a8%8b%ef%bc%9aarm%e6%9e%b6%e6%9e%84%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%88%e5%a6%82mac-m2-m3%ef%bc%89%e9%80%82%e9%85%8d%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/82829.html","title":{"rendered":"Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b\uff1aARM\u67b6\u6784\u670d\u52a1\u5668\uff08\u5982Mac M2\/M3\uff09\u9002\u914d\u6307\u5357"},"content":{"rendered":"<h2>Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b&#xff1a;ARM\u67b6\u6784\u670d\u52a1\u5668&#xff08;\u5982Mac M2\/M3&#xff09;\u9002\u914d\u6307\u5357<\/h2>\n<h3>1. \u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u5728ARM\u67b6\u6784\u4e0a\u90e8\u7f72\u91cd\u6392\u5e8f\u6a21\u578b&#xff1f;<\/h3>\n<p>\u5982\u679c\u4f60\u624b\u5934\u6709\u4e00\u53f0MacBook&#xff0c;\u7279\u522b\u662f\u642d\u8f7d\u4e86M2\u6216M3\u82af\u7247\u7684\u578b\u53f7&#xff0c;\u4f60\u53ef\u80fd\u4f1a\u53d1\u73b0\u5f88\u591aAI\u6a21\u578b\u90e8\u7f72\u6559\u7a0b\u90fd\u662f\u9488\u5bf9x86\u67b6\u6784\u7684&#xff0c;\u7528\u8d77\u6765\u603b\u662f\u4e0d\u592a\u987a\u624b\u3002\u4eca\u5929&#xff0c;\u6211\u4eec\u5c31\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<p>Qwen3-Reranker-0.6B\u662f\u901a\u4e49\u5343\u95ee\u6700\u65b0\u63a8\u51fa\u7684\u91cd\u6392\u5e8f\u6a21\u578b&#xff0c;\u4e13\u95e8\u7528\u6765\u7ed9\u641c\u7d22\u7ed3\u679c\u201c\u6253\u5206\u6392\u961f\u201d\u3002\u60f3\u8c61\u4e00\u4e0b&#xff0c;\u4f60\u641c\u7d22\u201c\u5982\u4f55\u505a\u7ea2\u70e7\u8089\u201d&#xff0c;\u641c\u7d22\u5f15\u64ce\u8fd4\u56de\u4e86100\u4e2a\u7ed3\u679c&#xff0c;\u8fd9\u4e2a\u6a21\u578b\u80fd\u5e2e\u4f60\u5224\u65ad\u54ea\u4e2a\u83dc\u8c31\u6700\u9760\u8c31\u3001\u54ea\u4e2a\u89c6\u9891\u8bb2\u89e3\u6700\u8be6\u7ec6&#xff0c;\u7136\u540e\u6309\u76f8\u5173\u6027\u91cd\u65b0\u6392\u5e8f\u3002<\/p>\n<p>\u4f46\u95ee\u9898\u662f&#xff0c;\u5b98\u65b9\u6587\u6863\u901a\u5e38\u9ed8\u8ba4\u4f60\u5728x86\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u3002\u5982\u679c\u4f60\u7528\u7684\u662fMac M\u7cfb\u5217\u7535\u8111&#xff0c;\u6216\u8005\u6811\u8393\u6d3e\u8fd9\u7c7bARM\u67b6\u6784\u7684\u8bbe\u5907&#xff0c;\u76f4\u63a5\u7167\u642c\u6559\u7a0b\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u517c\u5bb9\u6027\u95ee\u9898\u3002\u8fd9\u7bc7\u6587\u7ae0\u5c31\u662f\u4e3a\u4f60\u51c6\u5907\u7684\u2014\u2014\u6211\u4f1a\u624b\u628a\u624b\u5e26\u4f60\u5b8c\u6210\u5728ARM\u67b6\u6784\u4e0a\u7684\u5b8c\u6574\u90e8\u7f72&#xff0c;\u8ba9\u4f60\u5728\u81ea\u5df1\u7684\u8bbe\u5907\u4e0a\u4e5f\u80fd\u987a\u7545\u4f7f\u7528\u8fd9\u4e2a\u5f3a\u5927\u7684\u91cd\u6392\u5e8f\u5de5\u5177\u3002<\/p>\n<h3>2. ARM\u67b6\u6784\u90e8\u7f72\u524d\u7684\u51c6\u5907\u5de5\u4f5c<\/h3>\n<h4>2.1 \u786e\u8ba4\u4f60\u7684\u8bbe\u5907\u73af\u5883<\/h4>\n<p>\u5728\u5f00\u59cb\u4e4b\u524d&#xff0c;\u6211\u4eec\u5148\u786e\u8ba4\u4e00\u4e0b\u73af\u5883\u3002\u6253\u5f00\u4f60\u7684\u7ec8\u7aef&#xff0c;\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<p># \u67e5\u770b\u7cfb\u7edf\u67b6\u6784<br \/>\nuname -m<\/p>\n<p># \u67e5\u770bPython\u7248\u672c<br \/>\npython3 &#8211;version<\/p>\n<p># \u67e5\u770bpip\u7248\u672c<br \/>\npip3 &#8211;version<\/p>\n<p>\u4f60\u5e94\u8be5\u4f1a\u770b\u5230\u7c7b\u4f3c\u8fd9\u6837\u7684\u8f93\u51fa&#xff1a;<\/p>\n<ul>\n<li>\u67b6\u6784\u663e\u793a&#xff1a;arm64&#xff08;Mac M\u7cfb\u5217&#xff09;\u6216 aarch64&#xff08;\u5176\u4ed6ARM\u8bbe\u5907&#xff09;<\/li>\n<li>Python\u7248\u672c&#xff1a;\u6700\u597d\u662f3.8\u6216\u66f4\u9ad8&#xff0c;\u63a8\u83503.10<\/li>\n<li>pip\u7248\u672c&#xff1a;\u786e\u4fdd\u662f\u6700\u65b0\u7684<\/li>\n<\/ul>\n<p>\u5982\u679c\u4f60\u7684Python\u7248\u672c\u4f4e\u4e8e3.8&#xff0c;\u9700\u8981\u5148\u5347\u7ea7\u3002\u5728Mac\u4e0a&#xff0c;\u53ef\u4ee5\u7528Homebrew&#xff1a;<\/p>\n<p># \u5b89\u88c5\u6216\u5347\u7ea7Python<br \/>\nbrew install python&#064;3.10<\/p>\n<h4>2.2 \u4e0b\u8f7d\u6a21\u578b\u6587\u4ef6<\/h4>\n<p>Qwen3-Reranker-0.6B\u6a21\u578b\u5927\u5c0f\u7ea61.2GB&#xff0c;\u6211\u4eec\u9700\u8981\u5148\u4e0b\u8f7d\u5230\u672c\u5730\u3002\u8fd9\u91cc\u63d0\u4f9b\u4e24\u79cd\u65b9\u5f0f&#xff1a;<\/p>\n<p>\u65b9\u5f0f\u4e00&#xff1a;\u4f7f\u7528Hugging Face CLI&#xff08;\u63a8\u8350&#xff09;<\/p>\n<p># \u5b89\u88c5huggingface-hub<br \/>\npip3 install huggingface-hub<\/p>\n<p># \u4e0b\u8f7d\u6a21\u578b<br \/>\npython3 -c &#034;from huggingface_hub import snapshot_download; snapshot_download(repo_id&#061;&#039;Qwen\/Qwen3-Reranker-0.6B&#039;, local_dir&#061;&#039;.\/Qwen3-Reranker-0.6B&#039;)&#034;<\/p>\n<p>\u65b9\u5f0f\u4e8c&#xff1a;\u624b\u52a8\u4e0b\u8f7d<\/p>\n<p>\u5982\u679c\u4f60\u7f51\u7edc\u73af\u5883\u7279\u6b8a&#xff0c;\u4e5f\u53ef\u4ee5\u4ece\u955c\u50cf\u7ad9\u4e0b\u8f7d&#xff1a;<\/p>\n<li>\u8bbf\u95eeHugging Face\u7684Qwen\u9875\u9762<\/li>\n<li>\u627e\u5230Qwen3-Reranker-0.6B\u6a21\u578b<\/li>\n<li>\u4e0b\u8f7d\u6240\u6709\u6587\u4ef6\u5230\u672c\u5730\u76ee\u5f55<\/li>\n<p>\u4e0b\u8f7d\u5b8c\u6210\u540e&#xff0c;\u4f60\u7684\u76ee\u5f55\u7ed3\u6784\u5e94\u8be5\u662f\u8fd9\u6837\u7684&#xff1a;<\/p>\n<p>Qwen3-Reranker-0.6B\/<br \/>\n\u251c\u2500\u2500 config.json<br \/>\n\u251c\u2500\u2500 model.safetensors<br \/>\n\u251c\u2500\u2500 tokenizer.json<br \/>\n\u251c\u2500\u2500 tokenizer_config.json<br \/>\n\u2514\u2500\u2500 &#8230;\u5176\u4ed6\u914d\u7f6e\u6587\u4ef6<\/p>\n<h4>2.3 \u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56<\/h4>\n<p>ARM\u67b6\u6784\u4e0a\u5b89\u88c5PyTorch\u9700\u8981\u7279\u522b\u6ce8\u610f\u3002PyTorch\u5b98\u65b9\u4e3aARM\u63d0\u4f9b\u4e86\u9884\u7f16\u8bd1\u7248\u672c&#xff0c;\u4f46\u9700\u8981\u6307\u5b9a\u6b63\u786e\u7684\u7248\u672c\u3002<\/p>\n<p># \u9996\u5148\u5347\u7ea7pip<br \/>\npip3 install &#8211;upgrade pip<\/p>\n<p># \u5b89\u88c5PyTorch&#xff08;ARM\u517c\u5bb9\u7248\u672c&#xff09;<br \/>\n# \u5bf9\u4e8eMac M\u7cfb\u5217&#xff0c;\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4&#xff1a;<br \/>\npip3 install torch torchvision torchaudio<\/p>\n<p># \u5bf9\u4e8e\u5176\u4ed6ARM\u8bbe\u5907&#xff08;\u5982\u6811\u8393\u6d3e&#xff09;&#xff0c;\u53ef\u80fd\u9700\u8981\u4ece\u6e90\u7801\u7f16\u8bd1<br \/>\n# \u4f46\u901a\u5e38PyTorch\u5b98\u65b9\u4e5f\u63d0\u4f9bARM\u7248\u672c&#xff0c;\u53ef\u4ee5\u5148\u5c1d\u8bd5&#xff1a;<br \/>\npip3 install torch<\/p>\n<p># \u5b89\u88c5\u5176\u4ed6\u4f9d\u8d56<br \/>\npip3 install transformers&gt;&#061;4.51.0<br \/>\npip3 install gradio&gt;&#061;4.0.0<br \/>\npip3 install accelerate safetensors sentencepiece<\/p>\n<p>\u91cd\u8981\u63d0\u793a&#xff1a;\u5982\u679c\u5728\u5b89\u88c5PyTorch\u65f6\u9047\u5230\u95ee\u9898&#xff0c;\u53ef\u4ee5\u8bbf\u95eePyTorch\u5b98\u7f51&#xff0c;\u9009\u62e9\u5bf9\u5e94\u7684ARM\u7248\u672c\u83b7\u53d6\u5b89\u88c5\u547d\u4ee4\u3002<\/p>\n<h3>3. \u521b\u5efa\u9002\u914dARM\u67b6\u6784\u7684\u90e8\u7f72\u811a\u672c<\/h3>\n<h4>3.1 \u7f16\u5199\u542f\u52a8\u811a\u672c<\/h4>\n<p>\u5728\u6a21\u578b\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2astart.sh\u6587\u4ef6&#xff1a;<\/p>\n<p>#!\/bin\/bash<\/p>\n<p># Qwen3-Reranker-0.6B ARM\u67b6\u6784\u542f\u52a8\u811a\u672c<br \/>\n# \u9002\u7528\u4e8eMac M1\/M2\/M3\u53caARM\u670d\u52a1\u5668<\/p>\n<p>echo &#034;\u6b63\u5728\u542f\u52a8 Qwen3-Reranker-0.6B \u670d\u52a1&#8230;&#034;<\/p>\n<p># \u68c0\u67e5Python\u7248\u672c<br \/>\npython_version&#061;$(python3 -c &#039;import sys; print(f&#034;{sys.version_info.major}.{sys.version_info.minor}&#034;)&#039;)<br \/>\necho &#034;Python\u7248\u672c: $python_version&#034;<\/p>\n<p>if [[ $(echo &#034;$python_version &lt; 3.8&#034; | bc) -eq 1 ]]; then<br \/>\n    echo &#034;\u9519\u8bef: Python\u7248\u672c\u9700\u89813.8\u6216\u66f4\u9ad8&#034;<br \/>\n    exit 1<br \/>\nfi<\/p>\n<p># \u68c0\u67e5\u5fc5\u8981\u4f9d\u8d56<br \/>\necho &#034;\u68c0\u67e5\u4f9d\u8d56&#8230;&#034;<br \/>\nfor package in torch transformers gradio accelerate; do<br \/>\n    if ! python3 -c &#034;import $package&#034; 2&gt;\/dev\/null; then<br \/>\n        echo &#034;\u7f3a\u5c11\u4f9d\u8d56: $package&#034;<br \/>\n        echo &#034;\u6b63\u5728\u5b89\u88c5&#8230;&#034;<br \/>\n        pip3 install $package<br \/>\n    fi<br \/>\ndone<\/p>\n<p># \u8bbe\u7f6e\u73af\u5883\u53d8\u91cf&#xff08;\u9488\u5bf9ARM\u4f18\u5316&#xff09;<br \/>\nexport PYTORCH_ENABLE_MPS_FALLBACK&#061;1  # \u5141\u8bb8MPS\u56de\u9000\u5230CPU<br \/>\nexport GRADIO_SERVER_PORT&#061;7860        # \u8bbe\u7f6e\u7aef\u53e3<\/p>\n<p># \u542f\u52a8\u670d\u52a1<br \/>\necho &#034;\u542f\u52a8Web\u670d\u52a1&#8230;&#034;<br \/>\necho &#034;\u670d\u52a1\u5c06\u5728 http:\/\/localhost:7860 \u53ef\u7528&#034;<br \/>\necho &#034;\u6309 Ctrl&#043;C \u505c\u6b62\u670d\u52a1&#034;<\/p>\n<p>python3 app.py<\/p>\n<p>\u7ed9\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650&#xff1a;<\/p>\n<p>chmod &#043;x start.sh<\/p>\n<h4>3.2 \u7f16\u5199\u4e3b\u7a0b\u5e8f\u6587\u4ef6<\/h4>\n<p>\u521b\u5efaapp.py\u6587\u4ef6&#xff0c;\u8fd9\u662fWeb\u670d\u52a1\u7684\u6838\u5fc3&#xff1a;<\/p>\n<p>#!\/usr\/bin\/env python3<br \/>\n# -*- coding: utf-8 -*-<br \/>\n&#034;&#034;&#034;<br \/>\nQwen3-Reranker-0.6B Web\u670d\u52a1<br \/>\nARM\u67b6\u6784\u9002\u914d\u7248\u672c<br \/>\n&#034;&#034;&#034;<\/p>\n<p>import os<br \/>\nimport sys<br \/>\nimport torch<br \/>\nimport gradio as gr<br \/>\nfrom transformers import AutoModelForSequenceClassification, AutoTokenizer<br \/>\nimport logging<\/p>\n<p># \u8bbe\u7f6e\u65e5\u5fd7<br \/>\nlogging.basicConfig(level&#061;logging.INFO)<br \/>\nlogger &#061; logging.getLogger(__name__)<\/p>\n<p>def check_arm_environment():<br \/>\n    &#034;&#034;&#034;\u68c0\u67e5ARM\u73af\u5883\u5e76\u4f18\u5316\u8bbe\u7f6e&#034;&#034;&#034;<br \/>\n    logger.info(&#034;\u68c0\u67e5\u8fd0\u884c\u73af\u5883&#8230;&#034;)<\/p>\n<p>    # \u68c0\u67e5\u67b6\u6784<br \/>\n    import platform<br \/>\n    arch &#061; platform.machine()<br \/>\n    logger.info(f&#034;\u7cfb\u7edf\u67b6\u6784: {arch}&#034;)<\/p>\n<p>    # ARM\u67b6\u6784\u7279\u5b9a\u4f18\u5316<br \/>\n    if arch in [&#039;arm64&#039;, &#039;aarch64&#039;]:<br \/>\n        logger.info(&#034;\u68c0\u6d4b\u5230ARM\u67b6\u6784&#xff0c;\u8fdb\u884c\u4f18\u5316\u8bbe\u7f6e&#034;)<\/p>\n<p>        # \u5bf9\u4e8eMac M\u7cfb\u5217&#xff0c;\u4f7f\u7528MPS\u52a0\u901f<br \/>\n        if torch.backends.mps.is_available():<br \/>\n            device &#061; torch.device(&#034;mps&#034;)<br \/>\n            logger.info(&#034;\u4f7f\u7528MPS\u52a0\u901f (Apple Silicon)&#034;)<br \/>\n        else:<br \/>\n            device &#061; torch.device(&#034;cuda&#034; if torch.cuda.is_available() else &#034;cpu&#034;)<br \/>\n            logger.info(f&#034;\u4f7f\u7528\u8bbe\u5907: {device}&#034;)<br \/>\n    else:<br \/>\n        device &#061; torch.device(&#034;cuda&#034; if torch.cuda.is_available() else &#034;cpu&#034;)<br \/>\n        logger.info(f&#034;\u4f7f\u7528\u8bbe\u5907: {device}&#034;)<\/p>\n<p>    return device<\/p>\n<p>def load_model(model_path&#061;&#034;.\/Qwen3-Reranker-0.6B&#034;):<br \/>\n    &#034;&#034;&#034;\u52a0\u8f7d\u6a21\u578b\u548c\u5206\u8bcd\u5668&#034;&#034;&#034;<br \/>\n    logger.info(&#034;\u5f00\u59cb\u52a0\u8f7d\u6a21\u578b&#8230;&#034;)<\/p>\n<p>    try:<br \/>\n        # \u68c0\u67e5\u6a21\u578b\u6587\u4ef6\u662f\u5426\u5b58\u5728<br \/>\n        if not os.path.exists(model_path):<br \/>\n            logger.error(f&#034;\u6a21\u578b\u8def\u5f84\u4e0d\u5b58\u5728: {model_path}&#034;)<br \/>\n            logger.info(&#034;\u8bf7\u786e\u4fdd\u6a21\u578b\u6587\u4ef6\u5df2\u4e0b\u8f7d\u5230\u6b63\u786e\u4f4d\u7f6e&#034;)<br \/>\n            return None, None<\/p>\n<p>        # \u52a0\u8f7d\u5206\u8bcd\u5668<br \/>\n        logger.info(&#034;\u52a0\u8f7d\u5206\u8bcd\u5668&#8230;&#034;)<br \/>\n        tokenizer &#061; AutoTokenizer.from_pretrained(<br \/>\n            model_path,<br \/>\n            trust_remote_code&#061;True<br \/>\n        )<\/p>\n<p>        # \u52a0\u8f7d\u6a21\u578b<br \/>\n        logger.info(&#034;\u52a0\u8f7d\u6a21\u578b&#8230;&#034;)<br \/>\n        model &#061; AutoModelForSequenceClassification.from_pretrained(<br \/>\n            model_path,<br \/>\n            trust_remote_code&#061;True,<br \/>\n            torch_dtype&#061;torch.float16 if torch.cuda.is_available() else torch.float32<br \/>\n        )<\/p>\n<p>        # \u79fb\u52a8\u5230\u5bf9\u5e94\u8bbe\u5907<br \/>\n        device &#061; check_arm_environment()<br \/>\n        model &#061; model.to(device)<br \/>\n        model.eval()<\/p>\n<p>        logger.info(&#034;\u6a21\u578b\u52a0\u8f7d\u5b8c\u6210!&#034;)<br \/>\n        return model, tokenizer, device<\/p>\n<p>    except Exception as e:<br \/>\n        logger.error(f&#034;\u52a0\u8f7d\u6a21\u578b\u5931\u8d25: {str(e)}&#034;)<br \/>\n        return None, None, None<\/p>\n<p>def rerank_documents(query, documents, instruction&#061;None, batch_size&#061;8):<br \/>\n    &#034;&#034;&#034;<br \/>\n    \u91cd\u6392\u5e8f\u6587\u6863<\/p>\n<p>    \u53c2\u6570:<br \/>\n    &#8211; query: \u67e5\u8be2\u6587\u672c<br \/>\n    &#8211; documents: \u6587\u6863\u5217\u8868&#xff0c;\u6bcf\u884c\u4e00\u4e2a<br \/>\n    &#8211; instruction: \u4efb\u52a1\u6307\u4ee4&#xff08;\u53ef\u9009&#xff09;<br \/>\n    &#8211; batch_size: \u6279\u5904\u7406\u5927\u5c0f<br \/>\n    &#034;&#034;&#034;<br \/>\n    global model, tokenizer, device<\/p>\n<p>    if model is None or tokenizer is None:<br \/>\n        return &#034;\u9519\u8bef: \u6a21\u578b\u672a\u52a0\u8f7d\u6210\u529f&#034;<\/p>\n<p>    try:<br \/>\n        # \u5904\u7406\u6587\u6863\u8f93\u5165<br \/>\n        if isinstance(documents, str):<br \/>\n            doc_list &#061; [doc.strip() for doc in documents.split(&#039;\\\\n&#039;) if doc.strip()]<br \/>\n        else:<br \/>\n            doc_list &#061; documents<\/p>\n<p>        if not doc_list:<br \/>\n            return &#034;\u9519\u8bef: \u6ca1\u6709\u6709\u6548\u7684\u6587\u6863&#034;<\/p>\n<p>        # \u9650\u5236\u6587\u6863\u6570\u91cf&#xff08;\u6027\u80fd\u8003\u8651&#xff09;<br \/>\n        if len(doc_list) &gt; 100:<br \/>\n            doc_list &#061; doc_list[:100]<br \/>\n            logger.warning(f&#034;\u6587\u6863\u6570\u91cf\u8d85\u8fc7100&#xff0c;\u53ea\u5904\u7406\u524d100\u4e2a&#034;)<\/p>\n<p>        # \u51c6\u5907\u8f93\u5165<br \/>\n        pairs &#061; [[query, doc] for doc in doc_list]<\/p>\n<p>        # \u5206\u6279\u5904\u7406<br \/>\n        scores &#061; []<br \/>\n        for i in range(0, len(pairs), batch_size):<br \/>\n            batch_pairs &#061; pairs[i:i&#043;batch_size]<\/p>\n<p>            # \u7f16\u7801<br \/>\n            inputs &#061; tokenizer(<br \/>\n                batch_pairs,<br \/>\n                padding&#061;True,<br \/>\n                truncation&#061;True,<br \/>\n                max_length&#061;512,<br \/>\n                return_tensors&#061;&#034;pt&#034;<br \/>\n            ).to(device)<\/p>\n<p>            # \u63a8\u7406<br \/>\n            with torch.no_grad():<br \/>\n                outputs &#061; model(**inputs)<br \/>\n                batch_scores &#061; outputs.logits[:, 0].cpu().numpy()<br \/>\n                scores.extend(batch_scores.tolist())<\/p>\n<p>        # \u6392\u5e8f<br \/>\n        sorted_indices &#061; sorted(range(len(scores)), key&#061;lambda i: scores[i], reverse&#061;True)<\/p>\n<p>        # \u683c\u5f0f\u5316\u7ed3\u679c<br \/>\n        result &#061; &#034;\u91cd\u6392\u5e8f\u7ed3\u679c:\\\\n\\\\n&#034;<br \/>\n        for rank, idx in enumerate(sorted_indices[:10], 1):  # \u53ea\u663e\u793a\u524d10\u4e2a<br \/>\n            score &#061; scores[idx]<br \/>\n            doc &#061; doc_list[idx]<br \/>\n            result &#043;&#061; f&#034;{rank}. [\u5f97\u5206: {score:.4f}] {doc}\\\\n&#034;<\/p>\n<p>        if len(doc_list) &gt; 10:<br \/>\n            result &#043;&#061; f&#034;\\\\n&#8230; \u5171 {len(doc_list)} \u4e2a\u6587\u6863&#xff0c;\u663e\u793a\u524d10\u4e2a&#034;<\/p>\n<p>        return result<\/p>\n<p>    except Exception as e:<br \/>\n        logger.error(f&#034;\u63a8\u7406\u9519\u8bef: {str(e)}&#034;)<br \/>\n        return f&#034;\u5904\u7406\u51fa\u9519: {str(e)}&#034;<\/p>\n<p># \u5168\u5c40\u53d8\u91cf<br \/>\nmodel, tokenizer, device &#061; load_model()<\/p>\n<p>def create_interface():<br \/>\n    &#034;&#034;&#034;\u521b\u5efaGradio\u754c\u9762&#034;&#034;&#034;<\/p>\n<p>    # \u754c\u9762\u8bf4\u660e<br \/>\n    description &#061; &#034;&#034;&#034;<br \/>\n    # Qwen3-Reranker-0.6B \u91cd\u6392\u5e8f\u670d\u52a1<\/p>\n<p>    **ARM\u67b6\u6784\u9002\u914d\u7248\u672c** &#8211; \u4e13\u4e3aMac M\u7cfb\u5217\u53caARM\u670d\u52a1\u5668\u4f18\u5316<\/p>\n<p>    \u8f93\u5165\u67e5\u8be2\u6587\u672c\u548c\u5019\u9009\u6587\u6863&#xff0c;\u6a21\u578b\u4f1a\u6839\u636e\u76f8\u5173\u6027\u5bf9\u6587\u6863\u8fdb\u884c\u91cd\u65b0\u6392\u5e8f\u3002<br \/>\n    &#034;&#034;&#034;<\/p>\n<p>    # \u793a\u4f8b<br \/>\n    examples &#061; [<br \/>\n        [<br \/>\n            &#034;\u4ec0\u4e48\u662f\u4eba\u5de5\u667a\u80fd&#xff1f;&#034;,<br \/>\n            &#034;\u4eba\u5de5\u667a\u80fd\u662f\u8ba1\u7b97\u673a\u79d1\u5b66\u7684\u4e00\u4e2a\u5206\u652f\u3002\\\\n\u673a\u5668\u5b66\u4e60\u662f\u4eba\u5de5\u667a\u80fd\u7684\u4e00\u79cd\u5b9e\u73b0\u65b9\u5f0f\u3002\\\\n\u6df1\u5ea6\u5b66\u4e60\u57fa\u4e8e\u795e\u7ecf\u7f51\u7edc\u3002\\\\nPython\u662f\u4e00\u79cd\u7f16\u7a0b\u8bed\u8a00\u3002&#034;,<br \/>\n            &#034;Given a technical query, retrieve relevant documents&#034;<br \/>\n        ],<br \/>\n        [<br \/>\n            &#034;\u5982\u4f55\u5b66\u4e60\u7f16\u7a0b&#xff1f;&#034;,<br \/>\n            &#034;\u7f16\u7a0b\u9700\u8981\u903b\u8f91\u601d\u7ef4\u3002\\\\n\u53ef\u4ee5\u4ecePython\u5f00\u59cb\u5b66\u4e60\u3002\\\\n\u591a\u5199\u4ee3\u7801\u662f\u8fdb\u6b65\u7684\u5173\u952e\u3002\\\\n\u7b97\u6cd5\u548c\u6570\u636e\u7ed3\u6784\u5f88\u91cd\u8981\u3002&#034;,<br \/>\n            &#034;&#034;<br \/>\n        ]<br \/>\n    ]<\/p>\n<p>    # \u521b\u5efa\u754c\u9762<br \/>\n    with gr.Blocks(title&#061;&#034;Qwen3-Reranker-0.6B&#034;, theme&#061;gr.themes.Soft()) as demo:<br \/>\n        gr.Markdown(description)<\/p>\n<p>        with gr.Row():<br \/>\n            with gr.Column(scale&#061;2):<br \/>\n                query_input &#061; gr.Textbox(<br \/>\n                    label&#061;&#034;\u67e5\u8be2\u6587\u672c&#034;,<br \/>\n                    placeholder&#061;&#034;\u8f93\u5165\u4f60\u8981\u641c\u7d22\u7684\u95ee\u9898&#8230;&#034;,<br \/>\n                    lines&#061;2<br \/>\n                )<\/p>\n<p>                documents_input &#061; gr.Textbox(<br \/>\n                    label&#061;&#034;\u6587\u6863\u5217\u8868&#034;,<br \/>\n                    placeholder&#061;&#034;\u6bcf\u884c\u8f93\u5165\u4e00\u4e2a\u5019\u9009\u6587\u6863&#8230;&#034;,<br \/>\n                    lines&#061;8<br \/>\n                )<\/p>\n<p>                instruction_input &#061; gr.Textbox(<br \/>\n                    label&#061;&#034;\u4efb\u52a1\u6307\u4ee4 (\u53ef\u9009)&#034;,<br \/>\n                    placeholder&#061;&#034;\u4f8b\u5982: Given a web search query, retrieve relevant passages&#034;,<br \/>\n                    lines&#061;2<br \/>\n                )<\/p>\n<p>                batch_size_slider &#061; gr.Slider(<br \/>\n                    minimum&#061;1,<br \/>\n                    maximum&#061;32,<br \/>\n                    value&#061;8,<br \/>\n                    step&#061;1,<br \/>\n                    label&#061;&#034;\u6279\u5904\u7406\u5927\u5c0f&#034;<br \/>\n                )<\/p>\n<p>                submit_btn &#061; gr.Button(&#034;\u5f00\u59cb\u91cd\u6392\u5e8f&#034;, variant&#061;&#034;primary&#034;)<\/p>\n<p>            with gr.Column(scale&#061;3):<br \/>\n                output_text &#061; gr.Textbox(<br \/>\n                    label&#061;&#034;\u6392\u5e8f\u7ed3\u679c&#034;,<br \/>\n                    lines&#061;15,<br \/>\n                    interactive&#061;False<br \/>\n                )<\/p>\n<p>        # \u793a\u4f8b<br \/>\n        gr.Examples(<br \/>\n            examples&#061;examples,<br \/>\n            inputs&#061;[query_input, documents_input, instruction_input],<br \/>\n            label&#061;&#034;\u70b9\u51fb\u4f7f\u7528\u793a\u4f8b&#034;<br \/>\n        )<\/p>\n<p>        # \u4e8b\u4ef6\u5904\u7406<br \/>\n        submit_btn.click(<br \/>\n            fn&#061;rerank_documents,<br \/>\n            inputs&#061;[query_input, documents_input, instruction_input, batch_size_slider],<br \/>\n            outputs&#061;output_text<br \/>\n        )<\/p>\n<p>        # \u56de\u8f66\u952e\u63d0\u4ea4<br \/>\n        query_input.submit(<br \/>\n            fn&#061;rerank_documents,<br \/>\n            inputs&#061;[query_input, documents_input, instruction_input, batch_size_slider],<br \/>\n            outputs&#061;output_text<br \/>\n        )<\/p>\n<p>        # \u7cfb\u7edf\u4fe1\u606f<br \/>\n        with gr.Accordion(&#034;\u7cfb\u7edf\u4fe1\u606f&#034;, open&#061;False):<br \/>\n            gr.Markdown(f&#034;&#034;&#034;<br \/>\n            **\u8fd0\u884c\u73af\u5883:**<br \/>\n            &#8211; \u67b6\u6784: {platform.machine() if &#039;platform&#039; in locals() else &#039;\u672a\u77e5&#039;}<br \/>\n            &#8211; \u8bbe\u5907: {str(device) if device else &#039;\u672a\u77e5&#039;}<br \/>\n            &#8211; \u6a21\u578b: Qwen3-Reranker-0.6B<br \/>\n            &#8211; \u4e0a\u4e0b\u6587\u957f\u5ea6: 32K tokens<br \/>\n            &#8211; \u652f\u6301\u8bed\u8a00: 100&#043; \u79cd<br \/>\n            &#034;&#034;&#034;)<\/p>\n<p>    return demo<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    # \u68c0\u67e5\u6a21\u578b\u662f\u5426\u52a0\u8f7d\u6210\u529f<br \/>\n    if model is None:<br \/>\n        logger.error(&#034;\u6a21\u578b\u52a0\u8f7d\u5931\u8d25&#xff0c;\u8bf7\u68c0\u67e5:&#034;)<br \/>\n        logger.error(&#034;1. \u6a21\u578b\u6587\u4ef6\u662f\u5426\u5b58\u5728&#034;)<br \/>\n        logger.error(&#034;2. \u4f9d\u8d56\u662f\u5426\u5b89\u88c5\u5b8c\u6574&#034;)<br \/>\n        logger.error(&#034;3. \u8bbe\u5907\u5185\u5b58\u662f\u5426\u5145\u8db3&#034;)<br \/>\n        sys.exit(1)<\/p>\n<p>    # \u542f\u52a8\u670d\u52a1<br \/>\n    demo &#061; create_interface()<br \/>\n    demo.launch(<br \/>\n        server_name&#061;&#034;0.0.0.0&#034;,<br \/>\n        server_port&#061;7860,<br \/>\n        share&#061;False,<br \/>\n        show_error&#061;True<br \/>\n    )<\/p>\n<h4>3.3 \u521b\u5efa\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>\u521b\u5efa\u4e00\u4e2aconfig.json\u6587\u4ef6\u6765\u4fdd\u5b58\u4e00\u4e9b\u8bbe\u7f6e&#xff1a;<\/p>\n<p>{<br \/>\n  &#034;model_name&#034;: &#034;Qwen3-Reranker-0.6B&#034;,<br \/>\n  &#034;model_path&#034;: &#034;.\/Qwen3-Reranker-0.6B&#034;,<br \/>\n  &#034;max_documents&#034;: 100,<br \/>\n  &#034;default_batch_size&#034;: 8,<br \/>\n  &#034;max_length&#034;: 512,<br \/>\n  &#034;device&#034;: &#034;auto&#034;,<br \/>\n  &#034;arm_optimization&#034;: true,<br \/>\n  &#034;use_mps_if_available&#034;: true,<br \/>\n  &#034;float_precision&#034;: &#034;fp16&#034;,<br \/>\n  &#034;language_support&#034;: [&#034;en&#034;, &#034;zh&#034;, &#034;es&#034;, &#034;fr&#034;, &#034;de&#034;, &#034;ja&#034;, &#034;ko&#034;, &#034;ru&#034;]<br \/>\n}<\/p>\n<h3>4. ARM\u67b6\u6784\u7279\u6709\u7684\u4f18\u5316\u6280\u5de7<\/h3>\n<h4>4.1 \u5185\u5b58\u4f18\u5316\u914d\u7f6e<\/h4>\n<p>ARM\u8bbe\u5907&#xff08;\u7279\u522b\u662fMac M\u7cfb\u5217&#xff09;\u6709\u7edf\u4e00\u5185\u5b58\u67b6\u6784&#xff0c;\u6211\u4eec\u9700\u8981\u9488\u5bf9\u8fd9\u4e2a\u7279\u70b9\u8fdb\u884c\u4f18\u5316&#xff1a;<\/p>\n<p># \u5728app.py\u4e2d\u6dfb\u52a0\u5185\u5b58\u4f18\u5316\u51fd\u6570<br \/>\ndef optimize_for_arm():<br \/>\n    &#034;&#034;&#034;ARM\u67b6\u6784\u5185\u5b58\u4f18\u5316&#034;&#034;&#034;<br \/>\n    import psutil<br \/>\n    import torch<\/p>\n<p>    # \u83b7\u53d6\u7cfb\u7edf\u5185\u5b58<br \/>\n    memory_info &#061; psutil.virtual_memory()<br \/>\n    total_memory_gb &#061; memory_info.total \/ (1024**3)<\/p>\n<p>    logger.info(f&#034;\u7cfb\u7edf\u603b\u5185\u5b58: {total_memory_gb:.1f} GB&#034;)<\/p>\n<p>    # \u6839\u636e\u5185\u5b58\u5927\u5c0f\u8c03\u6574\u914d\u7f6e<br \/>\n    if total_memory_gb &lt; 8:<br \/>\n        # \u5c0f\u4e8e8GB\u5185\u5b58&#xff0c;\u4f7f\u7528\u66f4\u4fdd\u5b88\u7684\u8bbe\u7f6e<br \/>\n        config &#061; {<br \/>\n            &#034;batch_size&#034;: 4,<br \/>\n            &#034;max_documents&#034;: 50,<br \/>\n            &#034;use_fp16&#034;: False,  # \u4f7f\u7528FP32\u8282\u7701\u663e\u5b58<br \/>\n            &#034;enable_cache&#034;: False<br \/>\n        }<br \/>\n        logger.info(&#034;\u5185\u5b58\u8f83\u5c0f&#xff0c;\u4f7f\u7528\u4f18\u5316\u914d\u7f6e&#034;)<br \/>\n    elif total_memory_gb &lt; 16:<br \/>\n        # 8-16GB\u5185\u5b58<br \/>\n        config &#061; {<br \/>\n            &#034;batch_size&#034;: 8,<br \/>\n            &#034;max_documents&#034;: 100,<br \/>\n            &#034;use_fp16&#034;: True,<br \/>\n            &#034;enable_cache&#034;: True<br \/>\n        }<br \/>\n        logger.info(&#034;\u4e2d\u7b49\u5185\u5b58\u914d\u7f6e&#034;)<br \/>\n    else:<br \/>\n        # 16GB\u4ee5\u4e0a\u5185\u5b58<br \/>\n        config &#061; {<br \/>\n            &#034;batch_size&#034;: 16,<br \/>\n            &#034;max_documents&#034;: 100,<br \/>\n            &#034;use_fp16&#034;: True,<br \/>\n            &#034;enable_cache&#034;: True<br \/>\n        }<br \/>\n        logger.info(&#034;\u5927\u5185\u5b58\u914d\u7f6e&#034;)<\/p>\n<p>    return config<\/p>\n<h4>4.2 MPS\u52a0\u901f\u914d\u7f6e&#xff08;Mac\u4e13\u5c5e&#xff09;<\/h4>\n<p>\u5bf9\u4e8eMac M\u7cfb\u5217\u82af\u7247&#xff0c;PyTorch\u652f\u6301MPS&#xff08;Metal Performance Shaders&#xff09;\u540e\u7aef&#xff1a;<\/p>\n<p>def setup_mps_acceleration():<br \/>\n    &#034;&#034;&#034;\u914d\u7f6eMPS\u52a0\u901f&#034;&#034;&#034;<br \/>\n    if not torch.backends.mps.is_available():<br \/>\n        logger.warning(&#034;MPS\u4e0d\u53ef\u7528&#xff0c;\u5c06\u4f7f\u7528CPU&#034;)<br \/>\n        return False<\/p>\n<p>    # \u542f\u7528MPS<br \/>\n    torch.backends.mps.enabled &#061; True<\/p>\n<p>    # MPS\u7279\u5b9a\u4f18\u5316<br \/>\n    if torch.backends.mps.is_built():<br \/>\n        # \u8bbe\u7f6e\u5185\u5b58\u9650\u5236&#xff08;\u907f\u514dOOM&#xff09;<br \/>\n        torch.mps.set_per_process_memory_fraction(0.7)  # \u4f7f\u752870%\u5185\u5b58<\/p>\n<p>        # \u542f\u7528MPS fallback&#xff08;\u91cd\u8981&#xff01;&#xff09;<br \/>\n        os.environ[&#039;PYTORCH_ENABLE_MPS_FALLBACK&#039;] &#061; &#039;1&#039;<\/p>\n<p>        logger.info(&#034;MPS\u52a0\u901f\u5df2\u542f\u7528&#034;)<br \/>\n        return True<\/p>\n<p>    return False<\/p>\n<h4>4.3 \u6027\u80fd\u76d1\u63a7\u811a\u672c<\/h4>\n<p>\u521b\u5efa\u4e00\u4e2a\u6027\u80fd\u76d1\u63a7\u811a\u672cmonitor.py&#xff1a;<\/p>\n<p>#!\/usr\/bin\/env python3<br \/>\n# \u6027\u80fd\u76d1\u63a7\u811a\u672c<\/p>\n<p>import time<br \/>\nimport psutil<br \/>\nimport torch<\/p>\n<p>def monitor_performance():<br \/>\n    &#034;&#034;&#034;\u76d1\u63a7\u7cfb\u7edf\u6027\u80fd&#034;&#034;&#034;<br \/>\n    process &#061; psutil.Process()<\/p>\n<p>    while True:<br \/>\n        # CPU\u4f7f\u7528\u7387<br \/>\n        cpu_percent &#061; psutil.cpu_percent(interval&#061;1)<\/p>\n<p>        # \u5185\u5b58\u4f7f\u7528<br \/>\n        memory_info &#061; process.memory_info()<br \/>\n        memory_mb &#061; memory_info.rss \/ 1024 \/ 1024<\/p>\n<p>        # GPU\/MPS\u5185\u5b58&#xff08;\u5982\u679c\u53ef\u7528&#xff09;<br \/>\n        if torch.backends.mps.is_available():<br \/>\n            gpu_memory &#061; torch.mps.current_allocated_memory() \/ 1024 \/ 1024<br \/>\n            gpu_info &#061; f&#034;MPS\u5185\u5b58: {gpu_memory:.1f} MB&#034;<br \/>\n        else:<br \/>\n            gpu_info &#061; &#034;MPS\u4e0d\u53ef\u7528&#034;<\/p>\n<p>        print(f&#034;\\\\rCPU: {cpu_percent}% | \u5185\u5b58: {memory_mb:.1f} MB | {gpu_info}&#034;, end&#061;&#034;&#034;)<br \/>\n        time.sleep(2)<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    try:<br \/>\n        monitor_performance()<br \/>\n    except KeyboardInterrupt:<br \/>\n        print(&#034;\\\\n\u76d1\u63a7\u7ed3\u675f&#034;)<\/p>\n<h3>5. \u5b8c\u6574\u90e8\u7f72\u6d41\u7a0b<\/h3>\n<h4>5.1 \u4e00\u952e\u90e8\u7f72\u811a\u672c<\/h4>\n<p>\u521b\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u90e8\u7f72\u811a\u672cdeploy_arm.sh&#xff1a;<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>echo &#034;&#061;&#061;&#061; Qwen3-Reranker-0.6B ARM\u90e8\u7f72\u811a\u672c &#061;&#061;&#061;&#034;<br \/>\necho &#034;\u9002\u7528\u4e8eMac M\u7cfb\u5217\u53caARM\u670d\u52a1\u5668&#034;<br \/>\necho &#034;&#034;<\/p>\n<p># \u68c0\u67e5\u76ee\u5f55<br \/>\nif [ ! -d &#034;Qwen3-Reranker-0.6B&#034; ]; then<br \/>\n    echo &#034;\u521b\u5efa\u9879\u76ee\u76ee\u5f55&#8230;&#034;<br \/>\n    mkdir -p Qwen3-Reranker-0.6B<br \/>\nfi<\/p>\n<p>cd Qwen3-Reranker-0.6B<\/p>\n<p>echo &#034;\u6b65\u9aa41: \u68c0\u67e5Python\u73af\u5883&#8230;&#034;<br \/>\npython3 &#8211;version<br \/>\nif [ $? -ne 0 ]; then<br \/>\n    echo &#034;\u9519\u8bef: Python3\u672a\u5b89\u88c5&#034;<br \/>\n    exit 1<br \/>\nfi<\/p>\n<p>echo &#034;\u6b65\u9aa42: \u5b89\u88c5\u4f9d\u8d56&#8230;&#034;<br \/>\necho &#034;\u5b89\u88c5PyTorch&#8230;&#034;<br \/>\npip3 install torch torchvision torchaudio<\/p>\n<p>echo &#034;\u5b89\u88c5\u5176\u4ed6\u4f9d\u8d56&#8230;&#034;<br \/>\npip3 install transformers&gt;&#061;4.51.0 gradio&gt;&#061;4.0.0 accelerate safetensors sentencepiece psutil<\/p>\n<p>echo &#034;\u6b65\u9aa43: \u4e0b\u8f7d\u6a21\u578b\u6587\u4ef6&#8230;&#034;<br \/>\nif [ ! -f &#034;config.json&#034; ]; then<br \/>\n    echo &#034;\u6a21\u578b\u6587\u4ef6\u4e0d\u5b58\u5728&#xff0c;\u5f00\u59cb\u4e0b\u8f7d&#8230;&#034;<\/p>\n<p>    # \u68c0\u67e5\u662f\u5426\u5b89\u88c5huggingface-hub<br \/>\n    if ! command -v huggingface-cli &amp;&gt; \/dev\/null; then<br \/>\n        pip3 install huggingface-hub<br \/>\n    fi<\/p>\n<p>    # \u4e0b\u8f7d\u6a21\u578b<br \/>\n    python3 -c &#034;<br \/>\nimport sys<br \/>\nfrom huggingface_hub import snapshot_download<br \/>\nimport os<\/p>\n<p>try:<br \/>\n    print(&#039;\u5f00\u59cb\u4e0b\u8f7d\u6a21\u578b&#8230;&#039;)<br \/>\n    snapshot_download(<br \/>\n        repo_id&#061;&#039;Qwen\/Qwen3-Reranker-0.6B&#039;,<br \/>\n        local_dir&#061;&#039;.&#039;,<br \/>\n        local_dir_use_symlinks&#061;False<br \/>\n    )<br \/>\n    print(&#039;\u4e0b\u8f7d\u5b8c\u6210!&#039;)<br \/>\nexcept Exception as e:<br \/>\n    print(f&#039;\u4e0b\u8f7d\u5931\u8d25: {e}&#039;)<br \/>\n    print(&#039;\u8bf7\u624b\u52a8\u4e0b\u8f7d\u6a21\u578b\u6587\u4ef6\u5230\u5f53\u524d\u76ee\u5f55&#039;)<br \/>\n    sys.exit(1)<br \/>\n&#034;<br \/>\nelse<br \/>\n    echo &#034;\u6a21\u578b\u6587\u4ef6\u5df2\u5b58\u5728&#xff0c;\u8df3\u8fc7\u4e0b\u8f7d&#034;<br \/>\nfi<\/p>\n<p>echo &#034;\u6b65\u9aa44: \u521b\u5efa\u914d\u7f6e\u6587\u4ef6&#8230;&#034;<br \/>\ncat &gt; app.py &lt;&lt; &#039;EOF&#039;<br \/>\n# \u8fd9\u91cc\u7c98\u8d34\u4e0a\u9762\u521b\u5efa\u7684app.py\u5185\u5bb9<br \/>\nEOF<\/p>\n<p>cat &gt; start.sh &lt;&lt; &#039;EOF&#039;<br \/>\n#!\/bin\/bash<br \/>\n# \u8fd9\u91cc\u7c98\u8d34\u4e0a\u9762\u521b\u5efa\u7684start.sh\u5185\u5bb9<br \/>\nEOF<\/p>\n<p>chmod &#043;x start.sh<\/p>\n<p>cat &gt; config.json &lt;&lt; &#039;EOF&#039;<br \/>\n{<br \/>\n  &#034;model_name&#034;: &#034;Qwen3-Reranker-0.6B&#034;,<br \/>\n  &#034;model_path&#034;: &#034;.&#034;,<br \/>\n  &#034;max_documents&#034;: 100,<br \/>\n  &#034;default_batch_size&#034;: 8,<br \/>\n  &#034;arm_optimized&#034;: true<br \/>\n}<br \/>\nEOF<\/p>\n<p>echo &#034;\u6b65\u9aa45: \u9a8c\u8bc1\u5b89\u88c5&#8230;&#034;<br \/>\necho &#034;\u8fd0\u884c\u5feb\u901f\u6d4b\u8bd5&#8230;&#034;<br \/>\npython3 -c &#034;<br \/>\nimport torch<br \/>\nprint(f&#039;PyTorch\u7248\u672c: {torch.__version__}&#039;)<br \/>\nprint(f&#039;\u8bbe\u5907\u53ef\u7528\u6027:&#039;)<br \/>\nprint(f&#039;  CPU: \u662f&#039;)<br \/>\nprint(f&#039;  CUDA: {torch.cuda.is_available()}&#039;)<br \/>\nprint(f&#039;  MPS: {torch.backends.mps.is_available()}&#039;)<br \/>\n&#034;<\/p>\n<p>echo &#034;&#034;<br \/>\necho &#034;&#061;&#061;&#061; \u90e8\u7f72\u5b8c\u6210! &#061;&#061;&#061;&#034;<br \/>\necho &#034;&#034;<br \/>\necho &#034;\u542f\u52a8\u670d\u52a1:&#034;<br \/>\necho &#034;  .\/start.sh&#034;<br \/>\necho &#034;&#034;<br \/>\necho &#034;\u8bbf\u95ee\u5730\u5740:&#034;<br \/>\necho &#034;  http:\/\/localhost:7860&#034;<br \/>\necho &#034;&#034;<br \/>\necho &#034;\u505c\u6b62\u670d\u52a1: Ctrl&#043;C&#034;<\/p>\n<h4>5.2 \u542f\u52a8\u548c\u6d4b\u8bd5<\/h4>\n<p>\u8fd0\u884c\u90e8\u7f72\u811a\u672c&#xff1a;<\/p>\n<p># \u7ed9\u811a\u672c\u6dfb\u52a0\u6267\u884c\u6743\u9650<br \/>\nchmod &#043;x deploy_arm.sh<\/p>\n<p># \u8fd0\u884c\u90e8\u7f72\u811a\u672c<br \/>\n.\/deploy_arm.sh<\/p>\n<p>\u90e8\u7f72\u5b8c\u6210\u540e&#xff0c;\u542f\u52a8\u670d\u52a1&#xff1a;<\/p>\n<p>cd Qwen3-Reranker-0.6B<br \/>\n.\/start.sh<\/p>\n<p>\u4f60\u5e94\u8be5\u770b\u5230\u7c7b\u4f3c\u8fd9\u6837\u7684\u8f93\u51fa&#xff1a;<\/p>\n<p>\u6b63\u5728\u542f\u52a8 Qwen3-Reranker-0.6B \u670d\u52a1&#8230;<br \/>\nPython\u7248\u672c: 3.10<br \/>\n\u68c0\u67e5\u4f9d\u8d56&#8230;<br \/>\n\u542f\u52a8Web\u670d\u52a1&#8230;<br \/>\n\u670d\u52a1\u5c06\u5728 http:\/\/localhost:7860 \u53ef\u7528<br \/>\nRunning on local URL:  http:\/\/0.0.0.0:7860<\/p>\n<p>\u6253\u5f00\u6d4f\u89c8\u5668&#xff0c;\u8bbf\u95ee http:\/\/localhost:7860&#xff0c;\u4f60\u5e94\u8be5\u80fd\u770b\u5230Web\u754c\u9762\u3002<\/p>\n<h4>5.3 \u6d4b\u8bd5\u91cd\u6392\u5e8f\u529f\u80fd<\/h4>\n<p>\u5728Web\u754c\u9762\u4e2d&#xff0c;\u5c1d\u8bd5\u8f93\u5165&#xff1a;<\/p>\n<p>\u67e5\u8be2\u6587\u672c&#xff1a;<\/p>\n<p>\u5982\u4f55\u5b66\u4e60Python\u7f16\u7a0b&#xff1f;<\/p>\n<p>\u6587\u6863\u5217\u8868&#xff1a;<\/p>\n<p>Python\u662f\u4e00\u79cd\u9ad8\u7ea7\u7f16\u7a0b\u8bed\u8a00\u3002<br \/>\n\u673a\u5668\u5b66\u4e60\u9700\u8981\u6570\u5b66\u57fa\u7840\u3002<br \/>\nPython\u9002\u5408\u521d\u5b66\u8005&#xff0c;\u8bed\u6cd5\u7b80\u6d01\u3002<br \/>\nJava\u662f\u53e6\u4e00\u79cd\u7f16\u7a0b\u8bed\u8a00\u3002<br \/>\n\u591a\u5199\u4ee3\u7801\u662f\u5b66\u4e60\u7f16\u7a0b\u7684\u6700\u597d\u65b9\u6cd5\u3002<\/p>\n<p>\u70b9\u51fb&#034;\u5f00\u59cb\u91cd\u6392\u5e8f&#034;&#xff0c;\u4f60\u4f1a\u770b\u5230\u6587\u6863\u6309\u7167\u76f8\u5173\u6027\u91cd\u65b0\u6392\u5e8f\u3002<\/p>\n<h3>6. \u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<h4>6.1 \u6a21\u578b\u52a0\u8f7d\u5931\u8d25<\/h4>\n<p>\u95ee\u9898&#xff1a; \u542f\u52a8\u65f6\u63d0\u793a\u6a21\u578b\u52a0\u8f7d\u5931\u8d25<\/p>\n<p>\u89e3\u51b3\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u68c0\u67e5\u6a21\u578b\u6587\u4ef6\u662f\u5426\u5b8c\u6574&#xff1a;<\/li>\n<p>ls -lh Qwen3-Reranker-0.6B\/<br \/>\n# \u5e94\u8be5\u770b\u5230\u81f3\u5c111.2GB\u7684model.safetensors\u6587\u4ef6<\/p>\n<li>\u68c0\u67e5transformers\u7248\u672c&#xff1a;<\/li>\n<p>pip3 show transformers<br \/>\n# \u786e\u4fdd\u7248\u672c &gt;&#061; 4.51.0<\/p>\n<li>\u6e05\u7406\u7f13\u5b58\u91cd\u65b0\u4e0b\u8f7d&#xff1a;<\/li>\n<p>rm -rf ~\/.cache\/huggingface\/hub<br \/>\n# \u91cd\u65b0\u4e0b\u8f7d\u6a21\u578b<\/p>\n<h4>6.2 \u5185\u5b58\u4e0d\u8db3<\/h4>\n<p>\u95ee\u9898&#xff1a; \u8fd0\u884c\u65f6\u62a5\u5185\u5b58\u9519\u8bef<\/p>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<li>\n<p>\u51cf\u5c0f\u6279\u5904\u7406\u5927\u5c0f&#xff1a;<\/p>\n<ul>\n<li>\u4fee\u6539config.json\u4e2d\u7684default_batch_size\u4e3a4\u62162<\/li>\n<li>\u6216\u8005\u5728Web\u754c\u9762\u4e2d\u624b\u52a8\u8bbe\u7f6e\u8f83\u5c0f\u7684\u6279\u5904\u7406\u5927\u5c0f<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4f7f\u7528CPU\u6a21\u5f0f&#xff08;\u5982\u679cMPS\u5185\u5b58\u4e0d\u8db3&#xff09;&#xff1a;<\/p>\n<\/li>\n<p># \u5728app.py\u4e2d\u5f3a\u5236\u4f7f\u7528CPU<br \/>\ndevice &#061; torch.device(&#034;cpu&#034;)<\/p>\n<li>\u76d1\u63a7\u5185\u5b58\u4f7f\u7528&#xff1a;<\/li>\n<p># \u8fd0\u884c\u76d1\u63a7\u811a\u672c<br \/>\npython3 monitor.py<\/p>\n<h4>6.3 \u6027\u80fd\u4f18\u5316<\/h4>\n<p>\u5982\u679c\u89c9\u5f97\u901f\u5ea6\u4e0d\u591f\u5feb&#xff0c;\u53ef\u4ee5\u5c1d\u8bd5&#xff1a;<\/p>\n<li>\u542f\u7528\u91cf\u5316&#xff08;\u5982\u679c\u6a21\u578b\u652f\u6301&#xff09;&#xff1a;<\/li>\n<p># \u52a0\u8f7d\u65f6\u4f7f\u75288\u4f4d\u91cf\u5316<br \/>\nmodel &#061; AutoModelForSequenceClassification.from_pretrained(<br \/>\n    model_path,<br \/>\n    load_in_8bit&#061;True,  # 8\u4f4d\u91cf\u5316<br \/>\n    device_map&#061;&#034;auto&#034;<br \/>\n)<\/p>\n<li>\u8c03\u6574\u7ebf\u7a0b\u6570&#xff1a;<\/li>\n<p># \u8bbe\u7f6ePyTorch\u7ebf\u7a0b\u6570<br \/>\nexport OMP_NUM_THREADS&#061;4<br \/>\nexport MKL_NUM_THREADS&#061;4<\/p>\n<li>\u4f7f\u7528\u66f4\u5c0f\u7684\u6279\u5904\u7406&#xff1a;\u867d\u7136\u6279\u5904\u7406\u8d8a\u5927\u7406\u8bba\u4e0a\u8d8a\u5feb&#xff0c;\u4f46\u5185\u5b58\u53ef\u80fd\u4e0d\u8db3&#xff0c;\u9700\u8981\u627e\u5230\u5e73\u8861\u70b9\u3002<\/li>\n<h4>6.4 \u7aef\u53e3\u51b2\u7a81<\/h4>\n<p>\u95ee\u9898&#xff1a; 7860\u7aef\u53e3\u88ab\u5360\u7528<\/p>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<p># \u67e5\u770b\u7aef\u53e3\u5360\u7528<br \/>\nlsof -i:7860<\/p>\n<p># \u5982\u679c\u88ab\u5360\u7528&#xff0c;\u53ef\u4ee5\u4fee\u6539\u7aef\u53e3<br \/>\n# \u5728start.sh\u4e2d\u4fee\u6539&#xff1a;<br \/>\nexport GRADIO_SERVER_PORT&#061;7861<\/p>\n<p>\u6216\u8005\u76f4\u63a5\u4fee\u6539app.py\u4e2d\u7684\u542f\u52a8\u53c2\u6570&#xff1a;<\/p>\n<p>demo.launch(server_port&#061;7861)  # \u4f7f\u7528\u5176\u4ed6\u7aef\u53e3<\/p>\n<h3>7. \u5b9e\u9645\u5e94\u7528\u793a\u4f8b<\/h3>\n<h4>7.1 \u6587\u6863\u68c0\u7d22\u7cfb\u7edf\u96c6\u6210<\/h4>\n<p>\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u7b80\u5355\u7684\u6587\u6863\u68c0\u7d22\u7cfb\u7edf&#xff0c;\u53ef\u4ee5\u8fd9\u6837\u96c6\u6210\u91cd\u6392\u5e8f&#xff1a;<\/p>\n<p>import requests<br \/>\nimport json<\/p>\n<p>class DocumentSearch:<br \/>\n    def __init__(self, reranker_url&#061;&#034;http:\/\/localhost:7860&#034;):<br \/>\n        self.reranker_url &#061; reranker_url<br \/>\n        self.documents &#061; []  # \u4f60\u7684\u6587\u6863\u5e93<\/p>\n<p>    def search(self, query, top_k&#061;10):<br \/>\n        &#034;&#034;&#034;\u641c\u7d22\u5e76\u91cd\u6392\u5e8f&#034;&#034;&#034;<br \/>\n        # 1. \u521d\u6b65\u68c0\u7d22&#xff08;\u7b80\u5355\u5173\u952e\u8bcd\u5339\u914d&#xff09;<br \/>\n        candidates &#061; self.initial_search(query)<\/p>\n<p>        # 2. \u4f7f\u7528\u91cd\u6392\u5e8f\u6a21\u578b\u4f18\u5316\u7ed3\u679c<br \/>\n        if candidates:<br \/>\n            sorted_docs &#061; self.rerank(query, candidates)<br \/>\n            return sorted_docs[:top_k]<br \/>\n        return []<\/p>\n<p>    def initial_search(self, query):<br \/>\n        &#034;&#034;&#034;\u521d\u6b65\u68c0\u7d22&#xff08;\u8fd9\u91cc\u7b80\u5316\u5b9e\u73b0&#xff09;&#034;&#034;&#034;<br \/>\n        # \u5b9e\u9645\u4e2d\u53ef\u80fd\u4f7f\u7528Elasticsearch\u7b49<br \/>\n        results &#061; []<br \/>\n        for doc in self.documents:<br \/>\n            if query.lower() in doc.lower():<br \/>\n                results.append(doc)<br \/>\n        return results<\/p>\n<p>    def rerank(self, query, documents):<br \/>\n        &#034;&#034;&#034;\u8c03\u7528\u91cd\u6392\u5e8f\u670d\u52a1&#034;&#034;&#034;<br \/>\n        try:<br \/>\n            # \u51c6\u5907\u8bf7\u6c42\u6570\u636e<br \/>\n            data &#061; {<br \/>\n                &#034;data&#034;: [<br \/>\n                    query,<br \/>\n                    &#034;\\\\n&#034;.join(documents),<br \/>\n                    &#034;&#034;,  # \u53ef\u9009\u6307\u4ee4<br \/>\n                    8    # \u6279\u5904\u7406\u5927\u5c0f<br \/>\n                ]<br \/>\n            }<\/p>\n<p>            # \u53d1\u9001\u8bf7\u6c42<br \/>\n            response &#061; requests.post(<br \/>\n                f&#034;{self.reranker_url}\/api\/predict&#034;,<br \/>\n                json&#061;data,<br \/>\n                timeout&#061;10<br \/>\n            )<\/p>\n<p>            if response.status_code &#061;&#061; 200:<br \/>\n                result &#061; response.json()<br \/>\n                # \u89e3\u6790\u7ed3\u679c&#8230;<br \/>\n                return self.parse_rerank_result(result, documents)<br \/>\n            else:<br \/>\n                print(f&#034;\u8bf7\u6c42\u5931\u8d25: {response.status_code}&#034;)<br \/>\n                return documents<\/p>\n<p>        except Exception as e:<br \/>\n            print(f&#034;\u91cd\u6392\u5e8f\u51fa\u9519: {e}&#034;)<br \/>\n            return documents<\/p>\n<p>    def parse_rerank_result(self, result, original_docs):<br \/>\n        &#034;&#034;&#034;\u89e3\u6790\u91cd\u6392\u5e8f\u7ed3\u679c&#034;&#034;&#034;<br \/>\n        # \u6839\u636eAPI\u8fd4\u56de\u683c\u5f0f\u89e3\u6790<br \/>\n        # \u8fd9\u91cc\u9700\u8981\u6839\u636e\u5b9e\u9645API\u8c03\u6574<br \/>\n        return original_docs  # \u7b80\u5316\u8fd4\u56de<\/p>\n<h4>7.2 \u6279\u91cf\u5904\u7406\u811a\u672c<\/h4>\n<p>\u5982\u679c\u4f60\u9700\u8981\u5904\u7406\u5927\u91cf\u67e5\u8be2&#xff0c;\u53ef\u4ee5\u521b\u5efa\u6279\u91cf\u5904\u7406\u811a\u672c&#xff1a;<\/p>\n<p>import pandas as pd<br \/>\nfrom tqdm import tqdm<\/p>\n<p>def batch_rerank(input_csv, output_csv):<br \/>\n    &#034;&#034;&#034;\u6279\u91cf\u91cd\u6392\u5e8f&#034;&#034;&#034;<br \/>\n    # \u8bfb\u53d6\u6570\u636e<br \/>\n    df &#061; pd.read_csv(input_csv)<\/p>\n<p>    results &#061; []<\/p>\n<p>    for _, row in tqdm(df.iterrows(), total&#061;len(df)):<br \/>\n        query &#061; row[&#039;query&#039;]<br \/>\n        documents &#061; row[&#039;documents&#039;].split(&#039;|&#039;)  # \u5047\u8bbe\u6587\u6863\u7528|\u5206\u9694<\/p>\n<p>        # \u8c03\u7528\u91cd\u6392\u5e8f<br \/>\n        sorted_docs &#061; rerank_documents(query, documents)<\/p>\n<p>        # \u4fdd\u5b58\u7ed3\u679c<br \/>\n        results.append({<br \/>\n            &#039;query&#039;: query,<br \/>\n            &#039;original_docs&#039;: &#039;|&#039;.join(documents),<br \/>\n            &#039;sorted_docs&#039;: &#039;|&#039;.join(sorted_docs),<br \/>\n            &#039;top_result&#039;: sorted_docs[0] if sorted_docs else &#039;&#039;<br \/>\n        })<\/p>\n<p>    # \u4fdd\u5b58\u7ed3\u679c<br \/>\n    result_df &#061; pd.DataFrame(results)<br \/>\n    result_df.to_csv(output_csv, index&#061;False)<br \/>\n    print(f&#034;\u5904\u7406\u5b8c\u6210&#xff0c;\u7ed3\u679c\u4fdd\u5b58\u5230 {output_csv}&#034;)<\/p>\n<h3>8. \u603b\u7ed3<\/h3>\n<p>\u901a\u8fc7\u8fd9\u7bc7\u6559\u7a0b&#xff0c;\u4f60\u5e94\u8be5\u5df2\u7ecf\u6210\u529f\u5728ARM\u67b6\u6784\u8bbe\u5907\u4e0a\u90e8\u7f72\u4e86Qwen3-Reranker-0.6B\u6a21\u578b\u3002\u6211\u4eec\u6765\u56de\u987e\u4e00\u4e0b\u5173\u952e\u70b9&#xff1a;<\/p>\n<p>\u90e8\u7f72\u8981\u70b9\u603b\u7ed3&#xff1a;<\/p>\n<li>\u73af\u5883\u51c6\u5907&#xff1a;\u786e\u8ba4Python\u7248\u672c&#xff08;3.8&#043;&#xff09;&#xff0c;\u5b89\u88c5ARM\u517c\u5bb9\u7684PyTorch<\/li>\n<li>\u6a21\u578b\u4e0b\u8f7d&#xff1a;\u4eceHugging Face\u4e0b\u8f7d\u6a21\u578b\u6587\u4ef6&#xff0c;\u786e\u4fdd\u6587\u4ef6\u5b8c\u6574<\/li>\n<li>\u4f9d\u8d56\u5b89\u88c5&#xff1a;\u5b89\u88c5transformers\u3001gradio\u7b49\u5fc5\u8981\u5e93<\/li>\n<li>ARM\u4f18\u5316&#xff1a;\u9488\u5bf9ARM\u67b6\u6784\u8fdb\u884c\u5185\u5b58\u548c\u6027\u80fd\u4f18\u5316<\/li>\n<li>\u670d\u52a1\u542f\u52a8&#xff1a;\u901a\u8fc7Web\u754c\u9762\u6216API\u63d0\u4f9b\u670d\u52a1<\/li>\n<p>ARM\u7279\u6709\u4f18\u52bf&#xff1a;<\/p>\n<ul>\n<li>Mac M\u7cfb\u5217&#xff1a;\u53ef\u4ee5\u5229\u7528MPS\u52a0\u901f&#xff0c;\u83b7\u5f97\u63a5\u8fd1GPU\u7684\u6027\u80fd<\/li>\n<li>\u4f4e\u529f\u8017&#xff1a;ARM\u8bbe\u5907\u901a\u5e38\u66f4\u7701\u7535&#xff0c;\u9002\u5408\u957f\u65f6\u95f4\u8fd0\u884c<\/li>\n<li>\u4fbf\u643a\u6027&#xff1a;\u5728\u7b14\u8bb0\u672c\u4e0a\u672c\u5730\u90e8\u7f72&#xff0c;\u6570\u636e\u9690\u79c1\u66f4\u6709\u4fdd\u969c<\/li>\n<\/ul>\n<p>\u6027\u80fd\u5efa\u8bae&#xff1a;<\/p>\n<ul>\n<li>\u6839\u636e\u5185\u5b58\u5927\u5c0f\u8c03\u6574\u6279\u5904\u7406\u5927\u5c0f<\/li>\n<li>\u76d1\u63a7\u8d44\u6e90\u4f7f\u7528&#xff0c;\u907f\u514d\u5185\u5b58\u4e0d\u8db3<\/li>\n<li>\u5bf9\u4e8e\u751f\u4ea7\u73af\u5883&#xff0c;\u8003\u8651\u4f7f\u7528Docker\u5bb9\u5668\u5316\u90e8\u7f72<\/li>\n<\/ul>\n<p>\u4e0b\u4e00\u6b65\u5efa\u8bae&#xff1a;<\/p>\n<li>\u5c1d\u8bd5\u4e0d\u540c\u7684\u67e5\u8be2\u548c\u6587\u6863&#xff0c;\u4e86\u89e3\u6a21\u578b\u7684\u80fd\u529b\u8fb9\u754c<\/li>\n<li>\u6839\u636e\u5177\u4f53\u5e94\u7528\u573a\u666f\u8c03\u6574\u4efb\u52a1\u6307\u4ee4<\/li>\n<li>\u8003\u8651\u5c06\u670d\u52a1\u96c6\u6210\u5230\u4f60\u7684\u5e94\u7528\u4e2d<\/li>\n<li>\u76d1\u63a7\u6027\u80fd\u5e76\u6301\u7eed\u4f18\u5316\u914d\u7f6e<\/li>\n<p>\u8fd9\u4e2a\u90e8\u7f72\u4e0d\u4ec5\u8ba9\u4f60\u80fd\u5728\u672c\u5730\u4f7f\u7528\u5f3a\u5927\u7684\u91cd\u6392\u5e8f\u529f\u80fd&#xff0c;\u4e5f\u4e3a\u7406\u89e3\u5982\u4f55\u5728ARM\u67b6\u6784\u4e0a\u90e8\u7f72AI\u6a21\u578b\u63d0\u4f9b\u4e86\u5b9e\u8df5\u7ecf\u9a8c\u3002\u65e0\u8bba\u662f\u4e2a\u4eba\u9879\u76ee\u8fd8\u662f\u539f\u578b\u5f00\u53d1&#xff0c;\u672c\u5730\u90e8\u7f72\u90fd\u80fd\u63d0\u4f9b\u5feb\u901f\u8fed\u4ee3\u548c\u9690\u79c1\u4fdd\u62a4\u7684\u4f18\u52bf\u3002<\/p>\n<hr \/>\n<p>\u83b7\u53d6\u66f4\u591aAI\u955c\u50cf<\/p>\n<p>\u60f3\u63a2\u7d22\u66f4\u591aAI\u955c\u50cf\u548c\u5e94\u7528\u573a\u666f&#xff1f;\u8bbf\u95ee CSDN\u661f\u56fe\u955c\u50cf\u5e7f\u573a&#xff0c;\u63d0\u4f9b\u4e30\u5bcc\u7684\u9884\u7f6e\u955c\u50cf&#xff0c;\u8986\u76d6\u5927\u6a21\u578b\u63a8\u7406\u3001\u56fe\u50cf\u751f\u6210\u3001\u89c6\u9891\u751f\u6210\u3001\u6a21\u578b\u5fae\u8c03\u7b49\u591a\u4e2a\u9886\u57df&#xff0c;\u652f\u6301\u4e00\u952e\u90e8\u7f72\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b&#xff1a;ARM\u67b6\u6784\u670d\u52a1\u5668&#xff08;\u5982Mac M2\/M3&#xff09;\u9002\u914d\u6307\u5357<br \/>\n1. \u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u5728ARM\u67b6\u6784\u4e0a\u90e8\u7f72\u91cd\u6392\u5e8f\u6a21\u578b&#xff1f;<br \/>\n\u5982\u679c\u4f60\u624b\u5934\u6709\u4e00\u53f0MacBook&#xff0c;\u7279\u522b\u662f\u642d\u8f7d\u4e86M2\u6216M3\u82af\u7247\u7684\u578b\u53f7&#xff0c;\u4f60\u53ef\u80fd\u4f1a\u53d1\u73b0\u5f88\u591aAI\u6a21\u578b\u90e8\u7f72\u6559\u7a0b\u90fd\u662f\u9488\u5bf9x86\u67b6\u6784\u7684&#xff0c;\u7528\u8d77\u6765\u603b\u662f\u4e0d\u592a\u987a\u624b\u3002\u4eca\u5929&#xff0c;\u6211\u4eec\u5c31\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<br \/>\nQwen3-Reranker<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7591,6714,9255],"topic":[],"class_list":["post-82829","post","type-post","status-publish","format-standard","hentry","category-server","tag-ai","tag-arm","tag-9255"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b\uff1aARM\u67b6\u6784\u670d\u52a1\u5668\uff08\u5982Mac M2\/M3\uff09\u9002\u914d\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/82829.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b\uff1aARM\u67b6\u6784\u670d\u52a1\u5668\uff08\u5982Mac M2\/M3\uff09\u9002\u914d\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b&#xff1a;ARM\u67b6\u6784\u670d\u52a1\u5668&#xff08;\u5982Mac M2\/M3&#xff09;\u9002\u914d\u6307\u5357 1. \u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u5728ARM\u67b6\u6784\u4e0a\u90e8\u7f72\u91cd\u6392\u5e8f\u6a21\u578b&#xff1f; \u5982\u679c\u4f60\u624b\u5934\u6709\u4e00\u53f0MacBook&#xff0c;\u7279\u522b\u662f\u642d\u8f7d\u4e86M2\u6216M3\u82af\u7247\u7684\u578b\u53f7&#xff0c;\u4f60\u53ef\u80fd\u4f1a\u53d1\u73b0\u5f88\u591aAI\u6a21\u578b\u90e8\u7f72\u6559\u7a0b\u90fd\u662f\u9488\u5bf9x86\u67b6\u6784\u7684&#xff0c;\u7528\u8d77\u6765\u603b\u662f\u4e0d\u592a\u987a\u624b\u3002\u4eca\u5929&#xff0c;\u6211\u4eec\u5c31\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002 Qwen3-Reranker\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/82829.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-25T05:09:31+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/82829.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/82829.html\",\"name\":\"Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b\uff1aARM\u67b6\u6784\u670d\u52a1\u5668\uff08\u5982Mac M2\/M3\uff09\u9002\u914d\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-25T05:09:31+00:00\",\"dateModified\":\"2026-07-25T05:09:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/82829.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/82829.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/82829.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b\uff1aARM\u67b6\u6784\u670d\u52a1\u5668\uff08\u5982Mac M2\/M3\uff09\u9002\u914d\u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b\uff1aARM\u67b6\u6784\u670d\u52a1\u5668\uff08\u5982Mac M2\/M3\uff09\u9002\u914d\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/82829.html","og_locale":"zh_CN","og_type":"article","og_title":"Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b\uff1aARM\u67b6\u6784\u670d\u52a1\u5668\uff08\u5982Mac M2\/M3\uff09\u9002\u914d\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b&#xff1a;ARM\u67b6\u6784\u670d\u52a1\u5668&#xff08;\u5982Mac M2\/M3&#xff09;\u9002\u914d\u6307\u5357 1. \u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48\u8981\u5728ARM\u67b6\u6784\u4e0a\u90e8\u7f72\u91cd\u6392\u5e8f\u6a21\u578b&#xff1f; \u5982\u679c\u4f60\u624b\u5934\u6709\u4e00\u53f0MacBook&#xff0c;\u7279\u522b\u662f\u642d\u8f7d\u4e86M2\u6216M3\u82af\u7247\u7684\u578b\u53f7&#xff0c;\u4f60\u53ef\u80fd\u4f1a\u53d1\u73b0\u5f88\u591aAI\u6a21\u578b\u90e8\u7f72\u6559\u7a0b\u90fd\u662f\u9488\u5bf9x86\u67b6\u6784\u7684&#xff0c;\u7528\u8d77\u6765\u603b\u662f\u4e0d\u592a\u987a\u624b\u3002\u4eca\u5929&#xff0c;\u6211\u4eec\u5c31\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002 Qwen3-Reranker","og_url":"https:\/\/www.wsisp.com\/helps\/82829.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-25T05:09:31+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/82829.html","url":"https:\/\/www.wsisp.com\/helps\/82829.html","name":"Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b\uff1aARM\u67b6\u6784\u670d\u52a1\u5668\uff08\u5982Mac M2\/M3\uff09\u9002\u914d\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-25T05:09:31+00:00","dateModified":"2026-07-25T05:09:31+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/82829.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/82829.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/82829.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Qwen3-Reranker-0.6B\u90e8\u7f72\u6559\u7a0b\uff1aARM\u67b6\u6784\u670d\u52a1\u5668\uff08\u5982Mac M2\/M3\uff09\u9002\u914d\u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/82829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=82829"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/82829\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=82829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=82829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=82829"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=82829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}