Petro
commited on
Commit
·
b0a8dfd
1
Parent(s):
48afe02
First model version
Browse files- main.py +12 -3
- requirements.txt +3 -1
main.py
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
|
|
|
|
|
| 1 |
from langchain.llms import CTransformers
|
| 2 |
from fastapi import FastAPI
|
| 3 |
from pydantic import BaseModel
|
| 4 |
|
| 5 |
file_name = "zephyr-7b-beta.Q4_K_S.gguf"
|
| 6 |
config = {
|
| 7 |
-
"
|
| 8 |
-
"
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
}
|
| 11 |
llm = CTransformers(
|
| 12 |
model=file_name,
|
|
|
|
|
|
|
| 13 |
**config
|
| 14 |
)
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
class validation(BaseModel):
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
from langchain.llms import CTransformers
|
| 4 |
from fastapi import FastAPI
|
| 5 |
from pydantic import BaseModel
|
| 6 |
|
| 7 |
file_name = "zephyr-7b-beta.Q4_K_S.gguf"
|
| 8 |
config = {
|
| 9 |
+
"max_new_token": 1024,
|
| 10 |
+
"repetition_penalty": 1.1,
|
| 11 |
+
"temperature": 0.5,
|
| 12 |
+
"top_k": 50,
|
| 13 |
+
"top_p": 0.9,
|
| 14 |
+
"stream": True,
|
| 15 |
+
"threads": int(os.cpu_count() / 2),
|
| 16 |
}
|
| 17 |
llm = CTransformers(
|
| 18 |
model=file_name,
|
| 19 |
+
model_type="mistral",
|
| 20 |
+
lib="avx2",
|
| 21 |
**config
|
| 22 |
)
|
| 23 |
+
print(llm)
|
| 24 |
|
| 25 |
|
| 26 |
class validation(BaseModel):
|
requirements.txt
CHANGED
|
@@ -5,4 +5,6 @@ uvicorn
|
|
| 5 |
requests
|
| 6 |
python-dotenv
|
| 7 |
ctransformers
|
| 8 |
-
|
|
|
|
|
|
|
|
|
| 5 |
requests
|
| 6 |
python-dotenv
|
| 7 |
ctransformers
|
| 8 |
+
torch
|
| 9 |
+
langchain
|
| 10 |
+
ctransformers
|