2025. 5. 29. 12:23
AI
System.AccessViolationException: 'Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.'
보다시피 메모리 초과다.
var clipModel = LLavaWeights.LoadFromFile(clipModelPath);
이 코드에서 발생했다
var parameters = new ModelParams(modelPath);
이 코드를
var parameters = new ModelParams(modelPath)
{
ContextSize = 1024,
GpuLayerCount = 32,
BatchSize = 256,
};
이렇게 수정해서 명시적으로 ContextSize와 GpuLayerCount를 지정해주면 된다
난 2046이랑 4096에서 발생했으니 더 낮춰야 안정적일지도
ContextSize나 GpuLayerCount 둘 중 하나라도 너무 높으면 발생하는데
ContextSize는 그렇다 쳐도 GpuLayerCount는 높을수록 빠르기 때문에 고민된다
이거 말고도 BatchSize도 영향을 주는데 1024로 해도 오류 생기고 64로 해도 이미지를 못 읽고 128에서는 안경벗은사람마냥 보긴보는데 제대로 못 본다. 256이 적절했음
UBatchSize는 거의 영향이 없었다
이걸로도 효과를 못 본다면 그냥 더 낮은 양자화 모델로 바꾸자
'AI' 카테고리의 다른 글
AI 이미지 인식방법 (0) | 2025.05.31 |
---|---|
AI 번역기 만들기 TinyLLaMa vs Phi-2 (0) | 2025.05.26 |
라마샵 LLaMaSharp 사용법 (0) | 2025.05.24 |