Issues / #2363

#2363 [Bug]: macOS setup drops --source; the download-failure hint recommends it, but only STRATA_SOURCE works on a Mac

open · @afanty2021 · 0 comentarios · En GitHub

Setup & installModels & quantsDocumentation

Descripción

On an Apple Silicon Mac, `./setup.sh` failed at the model download because huggingface.co is not reachable from my network. The failure hint says:

```
  [X]  cannot reach huggingface.co (<urlopen error timed out>)
       check your internet connection and run it again; if huggingface.co does not reach you (mainland
       China), the same files are on ModelScope: run setup with --source modelscope (docs/INSTALL.md)
```

I ran it again exactly as recommended:

```
./setup.sh --model Q2_0 --yes --no-start --source modelscope
```

The flag was silently discarded — the run printed, above its normal output:

```
  [!]  not used on a Mac: --source modelscope
```

and then failed with the identical `cannot reach huggingface.co` error.

What works instead is the environment variable, which `setup.py` documents for other platforms (`--source / STRATA_SOURCE`):

```
STRATA_SOURCE=modelscope ./setup.sh --model Q2_0 --yes --no-start
```

That downloaded from ModelScope fine.

**Why it happens:** on macOS, `setup.py`'s `main()` delegates everything to `metal/setup_mac.py` (`return mac_setup(sys.argv[1:])`) before `setup.py`'s own argparse — including its `os.environ["STRATA_SOURCE"] = a.source` — ever runs. `metal/setup_mac.py`'s parser does not define `--source`, so `parse_known_args` moves it into `rest` and it only gets the `not used on a Mac` warning. Meanwhile the failure hint (`source_hint()` in setup.py) recommends `--source modelscope` unconditionally, which on a Mac is a dead end.

**Expected:** `--source modelscope` is accepted on a Mac (setup_mac.py defines it and sets `STRATA_SOURCE`, mirroring setup.py), or the failure hint tells Mac users the env-var form.

**Repro:** on an Apple Silicon Mac without reach to huggingface.co:

1. `./setup.sh --model Q2_0 --yes --no-start` → fails, hint recommends `--source modelscope`
2. `./setup.sh --model Q2_0 --yes --no-start --source modelscope` → `[!] not used on a Mac: --source modelscope`, same failure
3. `STRATA_SOURCE=modelscope ./setup.sh --model Q2_0 --yes --no-start` → downloads from ModelScope

If it helps: a minimal fix is adding `ap.add_argument("--source", choices=S.SOURCES)` to `metal/setup_mac.py`'s parser and setting `os.environ["STRATA_SOURCE"] = a.source` from it, and/or making `source_hint()` print the env-var form on darwin. Your call — you know whether the flag or the env var is the interface you want Mac users on.

(Side note: open issue #1915 covers a different ModelScope rough edge — a truncated shard renamed to its final name. Not the same bug, but both bite on the ModelScope path.)

En el sitio

Enlaces a install, modelos, releases.