Jingya HF Staff commited on
Commit
29d8d49
·
verified ·
1 Parent(s): fbb1255

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +21 -0
README.md CHANGED
@@ -8,4 +8,25 @@ Exported with (Inferentia 2 only):
8
  optimum-cli export neuron --model black-forest-labs/FLUX.1-Kontext-dev --tensor_parallel_size 8 --batch_size 1 --height 1024 --width 1024 --num_images_per_prompt 1 --sequence_length 512 --torch_dtype bfloat16 flux_kontext_neuron_1024_tp8/
9
  ```
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
 
8
  optimum-cli export neuron --model black-forest-labs/FLUX.1-Kontext-dev --tensor_parallel_size 8 --batch_size 1 --height 1024 --width 1024 --num_images_per_prompt 1 --sequence_length 512 --torch_dtype bfloat16 flux_kontext_neuron_1024_tp8/
9
  ```
10
 
11
+ Inference:
12
+
13
+ ```python
14
+ from diffusers.utils import load_image
15
+
16
+ from optimum.neuron import NeuronFluxKontextPipeline
17
+
18
+
19
+ pipe = NeuronFluxKontextPipeline.from_pretrained("Jingya/Flux.1-Kontext-dev-1024x1024-neuronx-tp8")
20
+ input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
21
+ image = pipe(
22
+ image=input_image,
23
+ prompt="Add a hat to the cat",
24
+ guidance_scale=2.5
25
+ ).images[0]
26
+ image = image.resize(input_image.size)
27
+ image.save("flux_kontext.png")
28
+ ```
29
+
30
+
31
+
32