Spaces:
Paused
Paused
woods-today
commited on
Commit
•
ffd715f
1
Parent(s):
4da3b9a
Working on it
Browse files
requirements-fastapi.txt
CHANGED
@@ -13,4 +13,5 @@ torch
|
|
13 |
scipy
|
14 |
ftfy
|
15 |
accelerate
|
16 |
-
uuid
|
|
|
|
13 |
scipy
|
14 |
ftfy
|
15 |
accelerate
|
16 |
+
uuid
|
17 |
+
bitsandbytes
|
routers/__pycache__/training.cpython-311.pyc
CHANGED
Binary files a/routers/__pycache__/training.cpython-311.pyc and b/routers/__pycache__/training.cpython-311.pyc differ
|
|
routers/training.py
CHANGED
@@ -10,12 +10,14 @@ from io import BytesIO
|
|
10 |
from pydantic import BaseModel
|
11 |
import base64
|
12 |
import uuid
|
13 |
-
from transformers import AutoTokenizer
|
14 |
|
15 |
from diffusers import StableDiffusionImg2ImgPipeline
|
16 |
|
17 |
tokenizer = AutoTokenizer.from_pretrained("openlm-research/open_llama_7b")
|
18 |
-
|
|
|
|
|
19 |
|
20 |
model_id_or_path = "runwayml/stable-diffusion-v1-5"
|
21 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
|
@@ -50,8 +52,6 @@ async def performAction(actionBody: ActionBody):
|
|
50 |
imgUUID = str(uuid.uuid4())
|
51 |
images[0].save(imgUUID+".png")
|
52 |
|
53 |
-
|
54 |
-
|
55 |
return {
|
56 |
"imageName" : imgUUID+".png",
|
57 |
"image": "data:image/jpeg;base64,"+img_str.decode(),
|
|
|
10 |
from pydantic import BaseModel
|
11 |
import base64
|
12 |
import uuid
|
13 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
14 |
|
15 |
from diffusers import StableDiffusionImg2ImgPipeline
|
16 |
|
17 |
tokenizer = AutoTokenizer.from_pretrained("openlm-research/open_llama_7b")
|
18 |
+
model = AutoModelForCausalLM.from_pretrained(
|
19 |
+
"openlm-research/open_llama_7b", device_map="auto", load_in_4bit=True
|
20 |
+
)
|
21 |
|
22 |
model_id_or_path = "runwayml/stable-diffusion-v1-5"
|
23 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
|
|
|
52 |
imgUUID = str(uuid.uuid4())
|
53 |
images[0].save(imgUUID+".png")
|
54 |
|
|
|
|
|
55 |
return {
|
56 |
"imageName" : imgUUID+".png",
|
57 |
"image": "data:image/jpeg;base64,"+img_str.decode(),
|