Snider Virgil commited on
Commit
aeeba46
·
1 Parent(s): 70f85ef

fix(probe): system-python capability check via ollama binary

Browse files

The earlier fix probed 'openai' via import at the install.sh /
lem-eval.sh level, but those scripts run in the SYSTEM python outside
the uv venv where openai isn't installed. So charon correctly saw
mlx_lm as unavailable but then also failed the gguf probe and
reported 'no target types detected'.

Switch to a presence check: ollama binary in PATH → gguf capability.
That's the right proxy anyway — we run gguf via Ollama's OpenAI
endpoint, and if ollama isn't installed we can't run anyway.

mlx probe unchanged (only meaningful on Darwin).

Co-Authored-By: Virgil <virgil@lethean.io>

Files changed (2) hide show
  1. install.sh +10 -10
  2. lem-eval.sh +7 -9
install.sh CHANGED
@@ -67,19 +67,19 @@ if types_env:
67
  allowed = set(t.strip() for t in types_env.split(","))
68
  else:
69
  allowed = set()
70
- try:
71
- import mlx_lm # noqa: F401
72
- if platform.system() == "Darwin":
73
  allowed.add("mlx")
74
- except ImportError:
75
- pass
76
- try:
77
- import openai # noqa: F401
 
78
  allowed.add("gguf")
79
- except ImportError:
80
- pass
81
  if not allowed:
82
- print(" no target types detected (need mlx_lm or openai); set LEM_TYPES=gguf to override")
 
83
 
84
  def derive_repo_id(this_ref):
85
  """Strip Ollama hf.co/ prefix and :<tag> suffix to get a clone-able repo id."""
 
67
  allowed = set(t.strip() for t in types_env.split(","))
68
  else:
69
  allowed = set()
70
+ if platform.system() == "Darwin":
71
+ try:
72
+ import mlx_lm # noqa: F401
73
  allowed.add("mlx")
74
+ except ImportError:
75
+ pass
76
+ # gguf availability = ollama binary present anywhere we'd hit it from
77
+ if any(os.path.exists(os.path.join(p, "ollama"))
78
+ for p in os.environ.get("PATH", "").split(":")):
79
  allowed.add("gguf")
 
 
80
  if not allowed:
81
+ print(" no target types detected (need mlx_lm on Darwin or ollama on PATH); "
82
+ "set LEM_TYPES to override")
83
 
84
  def derive_repo_id(this_ref):
85
  """Strip Ollama hf.co/ prefix and :<tag> suffix to get a clone-able repo id."""
lem-eval.sh CHANGED
@@ -109,17 +109,15 @@ if types_env:
109
  allowed = set(t.strip() for t in types_env.split(","))
110
  else:
111
  allowed = set()
112
- try:
113
- import mlx_lm # noqa: F401
114
- if platform.system() == "Darwin":
115
  allowed.add("mlx")
116
- except ImportError:
117
- pass
118
- try:
119
- import openai # noqa: F401
120
  allowed.add("gguf")
121
- except ImportError:
122
- pass
123
 
124
  def derive_repo_id(this_ref):
125
  if this_ref.startswith("hf.co/"):
 
109
  allowed = set(t.strip() for t in types_env.split(","))
110
  else:
111
  allowed = set()
112
+ if platform.system() == "Darwin":
113
+ try:
114
+ import mlx_lm # noqa: F401
115
  allowed.add("mlx")
116
+ except ImportError:
117
+ pass
118
+ if any(os.path.exists(os.path.join(p, "ollama"))
119
+ for p in os.environ.get("PATH", "").split(":")):
120
  allowed.add("gguf")
 
 
121
 
122
  def derive_repo_id(this_ref):
123
  if this_ref.startswith("hf.co/"):