Skip to content

Commit f8ee74d

Browse files
committed
tests with AutoPipeline
1 parent 8720a03 commit f8ee74d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

backend/python/diffusers/backend_diffusers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def LoadModel(self, request, context):
136136
print(f"Loading model {request.Model}...", file=sys.stderr)
137137
print(f"Request {request}", file=sys.stderr)
138138
torchType = torch.float32
139-
variant = ""
139+
variant = None
140140

141141
if request.F16Memory:
142142
torchType = torch.float16
@@ -165,8 +165,9 @@ def LoadModel(self, request, context):
165165
fromSingleFile = request.Model.startswith("http") or request.Model.startswith("/") or local
166166

167167

168+
# If PipelineType is not defined, defaults to AutoPipelineForText2Image
168169
if request.PipelineType == "":
169-
request.PipelineType == "AutoPipelineForText2Image"
170+
request.PipelineType = "AutoPipelineForText2Image"
170171

171172
## img2img
172173
if (request.PipelineType == "StableDiffusionImg2ImgPipeline") or (request.IMG2IMG and request.PipelineType == ""):

backend/python/diffusers/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_load_model(self):
5353
self.setUp()
5454
with grpc.insecure_channel("localhost:50051") as channel:
5555
stub = backend_pb2_grpc.BackendStub(channel)
56-
response = stub.LoadModel(backend_pb2.ModelOptions(Model="runwayml/stable-diffusion-v1-5", PipelineType="StableDiffusionPipeline"))
56+
response = stub.LoadModel(backend_pb2.ModelOptions(Model="runwayml/stable-diffusion-v1-5"))
5757
self.assertTrue(response.success)
5858
self.assertEqual(response.message, "Model loaded successfully")
5959
except Exception as err:
@@ -71,7 +71,7 @@ def test(self):
7171
self.setUp()
7272
with grpc.insecure_channel("localhost:50051") as channel:
7373
stub = backend_pb2_grpc.BackendStub(channel)
74-
response = stub.LoadModel(backend_pb2.ModelOptions(Model="runwayml/stable-diffusion-v1-5", PipelineType="StableDiffusionPipeline"))
74+
response = stub.LoadModel(backend_pb2.ModelOptions(Model="runwayml/stable-diffusion-v1-5"))
7575
print(response.message)
7676
self.assertTrue(response.success)
7777
image_req = backend_pb2.GenerateImageRequest(positive_prompt="cat", width=16,height=16, dst="test.jpg")

0 commit comments

Comments
 (0)