m0_69339309 2023-10-27 13:24 采纳率: 20%
浏览 21
已结题

bertopic主题识别

umap_model=UMAP(n_neighbors=15,n_components=5,min_dist=0.0,metric='cosine',random_state=100)
topic_model=BERTopic(umap_model=umap_model,calculate_probabilities=True,nr_topics="auto")
topics,probabilities=topic_model.fit_transform(wordList)

ConnectTimeout: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/sentence-transformers/all-MiniLM-L6-v2 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001952080C850>, 'Connection to huggingface.co timed out. (connect timeout=None)'))在使用bertopic时出现这个问题怎么办

  • 写回答

6条回答 默认 最新

  • 社区专家-Monster-XH 2023-10-27 13:24
    关注

    基于Monster 组和GPT的调写:

    -原因包括网络连接问题、Hugging Face服务器问题或其他原因。

    1. 检查网络连接:确保计算机可以访问Internet,并尝试访问 huggingface.co 以确保网站是可用的。

    2. 手动下载模型

      • 直接访问Hugging Face模型库,找到所需的模型并手动下载。
      • 下载后可以告诉 BERTopic 使用本地路径作为模型。这样,它就不会再尝试在线下载模型。

      例如,如果你手动下载了 all-MiniLM-L6-v2 模型并将其保存在 "path/to/model",你可以如此进行配置:

      topic_model = BERTopic(embedding_model="path/to/model", ...)
      
    3. 更换句子转换器:BERTopic 默认用 sentence-transformers/all-MiniLM-L6-v2 作为其句子转换器,但你可以更换为其他的句子转换器。例如用 distilbert-base-nli-mean-tokens 作为替代:

      topic_model = BERTopic(embedding_model="distilbert-base-nli-mean-tokens", ...)
      
    4. 调整连接超时:尽管上述错误消息中的 connect timeout=None 表示没有设置明确的超时,但你可以尝试设置一个长一点的超时来看看是否可以帮助解决问题。

    如果公司或学校网络后面,存在防火墙或其他网络策略阻止了对Hugging Face的访问

    评论 编辑记录

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 10月27日
  • 创建了问题 10月27日