Instructions to use JiaxinGe/Diffusers-BAGEL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use JiaxinGe/Diffusers-BAGEL with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("JiaxinGe/Diffusers-BAGEL", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
pipeline update
Browse files- pipeline.py +4 -5
pipeline.py
CHANGED
|
@@ -6939,7 +6939,6 @@ class InterleaveInferencer:
|
|
| 6939 |
output_dict['text'] = i
|
| 6940 |
return output_dict
|
| 6941 |
|
| 6942 |
-
from diffusers import DiffusionPipeline, PipelineOutput
|
| 6943 |
|
| 6944 |
class BagelPipeline(DiffusionPipeline):
|
| 6945 |
model_cpu_offload_seq = "bagel_model"
|
|
@@ -7034,12 +7033,12 @@ class BagelPipeline(DiffusionPipeline):
|
|
| 7034 |
**infer_kwargs,
|
| 7035 |
)
|
| 7036 |
|
| 7037 |
-
|
| 7038 |
if result.get("image") is not None:
|
| 7039 |
-
|
| 7040 |
if result.get("text") is not None:
|
| 7041 |
-
|
| 7042 |
-
return
|
| 7043 |
|
| 7044 |
def to(self, device):
|
| 7045 |
super().to(device) # moves registered modules
|
|
|
|
| 6939 |
output_dict['text'] = i
|
| 6940 |
return output_dict
|
| 6941 |
|
|
|
|
| 6942 |
|
| 6943 |
class BagelPipeline(DiffusionPipeline):
|
| 6944 |
model_cpu_offload_seq = "bagel_model"
|
|
|
|
| 7033 |
**infer_kwargs,
|
| 7034 |
)
|
| 7035 |
|
| 7036 |
+
out: Dict[str, Any] = {}
|
| 7037 |
if result.get("image") is not None:
|
| 7038 |
+
out["images"] = [result["image"]]
|
| 7039 |
if result.get("text") is not None:
|
| 7040 |
+
out["text"] = result["text"]
|
| 7041 |
+
return out
|
| 7042 |
|
| 7043 |
def to(self, device):
|
| 7044 |
super().to(device) # moves registered modules
|