I have a image generator which samples a few fairly large datasets (around 10K words per category).

The user selects a dataset , from which a word is randomly selected.

As such , I only need to load the dataset which is currently selected.

I’d like for the other datasets to be un-loaded until the user selects them.

Is there a way to do this?

Or , can this problem be resolved by other means?

  • perchance@lemmy.worldM
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    8 months ago

    Great to see you’re pushing the limits of Perchance in practical/real usage! I just made this plugin which is hopefully helpful: https://perchance.org/dynamic-import-plugin

    I probably should have created something like this quite a while ago, since there have been similar requests before.

    Pinging @VioneT@lemmy.world

    (Aside: Heads up that your fusion-text-to-image-plugin may break in the future if I update the internals/server-side stuff of text-to-image-plugin. The plugin has backwards-compat guarantees on the existing features that it exposes, of course, but there won’t be any notice for internal changes that I make to that plugin, including server-side stuff. You might have forked it before I put the warning there. I’d recommend posting to this forum with feature requests for anything you want rather than forking. Note that it’s fine to import text-to-image-plugin into fusion-text-to-image-plugin just to add a ‘wrapper’ around it if you are fine with its current feature-set and just want to create your own ‘interface’ to those features. But yeah, changing the internals of the text-to-image-plugin is a recipe for trouble - it basically means that you have to constantly watch text-to-image-plugin, and e.g. 2 years from now all your generators suddenly break due to an internal change I made, and maybe you don’t notice for several weeks, during which time all the people that were regular users have moved on. All of that said, it’s okay to edit the internals if you understand the above risks :)

    • VioneT@lemmy.worldM
      link
      fedilink
      English
      arrow-up
      3
      ·
      8 months ago

      Just some clarification, currently it gives the whole generator i.e. not only the specified output at the $output. I’m not saying that it is bad, but I would guess that it is counter-intuitive with how the regular imports work. Possibly an option?

        • allo@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          8 months ago

          only thing out of place catches my eye is this sentence: Due to the above points, you should only use this plugin if the loading speed of your generator significantly impacted by the large number of imports that you have.

          like how mine was missing a word, yours is missing a word :) 10 points if you automatically caught that mine was missing a word. another 10 points if u automatically caught where the target sentence was missing a word.

    • AdComfortable1514@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      8 months ago

      Wow! Thank you so much ❤️! I’ll make great use of this.

      The best datasets are usually very large. I’ve already split the datasets I’m using into smaller generators.

      In total , I have 38 generators prepared with 10K unique words in each, a generator with 29K unique names , a 15K word generator for prepositions , plus the 5 separate generators for 47K CLIP tokens.

      I’ve had to prioritize which ones to load before , but this feature open up a bunch of new options.

      I’m looking forward to testing it out ( ; v ;)b!

      EDIT : Here’s the first generator I made with the dynamic-imports plugin : https://perchance.org/fusion-t2i-names

        • AdComfortable1514@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          8 months ago

          Duly noted. And I totally agree.

          I will use the original text-to-image plugin for the public version , to avoid future troubles.

          EDIT : Done

    • BluePower@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      8 months ago

      Interesting plugin! I might as well use this for my generator hub page, and also its preview version, because it needs to import the base source of the generator manager (power-generator-manager) to be able to retrieve and sync the generator lists and the “news & updates” from that, so I don’t have to change it in case I needed to change anything in the gen list (e.g., the description or, if I had released a new generator, I’d need to add that generator to the list). And that’s to reduce some loading time.

  • BluePower@mastodon.social
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    8 months ago

    @AdComfortable1514 Kind of a bug report to your generator, but on the base, main and negative prompt inputs the hide button initially showed no text and sitting next to the input labels. Let me know if this was a bug!

    https://user-uploads.perchance.org/file/261b77d86fe9133ea7fab4813a269aa8.jpeg

  • allo@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    8 months ago

    i tried to make some images on your generator today and felt weird lag, i guess from this, and may see your problem

    • VioneT@lemmy.worldM
      link
      fedilink
      English
      arrow-up
      3
      ·
      8 months ago

      The way the imports work, Perchance first checks the code for the imports, and then imports them before loading the page to avoid errors.

      Currently, we don’t know a way to load an import only if they are to be used, which is the purpose of the post.