adding MLX backend and example for stable diffusion 2.1

from https://github.com/ml-explore/mlx-examples
This commit is contained in:
Believethehype
2023-12-20 11:59:42 +01:00
parent 64710b4d1d
commit 15d3384dce
15 changed files with 1481 additions and 11 deletions

11
main.py
View File

@@ -5,7 +5,8 @@ import dotenv
from nostr_dvm.bot import Bot
from nostr_dvm.tasks import videogeneration_replicate_svd, imagegeneration_replicate_sdxl, textgeneration_llmlite, \
trending_notes_nostrband, discovery_inactive_follows, translation_google, textextraction_pdf, \
translation_libretranslate, textextraction_google, convert_media, imagegeneration_openai_dalle, texttospeech
translation_libretranslate, textextraction_google, convert_media, imagegeneration_openai_dalle, texttospeech, \
imagegeneration_mlx, advanced_search, textextraction_whisper_mlx
from nostr_dvm.utils.admin_utils import AdminConfig
from nostr_dvm.utils.backend_utils import keep_alive
from nostr_dvm.utils.definitions import EventDefinitions
@@ -138,6 +139,14 @@ def playground():
bot_config.SUPPORTED_DVMS.append(tts)
tts.run()
from sys import platform
if platform == "darwin":
# Test with MLX for OSX M1/M2/M3 chips
mlx = imagegeneration_mlx.build_example("SD with MLX", "mlx_sd", admin_config)
bot_config.SUPPORTED_DVMS.append(mlx)
mlx.run()
# Run the bot
Bot(bot_config)
# Keep the main function alive for libraries that require it, like openai