728x90
반응형
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
반응형
'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 |