cd /news/ai-tools/how-to-use-model-locally-using-in-cl… · home › topics › ai-tools › article
[ARTICLE · art-156595] src=discuss.huggingface.co ↗ pub= topic=ai-tools verified=true sentiment=· neutral

How to use Model locally using in CLI for testing purposes no GUI tool

A community forum answer lays out a two-step method for running a language model locally from the command line without a GUI: download Qwen/Qwen2.5-0.5B-Instruct once with `hf download ... --local-dir ./qwen` from the huggingface_hub package, then load it via the transformers `pipeline` with `local_files_only=True` and `device_map="auto"`. The answer attributes most "hundreds of errors" to pointing the loader at a single file instead of the folder containing config.json, or to missing torch and accelerate installs, and notes that `transformers chat Qwen/Qwen2.5-0.5B-Instruct` offers a no-code terminal chat. A second reply recommends Ollama as a single-install, single-command CLI alternative requiring no Python environment.

read1 min views4 publishedOct 24, 2026
How to use Model locally using in CLI for testing purposes no GUI tool
Image: Discuss (auto-discovered)

Hello everybody, How can I download the models locally, and how inference them smoothly without having hundered of errors.

and it’s too hard to use transfomer lib to and forcing him to load the local model. can anyone help?

Hi! Easiest way is two steps.

1. Download the model once

pip install -U huggingface_hub
hf download Qwen/Qwen2.5-0.5B-Instruct --local-dir ./qwen

2. Load it from that folder

pip install torch transformers accelerate
python
from transformers import pipeline

pipe = pipeline(
    "text-generation",
    model="./qwen",          # folder that contains config.json
    device_map="auto",
    local_files_only=True,   # never hits the internet
)

messages = [{"role": "user", "content": "Hello!"}]
out = pipe(messages, max_new_tokens=100)
print(out[0]["generated_text"][-1]["content"])

Most “hundreds of errors” come from a wrong path (it must be the folder with config.json, not a single file) or from missing torch/ accelerate.

If you just want to chat in the terminal with no code, this also works (see the “Chat basics” docs):

transformers chat Qwen/Qwen2.5-0.5B-Instruct

If you still get an error, paste the last lines of the traceback and the model name, and we can look at it.

One more beginner friendly option if the transformers route gives you trouble: Ollama gives you a pure CLI chat with a single install and a single command to pull and run a model, no Python environment needed. It is worth trying when you just want to test a model quickly. If you stick with transformers, make sure the local folder really contains config.json and the model weights, since a wrong path is the most common error.

── more in #ai-tools 4 stories · sorted by recency
── more on @qwen2.5-0.5b-instruct 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-use-model-loc…] indexed:0 read:1min 2026-10-24 · —