Kandinsky-2 icon indicating copy to clipboard operation
Kandinsky-2 copied to clipboard

Add helpful installation information to README

Open maximxlss opened this issue 1 year ago • 9 comments

Right now it's only a pip command to install kadinsky but not a word about clip or opencv. Probably should be something like this:

pip install opencv-python
pip install git+https://github.com/openai/CLIP.git
pip install git+https://github.com/ai-forever/Kandinsky-2.git

maximxlss avatar Apr 04 '23 10:04 maximxlss

When I run the command "pip install git+https://github.com/ai-forever/Kandinsky-2.git" no new folder is created and I don't see that anything was installed. How do I actually install and run this? Does it work in windows?

gruevy avatar Apr 04 '23 14:04 gruevy

When I run the command "pip install git+https://github.com/ai-forever/Kandinsky-2.git" no new folder is created and I don't see that anything was installed. How do I actually install and run this? Does it work in windows?

Right now this is only an api for use in python. The command installs the library. After installation, you can run the example scripts present in the repository. If you have no experience with python, you can try out the hosted demos:

  • https://fusionbrain.ai/diffusion
  • https://t.me/kandinsky21_bot
  • https://rudalle.ru/

maximxlss avatar Apr 04 '23 14:04 maximxlss

Oh my bad, I thought it was a standalone client. Thanks!

gruevy avatar Apr 04 '23 14:04 gruevy

Also maybe adding this to the instruction will be helpful for users running in notebooks:

pip install ipywidgets

snakers4 avatar Apr 05 '23 04:04 snakers4

@gruevy you can use my script after installation in venv https://gist.github.com/Blucknote/31f792621f4e4cdf0a7d2505ddd6b0a2

Blucknote avatar Apr 05 '23 19:04 Blucknote

Привет! не могу поставить для питон 3.11..Как можно решить эту проблему? Можете выложить sentencepiece-0.1.97-cp311-cp311-win_amd64.whl ?

Kurskikh avatar Apr 05 '23 22:04 Kurskikh

@Kurskikh а в чём проблема? пакет не собирается? окружение чистая винда или wsl?

Blucknote avatar Apr 05 '23 22:04 Blucknote

Привет) Я разобрался с этой проблемой, поставив 10 питон..у меня код работает, но почему то при попытке сгененировать изображения ничего не происходит и я получаю варнинг PS C:\python\ & "C:/Program Files/Python310/python.exe" c:/python/bot/bot.py C:\Program Files\Python310\lib\site-packages\huggingface_hub\file_download.py:637: FutureWarning: cached_download is the legacy way to download files from the HF hub, please consider upgrading to hf_hub_download warnings.warn(

Я пытаюсь через телеграм бота реализовать получение изображений

@dp.message_handler(Command("img"), lambda message: database_turbo.is_authorized(cursor, message.from_user.id))
async def img_command(message: types.Message):
    await message.answer("Введите текстовый запрос для генерации изображения:")
    await ImageGenerationState.prompt.set()

@dp.message_handler(lambda message: message.text, state=ImageGenerationState.prompt)
async def generate_image(message: types.Message, state: FSMContext):
    text_prompt = message.text
    model = get_kandinsky2('cuda', task_type='text2img', model_version='2.1', use_flash_attention=False)
    images = model.generate_text2img(
        text_prompt,
        num_steps=100,
        batch_size=1,
        guidance_scale=4,
        h=768, w=768,
        sampler='p_sampler',
        prior_cf_scale=4,
        prior_steps="5"
    )
    
    # Convert the image to a format suitable for sending via Telegram
    img_data = io.BytesIO()
    images[0].save(img_data, format='JPEG')
    img_data.seek(0)

    # Send the generated image to the user
    await bot.send_photo(chat_id=message.chat.id, photo=img_data, caption="Generated image:")
    await state.finish()

Когда я ввожу команду /img далее промт, то получаю варнинг и бот зависает(

Kurskikh avatar Apr 05 '23 22:04 Kurskikh

при попытке сгененировать изображения ничего не происходит и я получаю варнинг

Варнинг это нормально. Во-первых, модель лучше инициализировать в самом начале один раз, а во-вторых, скорее всего стоит просто подольше подождать. Во время инициализации модели долгое время нет никакого вывода.

maximxlss avatar Apr 06 '23 04:04 maximxlss