not run

#6
by sdyy - opened

Pipeline for Flux

from diffusionkit.mlx import FluxPipeline

pipeline = FluxPipeline(
shift=1.0,
model_version="argmaxinc/mlx-FLUX.1-schnell-4bit-quantized",
low_memory_mode=True,
a16=True,
w16=True,
)

HEIGHT = 512
WIDTH = 512
NUM_STEPS = 4
CFG_WEIGHT = 0

image, _ = pipeline.generate_image(
"a photo of a cat",
cfg_weight=CFG_WEIGHT,
num_steps=NUM_STEPS,
latent_size=(HEIGHT // 8, WIDTH // 8),
)

WARNING:coremltools:Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
WARNING:coremltools:Failed to load _MLModelAssetProxy: No module named 'coremltools.libcoremlpython'
WARNING:coremltools:Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
WARNING:coremltools:Failed to load _MLCPUComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
WARNING:coremltools:Failed to load _MLGPUComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
WARNING:coremltools:Failed to load _MLNeuralEngineComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
WARNING:coremltools:Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
WARNING:coremltools:Failed to load _MLComputePlanProxy: No module named 'coremltools.libcoremlpython'
/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_auth.py:94: UserWarning:
The secret HF_TOKEN does not exist in your Colab secrets.
To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.
You will be able to reuse this secret in all of your notebooks.
Please note that authentication is recommended but still optional to access public models or datasets.
warnings.warn(
INFO:diffusionkit.mlx:Pre text encoding peak memory: 0.0GB
INFO:diffusionkit.mlx:Pre text encoding active memory: 0.0GB

!diffusionkit-cli
--prompt "detailed cinematic dof render of a detailed MacBook Pro on a wooden desk in a dim room with items around, messy dirty room. On the screen are the letters 'FLUX on DiffusionKit' glowing softly. High detail hard surface render"
--model-version argmaxinc/mlx-FLUX.1-schnell-4bit-quantized
--height 768
--width 1360
--seed 1001
--step 4
--output /content/flux_on_mac.png

XGBoost version 2.1.2 has not been tested with coremltools. You may run into unexpected errors. XGBoost 1.4.2 is the most recent version that has been tested.
2024-11-27 03:30:33.588606: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-11-27 03:30:33.608866: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-11-27 03:30:33.614884: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-11-27 03:30:34.866421: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
TensorFlow version 2.17.1 has not been tested with coremltools. You may run into unexpected errors. TensorFlow 2.12.0 is the most recent version that has been tested.
Torch version 2.5.1+cu121 has not been tested with coremltools. You may run into unexpected errors. Torch 2.4.0 is the most recent version that has been tested.
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelAssetProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLCPUComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLGPUComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLNeuralEngineComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLComputePlanProxy: No module named 'coremltools.libcoremlpython'
WARNING:diffusionkit.mlx.scripts.generate_images:Disabling CFG for argmaxinc/mlx-FLUX.1-schnell-4bit-quantized model.
flux-schnell-4bit-quantized.safetensors: 100% 6.69G/6.69G [02:40<00:00, 41.8MB/s]
config.json: 100% 45.0/45.0 [00:00<00:00, 234kB/s]
ae.safetensors: 100% 335M/335M [00:07<00:00, 42.2MB/s]
clip_l/config.json: 100% 565/565 [00:00<00:00, 2.92MB/s]
model.fp16.safetensors: 100% 246M/246M [00:05<00:00, 42.0MB/s]
tokenizer_l/vocab.json: 100% 1.06M/1.06M [00:00<00:00, 8.22MB/s]
tokenizer_l/merges.txt: 100% 525k/525k [00:00<00:00, 21.7MB/s]
config.json: 100% 593/593 [00:00<00:00, 3.35MB/s]
t5xxl.safetensors: 100% 9.79G/9.79G [03:53<00:00, 42.0MB/s]
tokenizer_config.json: 100% 1.86k/1.86k [00:00<00:00, 11.0MB/s]
spiece.model: 100% 792k/792k [00:00<00:00, 6.15MB/s]
special_tokens_map.json: 100% 1.79k/1.79k [00:00<00:00, 10.5MB/s]
INFO:diffusionkit.mlx.scripts.generate_images:Output image resolution will be 768x1360
INFO:diffusionkit.mlx:Pre text encoding peak memory: 0.0GB
INFO:diffusionkit.mlx:Pre text encoding active memory: 0.0GB
terminate called after throwing an instance of 'std::runtime_error'
what(): [Matmul::eval_cpu] Currently only supports float32.

@sdyy could you give me more information about your Python environment? I just tested this checkpoint (removed it from .cache before as well)

conda create -n diffusionkit python=3.11 -y && conda activate diffusionkit
git clone https://github.com/argmaxinc/DiffusionKit.git && cd DiffusionKit
pip install -e .
diffusionkit-cli --prompt "a cat" --model-version argmaxinc/mlx-FLUX.1-schnell-4bit-quantized --steps 4 --height 768 --width 1360

and got this output
out.png

colab t4

XGBoost version 2.1.3 has not been tested with coremltools. You may run into unexpected errors. XGBoost 1.4.2 is the most recent version that has been tested.
2024-12-15 19:48:38.618974: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-12-15 19:48:38.652016: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-12-15 19:48:38.661984: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-12-15 19:48:38.684955: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-12-15 19:48:40.740859: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
TensorFlow version 2.17.1 has not been tested with coremltools. You may run into unexpected errors. TensorFlow 2.12.0 is the most recent version that has been tested.
Torch version 2.5.1+cu121 has not been tested with coremltools. You may run into unexpected errors. Torch 2.4.0 is the most recent version that has been tested.
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelAssetProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLCPUComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLGPUComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLNeuralEngineComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLComputePlanProxy: No module named 'coremltools.libcoremlpython'
WARNING:diffusionkit.mlx.scripts.generate_images:Disabling CFG for argmaxinc/mlx-FLUX.1-schnell-4bit-quantized model.
INFO:diffusionkit.mlx.scripts.generate_images:Output image resolution will be 64x64
INFO:diffusionkit.mlx:Pre text encoding peak memory: 0.0GB
INFO:diffusionkit.mlx:Pre text encoding active memory: 0.0GB
terminate called after throwing an instance of 'std::runtime_error'
what(): [Matmul::eval_cpu] Currently only supports float32.

what(): [Matmul::eval_cpu] Currently only supports float32.

in config file chane from bflot to float32.

but not run

!pip install scikit-learn==1.5.1

!pip install torch==2.4

Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelAssetProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLCPUComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLGPUComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLNeuralEngineComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLComputePlanProxy: No module named 'coremltools.libcoremlpython'
WARNING:diffusionkit.mlx.scripts.generate_images:Disabling CFG for argmaxinc/mlx-FLUX.1-schnell-4bit-quantized model.
INFO:diffusionkit.mlx.scripts.generate_images:Output image resolution will be 768x1360
INFO:diffusionkit.mlx:Pre text encoding peak memory: 0.0GB
INFO:diffusionkit.mlx:Pre text encoding active memory: 0.0GB
terminate called after throwing an instance of 'std::runtime_error'
what(): [Matmul::eval_cpu] Currently only supports float32.

Have you tried it on Colab T4?

!diffusionkit-cli --prompt "car"
--model-version argmaxinc/mlx-FLUX.1-schnell
--height 128
--width 128
--seed 1001
--step 4
--output ./flux_on_mac.png

2024-12-15 22:20:23.914476: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2024-12-15 22:20:24.018000: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2024-12-15 22:20:24.019088: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-12-15 22:20:26.032299: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelAssetProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLCPUComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLGPUComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLNeuralEngineComputeDeviceProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLModelProxy: No module named 'coremltools.libcoremlpython'
Failed to load _MLComputePlanProxy: No module named 'coremltools.libcoremlpython'
WARNING:diffusionkit.mlx.scripts.generate_images:Disabling CFG for argmaxinc/mlx-FLUX.1-schnell model.
INFO:diffusionkit.mlx.scripts.generate_images:Output image resolution will be 128x128
INFO:diffusionkit.mlx:Pre text encoding peak memory: 0.0GB
INFO:diffusionkit.mlx:Pre text encoding active memory: 0.0GB
terminate called after throwing an instance of 'std::runtime_error'
what(): [Matmul::eval_cpu] Currently only supports float32.

MLX
MLX is a NumPy-like array framework designed for efficient and flexible machine learning on Apple silicon, brought to you by Apple machine learning research.

it for apple

it not run in colab

thank you

EduardoPacheco changed discussion status to closed

Sign up or log in to comment