Spaces:
Sleeping
Sleeping
JossyJoe
commited on
Commit
•
7507ed0
0
Parent(s):
first commit
Browse files- .gitignore +67 -0
- Dockerfile +12 -0
- README.md +7 -0
- Testing_Live_deploy +1 -0
- main.py +33 -0
- requirements.txt +6 -0
.gitignore
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Python bytecode
|
2 |
+
*.pyc
|
3 |
+
*.pyo
|
4 |
+
*.pyd
|
5 |
+
__pycache__/
|
6 |
+
|
7 |
+
# Virtual environment
|
8 |
+
venv/
|
9 |
+
.env/
|
10 |
+
|
11 |
+
# Distribution / packaging
|
12 |
+
build/
|
13 |
+
dist/
|
14 |
+
*.egg-info/
|
15 |
+
*.egg
|
16 |
+
|
17 |
+
# IDEs and editors
|
18 |
+
.vscode/
|
19 |
+
.idea/
|
20 |
+
*.suo
|
21 |
+
*.user
|
22 |
+
*.userosscache
|
23 |
+
*.suo
|
24 |
+
*.swp
|
25 |
+
*.swo
|
26 |
+
*.swn
|
27 |
+
*.dirstat
|
28 |
+
*.log
|
29 |
+
*.pot
|
30 |
+
*.mo
|
31 |
+
|
32 |
+
# Migrations
|
33 |
+
migrations/
|
34 |
+
alembic/
|
35 |
+
|
36 |
+
# Database
|
37 |
+
*.sqlite3
|
38 |
+
*.db
|
39 |
+
|
40 |
+
# Jupyter Notebook
|
41 |
+
.ipynb_checkpoints/
|
42 |
+
|
43 |
+
|
44 |
+
# Environment variables
|
45 |
+
.env
|
46 |
+
|
47 |
+
# Coverage reports
|
48 |
+
.coverage
|
49 |
+
.coverage.*
|
50 |
+
*.cover
|
51 |
+
nosetests.xml
|
52 |
+
coverage.xml
|
53 |
+
*.coveragerc
|
54 |
+
*.tox
|
55 |
+
*.nox
|
56 |
+
*.hypothesis
|
57 |
+
*.pytest_cache/
|
58 |
+
*.tox/
|
59 |
+
*.nox/
|
60 |
+
|
61 |
+
# FastAPI specific files
|
62 |
+
*.log
|
63 |
+
*.sqlite3
|
64 |
+
*.db
|
65 |
+
|
66 |
+
# Pytest
|
67 |
+
*.pytest_cache/
|
Dockerfile
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
WORKDIR /code
|
4 |
+
|
5 |
+
COPY ./requirements.txt /code/requirements.txt
|
6 |
+
|
7 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
+
|
9 |
+
COPY ./zephyr-7b-beta.Q4_K_S.gguf /code/zephyr-7b-beta.Q4_K_S.gguf
|
10 |
+
COPY ./main.py /code/main.py
|
11 |
+
|
12 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
title: LLM Deployment Testing Api
|
2 |
+
emoji: 😻
|
3 |
+
colorFrom: purple
|
4 |
+
colorTo: pink
|
5 |
+
sdk: docker
|
6 |
+
pinned: false
|
7 |
+
license: mit
|
Testing_Live_deploy
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 57109324175b792335ec9aa39d1d18279a7acb8e
|
main.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from ctransformers import AutoModelForCausalLM
|
2 |
+
from fastapi import FastAPI, Form
|
3 |
+
from pydantic import BaseModel
|
4 |
+
|
5 |
+
app = FastAPI()
|
6 |
+
|
7 |
+
|
8 |
+
@app.get("/")
|
9 |
+
def read_root():
|
10 |
+
return {"Hello": "World"}
|
11 |
+
|
12 |
+
# Model loading
|
13 |
+
# llm = AutoModelForCausalLM.from_pretrained("zephyr-7b-beta.Q4_K_S.gguf",
|
14 |
+
# model_type='mistral',
|
15 |
+
# max_new_tokens = 1096,
|
16 |
+
# threads = 3,
|
17 |
+
# )
|
18 |
+
|
19 |
+
# #Pydantic object
|
20 |
+
# class validation(BaseModel):
|
21 |
+
# prompt: str
|
22 |
+
|
23 |
+
# #Fast API
|
24 |
+
# app = FastAPI()
|
25 |
+
|
26 |
+
# #Zephyr completion
|
27 |
+
# @app.post("/llm_on_cpu")
|
28 |
+
# async def stream(item: validation):
|
29 |
+
# system_prompt = 'Below is an instruction that describes a task. Write a response that appropriately completes the request.'
|
30 |
+
# E_INST = "</s>"
|
31 |
+
# user, assistant = "<|user|>", "<|assistant|>"
|
32 |
+
# prompt = f"{system_prompt}{E_INST}\n{user}\n{item.prompt.strip()}{E_INST}\n{assistant}\n"
|
33 |
+
# return llm(prompt)
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
python-multipart
|
2 |
+
fastapi
|
3 |
+
pydantic
|
4 |
+
uvicorn
|
5 |
+
requests
|
6 |
+
ctransformers
|