Spaces:
Runtime error
Runtime error
ollama_pid
Browse filesresult = subprocess.run(ollama_pid, shell=True, capture_output=True)
print(result)
if result.returncode != 0:
raise Exception(f"Error retrieving Ollama PID {result.stderr}")
print(f"Ollama PID Retrived: {ollama_pid}")
app.py
CHANGED
@@ -32,10 +32,17 @@ def regenerate_pubkey(pubkey, oauth_token: gr.OAuthToken | None):
|
|
32 |
generate_ollama_pid_file = f"echo $! > ollama.pid"
|
33 |
ollama_pubkey = f"cat {HOME}/{hash_oauth}/.ollama/id_ed25519.pub"
|
34 |
ollama_start = f"HOME={HOME}/{hash_oauth} ollama serve & {generate_ollama_pid_file} & sleep 5"
|
35 |
-
|
|
|
36 |
delete_home = f"rm -Rf {HOME}/{hash_oauth}/.ollama"
|
37 |
|
38 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
result = subprocess.run(ollama_stop, shell=True, capture_output=True)
|
40 |
print(result)
|
41 |
if result.returncode != 0:
|
@@ -46,7 +53,7 @@ def regenerate_pubkey(pubkey, oauth_token: gr.OAuthToken | None):
|
|
46 |
print(result)
|
47 |
if result.returncode != 0:
|
48 |
raise Exception(f"Error removing Ollama HOME folder {result.stderr}")
|
49 |
-
print("Ollama HOME
|
50 |
|
51 |
result = subprocess.run(ollama_start, shell=True, capture_output=True)
|
52 |
print(result)
|
@@ -83,7 +90,8 @@ def ollamafy_model(login, model_id, ollama_library_username , ollama_q_method, l
|
|
83 |
# username = whoami(oauth_token.token)["name"]
|
84 |
model_name = model_id.split('/')[-1]
|
85 |
fp16 = f"{model_name}-fp16.gguf"
|
86 |
-
|
|
|
87 |
delete_home = f"rm -Rf {HOME}/{hash_oauth}/.ollama"
|
88 |
download_gguf = f"wget download_gguf_link"
|
89 |
|
@@ -212,6 +220,12 @@ def ollamafy_model(login, model_id, ollama_library_username , ollama_q_method, l
|
|
212 |
shutil.rmtree(model_name, ignore_errors=True)
|
213 |
print("Folder cleaned up successfully!")
|
214 |
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
result = subprocess.run(ollama_stop, shell=True, capture_output=True)
|
216 |
print(result)
|
217 |
if result.returncode != 0:
|
|
|
32 |
generate_ollama_pid_file = f"echo $! > ollama.pid"
|
33 |
ollama_pubkey = f"cat {HOME}/{hash_oauth}/.ollama/id_ed25519.pub"
|
34 |
ollama_start = f"HOME={HOME}/{hash_oauth} ollama serve & {generate_ollama_pid_file} & sleep 5"
|
35 |
+
ollama_pid = f"cat {HOME}/{hash_oauth}/ollama.pid"
|
36 |
+
ollama_stop = f"kill -9 {ollama_pid}"
|
37 |
delete_home = f"rm -Rf {HOME}/{hash_oauth}/.ollama"
|
38 |
|
39 |
try:
|
40 |
+
result = subprocess.run(ollama_pid, shell=True, capture_output=True)
|
41 |
+
print(result)
|
42 |
+
if result.returncode != 0:
|
43 |
+
raise Exception(f"Error retrieving Ollama PID {result.stderr}")
|
44 |
+
print(f"Ollama PID Retrived: {ollama_pid}")
|
45 |
+
|
46 |
result = subprocess.run(ollama_stop, shell=True, capture_output=True)
|
47 |
print(result)
|
48 |
if result.returncode != 0:
|
|
|
53 |
print(result)
|
54 |
if result.returncode != 0:
|
55 |
raise Exception(f"Error removing Ollama HOME folder {result.stderr}")
|
56 |
+
print("Ollama HOME folder removed successfully!")
|
57 |
|
58 |
result = subprocess.run(ollama_start, shell=True, capture_output=True)
|
59 |
print(result)
|
|
|
90 |
# username = whoami(oauth_token.token)["name"]
|
91 |
model_name = model_id.split('/')[-1]
|
92 |
fp16 = f"{model_name}-fp16.gguf"
|
93 |
+
ollama_pid = f"cat {HOME}/{hash_oauth}/ollama.pid"
|
94 |
+
ollama_stop = f"kill -9 {ollama_pid}"
|
95 |
delete_home = f"rm -Rf {HOME}/{hash_oauth}/.ollama"
|
96 |
download_gguf = f"wget download_gguf_link"
|
97 |
|
|
|
220 |
shutil.rmtree(model_name, ignore_errors=True)
|
221 |
print("Folder cleaned up successfully!")
|
222 |
|
223 |
+
result = subprocess.run(ollama_pid, shell=True, capture_output=True)
|
224 |
+
print(result)
|
225 |
+
if result.returncode != 0:
|
226 |
+
raise Exception(f"Error retrieving Ollama PID {result.stderr}")
|
227 |
+
print(f"Ollama PID Retrived: {ollama_pid}")
|
228 |
+
|
229 |
result = subprocess.run(ollama_stop, shell=True, capture_output=True)
|
230 |
print(result)
|
231 |
if result.returncode != 0:
|