Skip to content

公司服务器无法联网,有本地加载模型和数据集的例子嘛? #56

Answered by Ki-Seki
mitergpt asked this question in Q&A
Discussion options

You must be logged in to vote

examples/basic_modules/llm.py 里有使用本地模型的示例,修改 model_name_or_path 即可。

from memos.configs.llm import LLMConfigFactory
from memos.llms.factory import LLMFactory


config = LLMConfigFactory.model_validate(
    {
        "backend": "huggingface",
        "config": {
            "model_name_or_path": "Qwen/Qwen3-1.7B",
            "temperature": 0.8,
            "max_tokens": 1024,
            "top_p": 0.9,
            "top_k": 50,
        },
    }
)
llm = LLMFactory.from_config(config)
messages = [
    {"role": "user", "content": "Hello, who are you"},
]
response = llm.generate(messages)
print("Scenario 4:", response)
print("==" * 20)

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Ki-Seki
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #53 on July 10, 2025 10:25.