Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Add missing 'nsfw,' tag to negative_prompt presets in NAIv3 and FurryV3 #93

Closed
TimmekHW opened this issue Jan 1, 2025 · 12 comments · Fixed by #94 or #95
Closed

Bug: Add missing 'nsfw,' tag to negative_prompt presets in NAIv3 and FurryV3 #93

TimmekHW opened this issue Jan 1, 2025 · 12 comments · Fixed by #94 or #95
Labels
question Further information is requested

Comments

@TimmekHW
Copy link

TimmekHW commented Jan 1, 2025

image

Pls add method Pls add method as in novelai-api/novelai_api/_high_level.py
https://github.com/Aedial/novelai-api/blob/15b581f791920f4b8fb471ad4f6bc01bc764c8da/novelai_api/_high_level.py#L481

Because by default, in NAIv3 and FurryV3, negative prompt lack the nsfw, tag at the beginning. and it is deleted if the nsfw tag is present in the promo. This method is missing in your framework.

def build_preset(negative, chars, flags, strength, seed, is_best=False, image=None):
    preset = Params(
        width=832,
        height=1216,
        characterPrompts=chars,
        seed=seed or random.randint(0, 4294967295 - 7),
        scale=5,
        negative_prompt=negative,
        strength=strength,
        qualityToggle=True,
        noise_schedule="karras",
        sampler=Sampler.K_EULER_ANCESTRAL,
        ucPreset=UCPreset.TYPE0,
        
        steps=23,
        n_samples=1,
        dynamic_thresholding=False,
        skip_cfg_above_sigma=None,
        sm=False,
        sm_dyn=False,
        add_original_image=True,
        
        reference_image_multiple=[],
        reference_information_extracted_multiple=[],
        reference_strength_multiple=[],
        
        use_coords=any([c.center != PositionMap.AUTO for c in chars])
    )
    ```
@neutron-nerve neutron-nerve bot changed the title NAIv3 and FurryV3 don't have "nsfw, " in at the beginning, negative_prompt presets heavy for text2img Bug: Add missing 'nsfw,' tag to negative_prompt presets in NAIv3 and FurryV3 Jan 1, 2025
@neutron-nerve neutron-nerve bot added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed labels Jan 1, 2025
@sudoskys
Copy link
Member

sudoskys commented Jan 2, 2025

I will investigate this issue once the power and water supply to the house is restored.

@sudoskys sudoskys added question Further information is requested enhancement New feature or request and removed enhancement New feature or request help wanted Extra attention is needed bug Something isn't working labels Jan 2, 2025
@sudoskys
Copy link
Member

sudoskys commented Jan 2, 2025

It would be better if you could explain why you need this method instead of directly initializing the Param class.

@sudoskys
Copy link
Member

sudoskys commented Jan 2, 2025

Because by default, in NAIv3 and FurryV3, negative prompt lack the nsfw, tag at the beginning. and it is deleted if the nsfw tag is present in the promo.

This situation has not been reproduced

@TimmekHW
Copy link
Author

TimmekHW commented Jan 2, 2025

It would be better if you could explain why you need this method instead of directly initializing the Param class.

We have telegram and VK bot. We are distributing Novelai in the CIS. $ 6 and $ 25 to try it is too expensive. And users from Russia just can't buy it. And so we give free generation attempts in NAIv3 and NAIv4. Before that, we used the framework of one of the AnlasTeam, but he has no plans to add NAIv4 in the near future.

@sudoskys
Copy link
Member

sudoskys commented Jan 2, 2025

Ah, I was just wondering why you thought we needed to add the build_preset method, You can initialize them directly, just like __init__ does.

        await GenerateImageInfer(
            input="1girl",
            model=Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
            parameters=Params(
                width=832,
                height=1216,
                characterPrompts=[],
                seed=random.randint(0, 4294967295 - 7),
                scale=5,
                negative_prompt="lowres",
                qualityToggle=True,
                sampler=Sampler.K_EULER_ANCESTRAL,
                ucPreset=UCPreset.TYPE0,
                steps=23,
                n_samples=1,
            )
        ).request(session=_login_credential)

@sudoskys sudoskys assigned sudoskys and unassigned sudoskys Jan 2, 2025
@sudoskys sudoskys linked a pull request Jan 2, 2025 that will close this issue
@sudoskys sudoskys reopened this Jan 2, 2025
@sudoskys sudoskys removed the enhancement New feature or request label Jan 2, 2025
@TimmekHW
Copy link
Author

TimmekHW commented Jan 2, 2025

Ah, I was just wondering why you thought we needed to add the build_preset method, You can initialize them directly, just like __init__ does.

        await GenerateImageInfer(
            input="1girl",
            model=Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
            parameters=Params(
                width=832,
                height=1216,
                characterPrompts=[],
                seed=random.randint(0, 4294967295 - 7),
                scale=5,
                negative_prompt="lowres",
                qualityToggle=True,
                sampler=Sampler.K_EULER_ANCESTRAL,
                ucPreset=UCPreset.TYPE0,
                steps=23,
                n_samples=1,
            )
        ).request(session=_login_credential)

No, I don't think you need to add my method. I'm just talking about the problem and showing you my code so that you can reproduce the problem or tell me how to fix it.

My question is that NAIv3 and FurryV3 have "nsfw," sewn into UCpreset by default, which is removed if "prompt" has this tag. You don't have this functionality. But it is in the framework from the developer AnlasTeam.

https://github.com/Aedial/novelai-api/blob/15b581f791920f4b8fb471ad4f6bc01bc764c8da/novelai_api/_high_level.py#L481

@TimmekHW
Copy link
Author

TimmekHW commented Jan 2, 2025

Default gen. UCpreset “heavy” have tag “nsfw, “ in negative_prompt
IMG_6599

Klee Genshin impact  s-568412227

@sudoskys
Copy link
Member

sudoskys commented Jan 2, 2025

I get it, but it might break the consistency of performance.

But this is reasonable, the problem is that our validator only needs to ensure that the data is not reported as an error. It is not suitable for additional operations beyond the standard implementation (novelai.net)

When we added this validator, some people complained that the framework was too intrusive.

@sudoskys
Copy link
Member

sudoskys commented Jan 2, 2025

I will add this mutual exclusion condition tomorrow at noon.

We may need more fine-grained control over validators injected via some parameters, which is possible with the help of pydantic.

This way even if someone hates validators they can disable them.

@sudoskys
Copy link
Member

sudoskys commented Jan 2, 2025

This is a design question, similar to high level and low level design.

This comment was marked as off-topic.

@sudoskys
Copy link
Member

sudoskys commented Jan 3, 2025

https://github.com/LlmKira/novelai-python/pull/95/files#diff-9d35d3d3c1d6103e24a2fc69141933b4a2ddd400a87f628d1d6792c9ee797e20R68

You can now chain manually set excludes (which remove conflicting negative words). It is False by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
2 participants