Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

setup: --gpus when starting an installed model on a PC with AMD cards and no NVIDIA ones names the AMD cards (#1594)

Niko1221598df1115800
diff --git a/setup.py b/setup.py
index 8df369935..0c8a819af 100644
--- a/setup.py
+++ b/setup.py
@@ -1013,11 +1013,16 @@ def start_gpus(text):
are the ones Strata can use, AMD cards as setup lists them ("all": every supported AMD card)."""
if not text:
return None
- if str(text).strip().lower() == "all" and not WIN and not together_ok(gpus()):
+ found = gpus()
+ if str(text).strip().lower() == "all" and not WIN and not together_ok(found):
amd = amd_gpus()
if len([g for g in amd if amd_problem(g) is None]) >= 2:
return [g["index"] for g in amd_parse_gpus("all", amd)]
- return parse_gpus(text, gpus())
+ if not found and not WIN: # #1594: no NVIDIA card, AMD ones: "1,0" names those, as setup lists them
+ amd = amd_gpus()
+ if amd:
+ return [g["index"] for g in amd_parse_gpus(text, amd)]
+ return parse_gpus(text, found)
def choose_gpus(a, found) -> list:
@@ -4626,7 +4631,7 @@ def main() -> int:
help="EXPERIMENTAL, off by default: the control vector in data/experimental-speed-projection "
"(or another GGUF) as a projection on layers 4-44; see docs/DETAILS.md")
ap.add_argument("--port", type=int, help="the server's port (default: the one the install was set up with, 8080 for a new one)")
- ap.add_argument("--gpu", help="one GPU, numbered as nvidia-smi numbers them (default: asked when several can be "
+ ap.add_argument("--gpu", help="one GPU, numbered as nvidia-smi numbers them (AMD: as setup lists them) (default: asked when several can be "
"used; with --setup it is saved, when starting it is for that start only)")
ap.add_argument("--gpus", help="several GPUs sharing one model, as nvidia-smi numbers them (AMD: as setup lists "
"them): \"0,2\", or \"all\" (every card that can); the first is the main one. "
diff --git a/tools/test_setup_start_gpus_amd.py b/tools/test_setup_start_gpus_amd.py
new file mode 100644
index 000000000..d428fe8c9
--- /dev/null
+++ b/tools/test_setup_start_gpus_amd.py
@@ -0,0 +1,40 @@
+"""#1594: --gpus when starting an installed model on a PC with AMD cards and no NVIDIA ones names the AMD cards (as
+setup lists them) instead of failing for want of an NVIDIA GPU.
+
+ python -m unittest tools.test_setup_start_gpus_amd -v
+"""
+import sys
+import unittest
+from pathlib import Path
+from unittest import mock
+
+sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
+import setup # noqa: E402
+
+
+def amd(index, arch="gfx1201"):
+ return {"index": index, "name": f"Radeon {index}", "arch": arch, "vram_gb": 32.0}
+
+
+class StartGpusAmd(unittest.TestCase):
+ def run_start_gpus(self, text, cards, nvidia=()):
+ with mock.patch.object(setup, "WIN", False), mock.patch.object(setup, "gpus", return_value=list(nvidia)), \
+ mock.patch.object(setup, "amd_gpus", return_value=cards):
+ return setup.start_gpus(text)
+
+ def test_amd_numbers_are_taken_as_setup_lists_them(self):
+ self.assertEqual(self.run_start_gpus("1,0", [amd(0), amd(1)]), [1, 0])
+
+ def test_all_still_means_every_supported_amd_card(self):
+ self.assertEqual(sorted(self.run_start_gpus("all", [amd(0), amd(1)])), [0, 1])
+
+ def test_a_card_that_cannot_be_used_is_named(self):
+ with self.assertRaises(SystemExit):
+ self.run_start_gpus("1,0", [amd(0), amd(1, "gfx1010")])
+
+ def test_nothing_named_is_none(self):
+ self.assertIsNone(self.run_start_gpus("", [amd(0)]))
+
+
+if __name__ == "__main__":
+ unittest.main()