Spaces:
Runtime error
Runtime error
Commit ·
9a8cd2a
1
Parent(s): 5ff5c8e
fix
Browse files- __pycache__/llm_func.cpython-310.pyc +0 -0
- __pycache__/main.cpython-310.pyc +0 -0
- llm_func.py +5 -6
- requirements.txt +2 -1
__pycache__/llm_func.cpython-310.pyc
ADDED
|
Binary file (908 Bytes). View file
|
|
|
__pycache__/main.cpython-310.pyc
ADDED
|
Binary file (869 Bytes). View file
|
|
|
llm_func.py
CHANGED
|
@@ -4,10 +4,9 @@ model = Llama.from_pretrained(repo_id="tensorblock/SmolLM-135M-Instruct-GGUF",fi
|
|
| 4 |
|
| 5 |
|
| 6 |
def mdl(input):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
output = model(
|
| 10 |
-
prompt=f"""<|im_start|>system
|
| 11 |
You are a helpful chatbot.<|im_end|>
|
| 12 |
<|im_start|>user
|
| 13 |
{input}<|im_end|>""",
|
|
@@ -17,6 +16,6 @@ def mdl(input):
|
|
| 17 |
echo=False,
|
| 18 |
stop=["#"])
|
| 19 |
end = time.time()
|
| 20 |
-
|
| 21 |
-
|
| 22 |
return output["choices"][0]["text"].replace('\nassistant\n','')
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
def mdl(input):
|
| 7 |
+
print(input)
|
| 8 |
+
start = time.time()
|
| 9 |
+
output = model(prompt=f"""<|im_start|>system
|
|
|
|
| 10 |
You are a helpful chatbot.<|im_end|>
|
| 11 |
<|im_start|>user
|
| 12 |
{input}<|im_end|>""",
|
|
|
|
| 16 |
echo=False,
|
| 17 |
stop=["#"])
|
| 18 |
end = time.time()
|
| 19 |
+
total_time = end - start
|
| 20 |
+
print(f"Execution time: {total_time:.2f} seconds")
|
| 21 |
return output["choices"][0]["text"].replace('\nassistant\n','')
|
requirements.txt
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
fastapi
|
| 2 |
uvicorn
|
| 3 |
llama-cpp-python==0.3.6 --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 4 |
-
huggingface
|
|
|
|
|
|
| 1 |
fastapi
|
| 2 |
uvicorn
|
| 3 |
llama-cpp-python==0.3.6 --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 4 |
+
huggingface
|
| 5 |
+
huggingface-hub
|