Я учусь использовать искусственный интеллект и использую Colab, Python и Google Cloud. Я могу успешно генерировать изображения с помощью следующего кода:
Настройка:
!pip install --quiet --upgrade --user google-cloud-aiplatform
импортировать IPython
импортировать время
app = IPython.Application.instance()
app.kernel.do_shutdown(True )
из google.colab import auth
auth.authenticate_user()
import vertexai
vertexai.init(project="$PROJECT_ID", location = "us-central1")
из vertexai.preview.vision_models import ImageGenerationModel
model = ImageGenerationModel.from_pretrained("imagegeneration@005")
!pip install --обновить водяной знак
Working generation code:
response = model.generate_images(
prompt = '''Цветок.''',
number_of_images = 2
)
The issue is when I try and use a seed:
model.watermark_enabled = False
response = model.generate_images(
prompt = '''Цветок.''',
number_of_images = 2,
семя = 42
)
I recieve this:
_InactiveRpcError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/google/api_core/grpc_helpers.py in error_remapped_callable(*args, **kwargs)
71 try:
---> 72 return callable_(*args, **kwargs)
73 except grpc.RpcError as exc:
8 frames
_InactiveRpcError:
The above exception was the direct cause of the following exception:
InvalidArgument Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/google/api_core/grpc_helpers.py in error_remapped_callable(*args, **kwargs)
72 return callable_(*args, **kwargs)
73 except grpc.RpcError as exc:
---> 74 raise exceptions.from_grpc_error(exc) from exc
75
76 return error_remapped_callable
InvalidArgument: 400 Image generation failed with the following error: Seed is not supported when watermark is enabled.
[Error report](https://i.sstatic.net/mZ0FbeDs.png)
When the error first occured I added this:
model.watermark_enabled = False
When it didn't work, i did the opposite:
model.watermark_enabled = True
When that failed I ran this and went through the two options above:
!pip install --обновить водяной знак
Подробнее здесь: https://stackoverflow.com/questions/785 ... d-am-recei
Использование Google Colab с/Google Cloud с/python для создания изображений, и я получаю сообщение об ошибке, когда пыта ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Я получаю сообщение об ошибке при загрузке тензорной панели в Google Colab
Anonymous » » в форуме Python - 0 Ответы
- 27 Просмотры
-
Последнее сообщение Anonymous
-