Skip to content

Node example -> Class CoreMLExecution is implemented in both #10

Description

@zaqqaz

Just tried node example (with node v20.10.0)

import { DiffusionPipeline } from '@aislamov/diffusers.js'
import { PNG } from 'pngjs'

const pipe = DiffusionPipeline.fromPretrained('aislamov/stable-diffusion-2-1-base-onnx')
const images = pipe.run({
  prompt: "an astronaut running a horse",
  numInferenceSteps: 30,
})

const data = await images[0].mul(255).round().clipByValue(0, 255).transpose(0, 2, 3, 1)

const p = new PNG({ width: 512, height: 512, inputColorType: 2 })
p.data = Buffer.from(data.data)
p.pack().pipe(fs.createWriteStream('output.png')).on('finish', () => {
  console.log('Image saved as output.png');
})

and got such error

objc[63467]: Class CoreMLExecution is implemented in both  node_modules/@aislamov/diffusers.js/node_modules/onnxruntime-node/bin/napi-v3/darwin/arm64/libonnxruntime.1.16.1.dylib (0x118318cb8) and node_modules/onnxruntime-node/bin/napi-v3/darwin/arm64/libonnxruntime.1.14.0.dylib (0x11abbceb0). One of the two will be used. Which one is undefined.

file:///***/test.mjs:5
const images = pipe.run({
                    ^

TypeError: pipe.run is not a function
    at file:///***/test.mjs:5:21

Activity

  1. zaqqaz commented on Dec 5, 2023

    @zaqqaz
    Author

    Building for source and using examples seem to be working fine, so likely an issue with dependencies in published version, haven't investigated it further yet.

  2. rbourgeat commented on Feb 22, 2024

    @rbourgeat
    objc[63467]: Class CoreMLExecution is implemented in both  node_modules/@aislamov/diffusers.js/node_modules/onnxruntime-node/bin/napi-v3/darwin/arm64/libonnxruntime.1.16.1.dylib (0x118318cb8) and node_modules/onnxruntime-node/bin/napi-v3/darwin/arm64/libonnxruntime.1.14.0.dylib (0x11abbceb0). One of the two will be used. Which one is undefined.
    
    file:///***/test.mjs:5
    const images = pipe.run({
                        ^
    
    TypeError: pipe.run is not a function
        at file:///***/test.mjs:5:21
    

    Same error:

    Tab1.tsx:14 Uncaught (in promise) TypeError: pipe.run is not a function
        at generateImage (Tab1.tsx:14:25)
        at Tab1.tsx:32:5
    

    My code:

      const generateImage = async () => {
        const pipe = DiffusionPipeline.fromPretrained('aislamov/stable-diffusion-2-1-base-onnx', { revision: 'cpu' })
        const images = pipe.run({
          prompt: "an astronaut running a horse",
          numInferenceSteps: 30,
        });
    
        const data = await images[0].mul(255).round().clipByValue(0, 255).transpose(0, 2, 3, 1);
    
        const p = new PNG({ width: 512, height: 512, inputColorType: 2 });
        p.data = Buffer.from(data.data);
        p.pack().pipe(fs.createWriteStream('output.png')).on('finish', () => {
          console.log('Image saved as output.png');
        });
    
        setImageData(p.data);
      };
  3. yousef-muc commented on Apr 22, 2024

    @yousef-muc
    objc[63467]: Class CoreMLExecution is implemented in both  node_modules/@aislamov/diffusers.js/node_modules/onnxruntime-node/bin/napi-v3/darwin/arm64/libonnxruntime.1.16.1.dylib (0x118318cb8) and node_modules/onnxruntime-node/bin/napi-v3/darwin/arm64/libonnxruntime.1.14.0.dylib (0x11abbceb0). One of the two will be used. Which one is undefined.
    
    file:///***/test.mjs:5
    const images = pipe.run({
                        ^
    
    TypeError: pipe.run is not a function
        at file:///***/test.mjs:5:21
    

    Same error:

    Tab1.tsx:14 Uncaught (in promise) TypeError: pipe.run is not a function
        at generateImage (Tab1.tsx:14:25)
        at Tab1.tsx:32:5
    

    My code:

      const generateImage = async () => {
        const pipe = DiffusionPipeline.fromPretrained('aislamov/stable-diffusion-2-1-base-onnx', { revision: 'cpu' })
        const images = pipe.run({
          prompt: "an astronaut running a horse",
          numInferenceSteps: 30,
        });
    
        const data = await images[0].mul(255).round().clipByValue(0, 255).transpose(0, 2, 3, 1);
    
        const p = new PNG({ width: 512, height: 512, inputColorType: 2 });
        p.data = Buffer.from(data.data);
        p.pack().pipe(fs.createWriteStream('output.png')).on('finish', () => {
          console.log('Image saved as output.png');
        });
    
        setImageData(p.data);
      };

    Hey,

    its a promise, u have to call "await":

    const pipe = await DiffusionPipeline.fromPretrained('aislamov/stable-diffusion-2-1-base-onnx', { revision: 'cpu' })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions