novelai-python 0.7.6__tar.gz → 0.7.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. {novelai_python-0.7.6 → novelai_python-0.7.8}/PKG-INFO +4 -3
  2. {novelai_python-0.7.6 → novelai_python-0.7.8}/README.md +2 -1
  3. {novelai_python-0.7.6 → novelai_python-0.7.8}/pyproject.toml +2 -2
  4. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/_enum.py +159 -10
  5. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate_image/__init__.py +4 -2
  6. novelai_python-0.7.8/src/novelai_python/sdk/ai/generate_image/tokenizer.py +22 -0
  7. {novelai_python-0.7.6 → novelai_python-0.7.8}/LICENSE +0 -0
  8. {novelai_python-0.7.6 → novelai_python-0.7.8}/NOTICE.MD +0 -0
  9. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/__init__.py +0 -0
  10. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_enum.py +0 -0
  11. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_exceptions.py +0 -0
  12. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/__init__.py +0 -0
  13. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/ai/__init__.py +0 -0
  14. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/ai/generate.py +0 -0
  15. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/ai/generate_image.py +0 -0
  16. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/ai/generate_stream.py +0 -0
  17. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/ai/generate_voice.py +0 -0
  18. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/ai/upscale.py +0 -0
  19. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/schema.py +0 -0
  20. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/user/__init__.py +0 -0
  21. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/user/information.py +0 -0
  22. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/user/login.py +0 -0
  23. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/_response/user/subscription.py +0 -0
  24. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/credential/ApiToken.py +0 -0
  25. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/credential/JwtToken.py +0 -0
  26. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/credential/UserAuth.py +0 -0
  27. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/credential/__init__.py +0 -0
  28. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/credential/_base.py +0 -0
  29. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/__init__.py +0 -0
  30. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/LICENSE +0 -0
  31. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/__init__.py +0 -0
  32. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/_const.py +0 -0
  33. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/_cost.py +0 -0
  34. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/augment_image/__init__.py +0 -0
  35. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/augment_image/_enum.py +0 -0
  36. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate/__init__.py +0 -0
  37. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate/_const.py +0 -0
  38. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate/_enum.py +0 -0
  39. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate/_schema.py +0 -0
  40. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate/themes.json +0 -0
  41. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate_image/schema.py +0 -0
  42. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate_image/suggest_tags.py +0 -0
  43. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate_stream.py +0 -0
  44. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate_voice/__init__.py +0 -0
  45. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/generate_voice/_enum.py +0 -0
  46. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/ai/upscale.py +0 -0
  47. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/schema.py +0 -0
  48. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/user/__init__.py +0 -0
  49. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/user/information.py +0 -0
  50. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/user/login.py +0 -0
  51. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/sdk/user/subscription.py +0 -0
  52. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/server.py +0 -0
  53. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tokenizer/__init__.py +0 -0
  54. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tokenizer/clip_simple_tokenizer.py +0 -0
  55. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tokenizer/nerdstash_v1.model +0 -0
  56. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tokenizer/nerdstash_v2.model +0 -0
  57. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tokenizer/novelai.model +0 -0
  58. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tokenizer/novelai_v2.model +0 -0
  59. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tool/__init__.py +0 -0
  60. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tool/image_metadata/__init__.py +0 -0
  61. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tool/image_metadata/bch_utils.py +0 -0
  62. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tool/image_metadata/lsb_extractor.py +0 -0
  63. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tool/image_metadata/lsb_injector.py +0 -0
  64. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tool/paint_mask/__init__.py +0 -0
  65. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tool/random_prompt/__init__.py +0 -0
  66. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tool/random_prompt/generate_scene_composition.py +0 -0
  67. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tool/random_prompt/generate_scene_tags.py +0 -0
  68. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/tool/random_prompt/generate_tags.py +0 -0
  69. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/utils/__init__.py +0 -0
  70. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/utils/encode.py +0 -0
  71. {novelai_python-0.7.6 → novelai_python-0.7.8}/src/novelai_python/utils/useful.py +0 -0
  72. {novelai_python-0.7.6 → novelai_python-0.7.8}/tests/__init__.py +0 -0
  73. {novelai_python-0.7.6 → novelai_python-0.7.8}/tests/test_generate_voice.py +0 -0
  74. {novelai_python-0.7.6 → novelai_python-0.7.8}/tests/test_random_prompt.py +0 -0
  75. {novelai_python-0.7.6 → novelai_python-0.7.8}/tests/test_server.py +0 -0
  76. {novelai_python-0.7.6 → novelai_python-0.7.8}/tests/test_server_run.py +0 -0
  77. {novelai_python-0.7.6 → novelai_python-0.7.8}/tests/test_tokenizer.py +0 -0
  78. {novelai_python-0.7.6 → novelai_python-0.7.8}/tests/test_upscale.py +0 -0
  79. {novelai_python-0.7.6 → novelai_python-0.7.8}/tests/test_user_information.py +0 -0
  80. {novelai_python-0.7.6 → novelai_python-0.7.8}/tests/test_user_login.py +0 -0
  81. {novelai_python-0.7.6 → novelai_python-0.7.8}/tests/test_user_subscription.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: novelai-python
3
- Version: 0.7.6
3
+ Version: 0.7.8
4
4
  Summary: NovelAI Python Binding With Pydantic
5
5
  Author-Email: sudoskys <coldlando@hotmail.com>
6
6
  License: Apache License 2.0
@@ -14,7 +14,7 @@ Requires-Dist: pydantic>=2.9.0
14
14
  Requires-Dist: httpx>=0.26.0
15
15
  Requires-Dist: shortuuid>=1.0.11
16
16
  Requires-Dist: Pillow>=10.2.0
17
- Requires-Dist: curl-cffi>=0.6.0
17
+ Requires-Dist: curl-cffi>=0.9.0
18
18
  Requires-Dist: fastapi>=0.109.0
19
19
  Requires-Dist: uvicorn[standard]>=0.27.0.post1
20
20
  Requires-Dist: numpy>=1.24.4
@@ -52,6 +52,7 @@ the [NovelAI API service](https://api.novelai.net/docs).
52
52
 
53
53
  ### 📰 News
54
54
 
55
+ - [NovelAI Diffusion V4.5 Curated is Here!](https://blog.novelai.net/novelai-diffusion-v4-5-curated-is-here-9e5ba1f628f3)
55
56
  - [Image Generation Model Release — NovelAI Anime Diffusion V4 Curated Preview (EN)](https://blog.novelai.net/release-novelai-anime-diffusion-v4-curated-preview-en-ca4b0b11e671)
56
57
  - [Tutorial: Creating Consistent Characters with NovelAI Diffusion Anime [Female]](https://blog.novelai.net/tutorial-en-creating-consistent-characters-with-novelai-diffusion-anime-female-538b4b678a4e)
57
58
 
@@ -87,7 +88,7 @@ prompt = "2girls, fisheye, closeup, from above"
87
88
  async def main():
88
89
  gen = GenerateImageInfer.build_generate(
89
90
  prompt=prompt,
90
- model=Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
91
+ model=Model.NAI_DIFFUSION_4_5_CURATED,
91
92
  character_prompts=[
92
93
  Character(
93
94
  prompt="1girl, head tilt, short hair, black hair, grey eyes, small breasts, looking at viewer",
@@ -14,6 +14,7 @@ the [NovelAI API service](https://api.novelai.net/docs).
14
14
 
15
15
  ### 📰 News
16
16
 
17
+ - [NovelAI Diffusion V4.5 Curated is Here!](https://blog.novelai.net/novelai-diffusion-v4-5-curated-is-here-9e5ba1f628f3)
17
18
  - [Image Generation Model Release — NovelAI Anime Diffusion V4 Curated Preview (EN)](https://blog.novelai.net/release-novelai-anime-diffusion-v4-curated-preview-en-ca4b0b11e671)
18
19
  - [Tutorial: Creating Consistent Characters with NovelAI Diffusion Anime [Female]](https://blog.novelai.net/tutorial-en-creating-consistent-characters-with-novelai-diffusion-anime-female-538b4b678a4e)
19
20
 
@@ -49,7 +50,7 @@ prompt = "2girls, fisheye, closeup, from above"
49
50
  async def main():
50
51
  gen = GenerateImageInfer.build_generate(
51
52
  prompt=prompt,
52
- model=Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
53
+ model=Model.NAI_DIFFUSION_4_5_CURATED,
53
54
  character_prompts=[
54
55
  Character(
55
56
  prompt="1girl, head tilt, short hair, black hair, grey eyes, small breasts, looking at viewer",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "novelai-python"
3
- version = "0.7.6"
3
+ version = "0.7.8"
4
4
  description = "NovelAI Python Binding With Pydantic"
5
5
  authors = [
6
6
  { name = "sudoskys", email = "coldlando@hotmail.com" },
@@ -13,7 +13,7 @@ dependencies = [
13
13
  "httpx>=0.26.0",
14
14
  "shortuuid>=1.0.11",
15
15
  "Pillow>=10.2.0",
16
- "curl-cffi>=0.6.0",
16
+ "curl-cffi>=0.9.0",
17
17
  "fastapi>=0.109.0",
18
18
  "uvicorn[standard]>=0.27.0.post1",
19
19
  "numpy>=1.24.4",
@@ -91,6 +91,12 @@ class Resolution(Enum):
91
91
 
92
92
 
93
93
  class Model(Enum):
94
+ """
95
+ Nai Diffusion series
96
+ """
97
+ NAI_DIFFUSION_4_5_CURATED = 'nai-diffusion-4-5-curated'
98
+ NAI_DIFFUSION_4_5_CURATED_INPAINTING = 'nai-diffusion-4-5-curated-inpainting'
99
+
94
100
  NAI_DIFFUSION_4_CURATED_PREVIEW = "nai-diffusion-4-curated-preview"
95
101
  NAI_DIFFUSION_4_FULL = "nai-diffusion-4-full"
96
102
  NAI_DIFFUSION_4_FULL_INPAINTING = "nai-diffusion-4-full-inpainting"
@@ -132,7 +138,10 @@ INPAINTING_MODEL_LIST = [
132
138
  Model.NAI_DIFFUSION_INPAINTING,
133
139
  Model.SAFE_DIFFUSION_INPAINTING,
134
140
  Model.FURRY_DIFFUSION_INPAINTING,
135
- Model.NAI_DIFFUSION_FURRY_3_INPAINTING
141
+ Model.NAI_DIFFUSION_FURRY_3_INPAINTING,
142
+ Model.NAI_DIFFUSION_4_CURATED_INPAINTING,
143
+ Model.NAI_DIFFUSION_4_FULL_INPAINTING,
144
+ Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING
136
145
  ]
137
146
 
138
147
  PROMOTION = {
@@ -156,6 +165,10 @@ PROMOTION = {
156
165
  "Stable Diffusion XL 9CC2F394": Model.NAI_DIFFUSION_FURRY_3,
157
166
  'NovelAI Diffusion V4 4F49EC75': Model.NAI_DIFFUSION_4_FULL,
158
167
  'NovelAI Diffusion V4 CA4B7203': Model.NAI_DIFFUSION_4_FULL,
168
+ 'NovelAI Diffusion V4.5 5AB81C7C': Model.NAI_DIFFUSION_4_5_CURATED,
169
+ "NovelAI Diffusion V4.5 B5A2A797": Model.NAI_DIFFUSION_4_5_CURATED,
170
+ "NovelAI Diffusion V4 5AB81C7C": Model.NAI_DIFFUSION_4_5_CURATED,
171
+ "NovelAI Diffusion V4 B5A2A797": Model.NAI_DIFFUSION_4_5_CURATED,
159
172
  }
160
173
 
161
174
  ModelTypeAlias = Optional[Union[Model, str]]
@@ -175,8 +188,16 @@ class SupportCondition:
175
188
  characterPrompts: bool
176
189
  v4Prompts: bool
177
190
  smea: bool
191
+ smeaDyn: bool
178
192
  text: bool
179
193
  dynamicThresholding: bool
194
+ autoSmea: bool
195
+ v4_0legacyUC: bool
196
+ scaleRecommendedMin: int
197
+ scaleRecommendedMax: Optional[int]
198
+ numericEmphasis: bool
199
+ encodedVibes: bool
200
+ cfgDelaySigma: int
180
201
 
181
202
 
182
203
  def get_supported_params(model: Model):
@@ -207,8 +228,16 @@ def get_supported_params(model: Model):
207
228
  characterPrompts=False,
208
229
  v4Prompts=False,
209
230
  smea=True,
231
+ smeaDyn=False,
210
232
  text=False,
211
- dynamicThresholding=True
233
+ dynamicThresholding=True,
234
+ autoSmea=True,
235
+ v4_0legacyUC=False,
236
+ scaleRecommendedMin=6,
237
+ scaleRecommendedMax=25,
238
+ numericEmphasis=False,
239
+ encodedVibes=False,
240
+ cfgDelaySigma=19
212
241
  )
213
242
  if model in [Model.NAI_DIFFUSION_2]:
214
243
  return SupportCondition(
@@ -222,8 +251,16 @@ def get_supported_params(model: Model):
222
251
  characterPrompts=False,
223
252
  v4Prompts=False,
224
253
  smea=True,
254
+ smeaDyn=False,
225
255
  text=False,
226
- dynamicThresholding=True
256
+ dynamicThresholding=True,
257
+ autoSmea=True,
258
+ v4_0legacyUC=False,
259
+ scaleRecommendedMin=6,
260
+ scaleRecommendedMax=25,
261
+ numericEmphasis=False,
262
+ encodedVibes=False,
263
+ cfgDelaySigma=19
227
264
  )
228
265
  if model in [
229
266
  Model.NAI_DIFFUSION_XL,
@@ -243,13 +280,20 @@ def get_supported_params(model: Model):
243
280
  characterPrompts=False,
244
281
  v4Prompts=False,
245
282
  smea=True,
283
+ smeaDyn=True,
246
284
  text=False,
247
- dynamicThresholding=True
285
+ dynamicThresholding=True,
286
+ autoSmea=True,
287
+ v4_0legacyUC=False,
288
+ scaleRecommendedMin=2,
289
+ scaleRecommendedMax=8,
290
+ numericEmphasis=False,
291
+ encodedVibes=False,
292
+ cfgDelaySigma=19
248
293
  )
249
294
  if model in [
250
295
  Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
251
296
  Model.NAI_DIFFUSION_4_CURATED_INPAINTING,
252
- Model.CUSTOM,
253
297
  Model.NAI_DIFFUSION_4_FULL,
254
298
  Model.NAI_DIFFUSION_4_FULL_INPAINTING,
255
299
  ]:
@@ -264,8 +308,65 @@ def get_supported_params(model: Model):
264
308
  characterPrompts=True,
265
309
  v4Prompts=True,
266
310
  smea=False,
311
+ smeaDyn=False,
312
+ text=True,
313
+ dynamicThresholding=False,
314
+ autoSmea=False,
315
+ v4_0legacyUC=True,
316
+ scaleRecommendedMin=2,
317
+ scaleRecommendedMax=6,
318
+ numericEmphasis=True,
319
+ encodedVibes=True,
320
+ cfgDelaySigma=19
321
+ )
322
+ if model in [Model.CUSTOM]:
323
+ return SupportCondition(
324
+ controlnet=False,
325
+ vibetransfer=True,
326
+ scaleMax=10,
327
+ negativePromptGuidance=True,
328
+ noiseSchedule=True,
329
+ inpainting=True,
330
+ cfgDelay=True,
331
+ characterPrompts=True,
332
+ v4Prompts=True,
333
+ smea=False,
334
+ smeaDyn=False,
335
+ text=True,
336
+ dynamicThresholding=False,
337
+ autoSmea=False,
338
+ v4_0legacyUC=True,
339
+ scaleRecommendedMin=0,
340
+ scaleRecommendedMax=None,
341
+ numericEmphasis=True,
342
+ encodedVibes=True,
343
+ cfgDelaySigma=58
344
+ )
345
+ if model in [
346
+ Model.NAI_DIFFUSION_4_5_CURATED,
347
+ Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING,
348
+ ]:
349
+ return SupportCondition(
350
+ controlnet=False,
351
+ vibetransfer=False,
352
+ scaleMax=10,
353
+ negativePromptGuidance=True,
354
+ noiseSchedule=True,
355
+ inpainting=True,
356
+ cfgDelay=True,
357
+ characterPrompts=True,
358
+ v4Prompts=True,
359
+ smea=False,
360
+ smeaDyn=False,
267
361
  text=True,
268
- dynamicThresholding=False
362
+ dynamicThresholding=False,
363
+ autoSmea=False,
364
+ v4_0legacyUC=False,
365
+ scaleRecommendedMin=0,
366
+ scaleRecommendedMax=None,
367
+ numericEmphasis=True,
368
+ encodedVibes=False,
369
+ cfgDelaySigma=58
269
370
  )
270
371
  return SupportCondition(
271
372
  controlnet=False,
@@ -278,8 +379,16 @@ def get_supported_params(model: Model):
278
379
  characterPrompts=False,
279
380
  v4Prompts=False,
280
381
  smea=False,
382
+ smeaDyn=False,
281
383
  text=False,
282
- dynamicThresholding=False
384
+ dynamicThresholding=False,
385
+ autoSmea=False,
386
+ v4_0legacyUC=False,
387
+ scaleRecommendedMin=0,
388
+ scaleRecommendedMax=99,
389
+ numericEmphasis=False,
390
+ encodedVibes=False,
391
+ cfgDelaySigma=19
283
392
  )
284
393
 
285
394
 
@@ -290,6 +399,8 @@ class Modifier(object):
290
399
 
291
400
 
292
401
  def find_model_by_hashcode(hashcode: str) -> ModelTypeAlias:
402
+ if "NovelAI Diffusion V4.5" in hashcode:
403
+ return PROMOTION.get(hashcode, Model.NAI_DIFFUSION_4_5_CURATED)
293
404
  if "NovelAI Diffusion V4" in hashcode:
294
405
  return PROMOTION.get(hashcode, Model.NAI_DIFFUSION_4_CURATED_PREVIEW)
295
406
  return PROMOTION.get(hashcode, None)
@@ -303,6 +414,14 @@ def get_modifiers(model: Model) -> Modifier:
303
414
  """
304
415
  if model in [
305
416
  Model.CUSTOM,
417
+ Model.NAI_DIFFUSION_4_5_CURATED,
418
+ Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING
419
+ ]:
420
+ return Modifier(
421
+ qualityTags="",
422
+ suffix=", location, masterpiece, no text, -0.8::feet::, rating:general"
423
+ )
424
+ if model in [
306
425
  Model.NAI_DIFFUSION_4_FULL,
307
426
  Model.NAI_DIFFUSION_4_FULL_INPAINTING,
308
427
  ]:
@@ -364,8 +483,10 @@ def filter_by_model_noise_schedule(model: Model, noise_schedule: List[NoiseSched
364
483
  :param noise_schedule:
365
484
  :return:
366
485
  """
367
- # 只有Novelai4系列不支持Native
486
+ # 只有 Novelai4 系列不支持Native
368
487
  if model in [
488
+ Model.NAI_DIFFUSION_4_5_CURATED,
489
+ Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING,
369
490
  Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
370
491
  Model.NAI_DIFFUSION_4_FULL,
371
492
  Model.NAI_DIFFUSION_4_FULL_INPAINTING,
@@ -451,7 +572,9 @@ def get_model_group(model: ModelTypeAlias) -> ModelGroups:
451
572
  "nai-diffusion-4-curated-preview": ModelGroups.V4,
452
573
  'nai-diffusion-4-full': ModelGroups.V4,
453
574
  'nai-diffusion-4-full-inpainting': ModelGroups.V4,
454
- 'nai-diffusion-4-curated-inpainting': ModelGroups.V4
575
+ 'nai-diffusion-4-curated-inpainting': ModelGroups.V4,
576
+ 'nai-diffusion-4-5-curated': ModelGroups.V4,
577
+ 'nai-diffusion-4-5-curated-inpainting': ModelGroups.V4,
455
578
  }
456
579
  return mapping.get(model, ModelGroups.STABLE_DIFFUSION)
457
580
 
@@ -598,7 +721,6 @@ def get_uc_preset(model: ModelTypeAlias) -> List[UcPrompt]:
598
721
  ),
599
722
  ]
600
723
  elif model in [
601
- Model.CUSTOM,
602
724
  Model.NAI_DIFFUSION_4_FULL,
603
725
  Model.NAI_DIFFUSION_4_FULL_INPAINTING,
604
726
  ]:
@@ -619,6 +741,33 @@ def get_uc_preset(model: ModelTypeAlias) -> List[UcPrompt]:
619
741
  text=""
620
742
  ),
621
743
  ]
744
+ elif model in [
745
+ Model.CUSTOM,
746
+ Model.NAI_DIFFUSION_4_5_CURATED,
747
+ Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING,
748
+ ]:
749
+ prompts = [
750
+ UcPrompt(
751
+ category="heavy",
752
+ name="heavy",
753
+ text="blurry, lowres, upscaled, artistic error, film grain, scan artifacts, worst quality, bad quality, jpeg artifacts, very displeasing, chromatic aberration, halftone, multiple views, logo, too many watermarks, negative space, blank page"
754
+ ),
755
+ UcPrompt(
756
+ category="light",
757
+ name="light",
758
+ text="blurry, lowres, upscaled, artistic error, scan artifacts, jpeg artifacts, logo, too many watermarks, negative space, blank page"
759
+ ),
760
+ UcPrompt(
761
+ category="human",
762
+ name="humanFocus",
763
+ text="blurry, lowres, upscaled, artistic error, film grain, scan artifacts, bad anatomy, bad hands, worst quality, bad quality, jpeg artifacts, very displeasing, chromatic aberration, halftone, multiple views, logo, too many watermarks, @_@, mismatched pupils, glowing eyes, negative space, blank page"
764
+ ),
765
+ UcPrompt(
766
+ category="none",
767
+ name="none",
768
+ text=""
769
+ ),
770
+ ]
622
771
  return prompts
623
772
 
624
773
 
@@ -32,9 +32,11 @@ from novelai_python.sdk.ai._enum import Model, Sampler, NoiseSchedule, ControlNe
32
32
  get_model_group, ModelGroups, get_supported_params, get_modifiers, ImageBytesTypeAlias
33
33
  from .schema import Character, V4Prompt, V4NegativePrompt, PositionMap
34
34
  from ...schema import ApiBaseModel
35
+ from ...._enum import TextTokenizerGroup
35
36
  from ...._exceptions import APIError, AuthError, ConcurrentGenerationError, SessionHttpError, DataSerializationError
36
37
  from ...._response.ai.generate_image import ImageGenerateResp, RequestParams
37
38
  from ....credential import CredentialBase
39
+ from ....tokenizer import NaiTokenizer
38
40
  from ....utils import try_jsonfy
39
41
 
40
42
 
@@ -779,7 +781,7 @@ class GenerateImageInfer(ApiBaseModel):
779
781
  noise: float = 0,
780
782
  seed: int = None,
781
783
  extra_noise_seed: int = None,
782
- model: Union[Model, str] = Model.NAI_DIFFUSION_3,
784
+ model: Union[Model, str] = Model.NAI_DIFFUSION_4_5_CURATED,
783
785
  negative_prompt: str = "",
784
786
  ucPreset: UCPresetTypeAlias = UCPreset.TYPE0,
785
787
  steps: int = 23,
@@ -874,7 +876,7 @@ class GenerateImageInfer(ApiBaseModel):
874
876
  image: Union[bytes, str],
875
877
  mask: Union[bytes, str],
876
878
  strength: float = 0.7,
877
- model: Union[Model, str] = Model.NAI_DIFFUSION_3,
879
+ model: Union[Model, str] = Model.NAI_DIFFUSION_4_5_CURATED,
878
880
  negative_prompt: str = "",
879
881
  ucPreset: UCPresetTypeAlias = UCPreset.TYPE0,
880
882
  steps: int = 23,
@@ -0,0 +1,22 @@
1
+ from novelai_python._enum import TextTokenizerGroup
2
+ from novelai_python.sdk.ai.generate_image import Model
3
+ from novelai_python.tokenizer import NaiTokenizer
4
+
5
+
6
+ def get_prompt_tokenizer(model: Model):
7
+ """
8
+ Only for IMAGE prompt length calculation
9
+ :param model:
10
+ :return:
11
+ """
12
+ if model in [
13
+ Model.CUSTOM,
14
+ Model.NAI_DIFFUSION_4_5_CURATED,
15
+ Model.NAI_DIFFUSION_4_5_CURATED_INPAINTING,
16
+ Model.NAI_DIFFUSION_4_CURATED_PREVIEW,
17
+ Model.NAI_DIFFUSION_4_CURATED_INPAINTING,
18
+ Model.NAI_DIFFUSION_4_FULL,
19
+ Model.NAI_DIFFUSION_4_FULL_INPAINTING,
20
+ ]:
21
+ return NaiTokenizer(TextTokenizerGroup.T5)
22
+ return NaiTokenizer(TextTokenizerGroup.CLIP)
File without changes
File without changes