Spaces:
Running
Running
Upload 2 files
Browse files- model_manager.py +3 -25
model_manager.py
CHANGED
|
@@ -31,31 +31,9 @@ class BitNetManager:
|
|
| 31 |
else:
|
| 32 |
st.warning("Patch target line not found in ggml-bitnet-mad.cpp.")
|
| 33 |
|
| 34 |
-
# Patch setup_env.py to
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
st.info("Patching setup_env.py to handle path issues...")
|
| 38 |
-
with open(setup_script, "r") as f:
|
| 39 |
-
setup_content = f.read()
|
| 40 |
-
|
| 41 |
-
# Replace literal "huggingface-cli" with the python module call
|
| 42 |
-
# This is safer in environments where the CLI isn't in the global PATH
|
| 43 |
-
old_cli = '"huggingface-cli"'
|
| 44 |
-
new_cli = '"python", "-m", "huggingface_hub.commands.huggingface_cli"'
|
| 45 |
-
|
| 46 |
-
if old_cli in setup_content:
|
| 47 |
-
# We need to be careful with the list structure.
|
| 48 |
-
# setup_env.py usually uses subprocess.run(["huggingface-cli", ...])
|
| 49 |
-
patched_setup = setup_content.replace(old_cli, new_cli)
|
| 50 |
-
with open(setup_script, "w") as f:
|
| 51 |
-
f.write(patched_setup)
|
| 52 |
-
st.success("Patch applied to setup_env.py!")
|
| 53 |
-
elif 'huggingface-cli' in setup_content:
|
| 54 |
-
# Catch cases without quotes if any
|
| 55 |
-
patched_setup = setup_content.replace('huggingface-cli', 'python -m huggingface_hub.commands.huggingface_cli')
|
| 56 |
-
with open(setup_script, "w") as f:
|
| 57 |
-
f.write(patched_setup)
|
| 58 |
-
st.success("Patch applied to setup_env.py (unquoted)!")
|
| 59 |
|
| 60 |
def setup_engine(self, model_id="1bitLLM/bitnet_b1_58-3B"):
|
| 61 |
"""Clone and compile utilizing official setup_env.py with log streaming."""
|
|
|
|
| 31 |
else:
|
| 32 |
st.warning("Patch target line not found in ggml-bitnet-mad.cpp.")
|
| 33 |
|
| 34 |
+
# Patch setup_env.py to fix potential path or environment issues if necessary
|
| 35 |
+
# (Currently skipping the huggingface-cli patch as it caused ModuleNotFoundError)
|
| 36 |
+
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
def setup_engine(self, model_id="1bitLLM/bitnet_b1_58-3B"):
|
| 39 |
"""Clone and compile utilizing official setup_env.py with log streaming."""
|