ValueError: The `response.parts` quick accessor only works for a single candidate, but none were returned. Check the `response.prompt_feedback` to see if the prompt was blocked.
์์ธ : ์๋ชป๋ request๋ก prompt ์๋ต์ด ์ฐจ๋จ๋ case ํน์ safety setting error
request ๋ณด๋ด๊ธฐ ์ ์ parameter๋ฅผ ๋ค ๊ธฐ์ ํด์ค๋ค. ํ์ฌ๋ก์๋ max_tokens
- candidate_count : ์ถ๋ ฅ ์
- top_p : log_probabilities๋ค์ argmax ๊ฐ์ ์ญ์์ผ๋ก ์ ๋ ฌํ๋ค ๋จ์ด ๋จ์๋ก ์ฌ๊ตฌ์ฑ (๊ธ๋ ๋ค_argmax : 0.7, ํ๋ค๋ค_argmax: 0.3)
- ์ค๋ ์์นจ ๋จน๊ธฐ๋ ๊ธ๋ ๋ค.
- ์ค๋ ์์นจ ๋จน๊ธฐ๋ ํ๋ค๋ค.
generation_config = {
"candidate_count": 1,
"max_output_tokens": 256,
"temperature": 1.0,
"top_p": 0.7,
}
safety_settings=[
{
"category": "HARM_CATEGORY_DANGEROUS",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_NONE",
},
]
model = genai.GenerativeModel(
model_name="gemini-pro",
generation_config=generation_config,
safety_settings=safety_settings
)
https://github.com/google/generative-ai-python/issues/126
โ1โ is blocked by safety reason? seriously ยท Issue #126 ยท google/generative-ai-python
Description of the bug: when i send 1 to the gemini pro, it raise a exception : ValueError: The response.parts quick accessor only works for a single candidate, but none were returned. Check the re...
github.com
'๐ฃ๏ธ Natural Language Processing' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Embedding Model API ํ๊ตญ์ด Token & ๋น์ฉ ๋น๊ต (0) | 2024.03.28 |
---|---|
[BERT] ์ BERT๋ 15%์ ๋น์จ๋ก ๋ชจ๋ธ๋ง ํ์๊น? (0) | 2024.03.24 |
[Pinecone] llama-index with Pinecone (0) | 2023.10.01 |
The Path to Achieve Ultra-Low Inference Latency With LLaMA 65B on PyTorch/XLA (0) | 2023.07.06 |
Textbooks Are All You Need (0) | 2023.07.02 |
ValueError: The `response.parts` quick accessor only works for a single candidate, but none were returned. Check the `response.prompt_feedback` to see if the prompt was blocked.
์์ธ : ์๋ชป๋ request๋ก prompt ์๋ต์ด ์ฐจ๋จ๋ case ํน์ safety setting error
request ๋ณด๋ด๊ธฐ ์ ์ parameter๋ฅผ ๋ค ๊ธฐ์ ํด์ค๋ค. ํ์ฌ๋ก์๋ max_tokens
- candidate_count : ์ถ๋ ฅ ์
- top_p : log_probabilities๋ค์ argmax ๊ฐ์ ์ญ์์ผ๋ก ์ ๋ ฌํ๋ค ๋จ์ด ๋จ์๋ก ์ฌ๊ตฌ์ฑ (๊ธ๋ ๋ค_argmax : 0.7, ํ๋ค๋ค_argmax: 0.3)
- ์ค๋ ์์นจ ๋จน๊ธฐ๋ ๊ธ๋ ๋ค.
- ์ค๋ ์์นจ ๋จน๊ธฐ๋ ํ๋ค๋ค.
generation_config = {
"candidate_count": 1,
"max_output_tokens": 256,
"temperature": 1.0,
"top_p": 0.7,
}
safety_settings=[
{
"category": "HARM_CATEGORY_DANGEROUS",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_NONE",
},
]
model = genai.GenerativeModel(
model_name="gemini-pro",
generation_config=generation_config,
safety_settings=safety_settings
)
https://github.com/google/generative-ai-python/issues/126
โ1โ is blocked by safety reason? seriously ยท Issue #126 ยท google/generative-ai-python
Description of the bug: when i send 1 to the gemini pro, it raise a exception : ValueError: The response.parts quick accessor only works for a single candidate, but none were returned. Check the re...
github.com
'๐ฃ๏ธ Natural Language Processing' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Embedding Model API ํ๊ตญ์ด Token & ๋น์ฉ ๋น๊ต (0) | 2024.03.28 |
---|---|
[BERT] ์ BERT๋ 15%์ ๋น์จ๋ก ๋ชจ๋ธ๋ง ํ์๊น? (0) | 2024.03.24 |
[Pinecone] llama-index with Pinecone (0) | 2023.10.01 |
The Path to Achieve Ultra-Low Inference Latency With LLaMA 65B on PyTorch/XLA (0) | 2023.07.06 |
Textbooks Are All You Need (0) | 2023.07.02 |