검색 증강 생성(Retrieval Augmented Generation)

[링크 : https://aws.amazon.com/ko/what-is/retrieval-augmented-generation/]

[링크 : https://blog.kakaocloud.com/98]

 

랭체인이 시작이군.

import os
from langchain_openai import ChatOpenAI
from langchain.prompts import PromptTemplate
from langchain.vectorstores import Chroma
from langchain.embeddings import OpenAIEmbeddings
from langchain.chains import RetrievalQA
from langchain.document_loaders import PyPDFLoader
import urllib.request
import gradio as gr

[링크 : https://wikidocs.net/288616]

 

+

2026.05.13 실패중

pip install langchain_openai langchain_community pypdf chromadb
pip install langchain gradio

 

몇개는 지금 시점에서 langchain_classic 으로 해야지 호출된다. 곧(?) deprecated 되겠네 -_-

import os
from langchain_openai import ChatOpenAI
from langchain_classic.chains import RetrievalQA
from langchain_classic.document_loaders import PyPDFLoader
from langchain_classic.embeddings import OpenAIEmbeddings
from langchain_classic.prompts import PromptTemplate
from langchain_classic.vectorstores import Chroma
import urllib.request
import gradio as gr

os.environ['OPENAI_API_KEY'] ="dummy"

urllib.request.urlretrieve("https://debix-oss.oss-cn-hongkong.aliyuncs.com/debix/IMX8MPRM%20Rev.%201.06.pdf", filename="IMX8MPRM.pdf")
loader = PyPDFLoader("IMX8MPRM.pdf")
texts = loader.load_and_split()
print('문서의 수 :', len(texts))

[링크 : https://www.reddit.com/r/LangChain/comments/1q88edw/facing_langchain_module_import_issue_no_module/?tl=ko]

[링크 : https://wikidocs.net/232860]

 

문서의 수는 페이지랑 비슷하게 나온다.

>>> print(texts[0])
page_content='i.MX 8M Plus Applications Processor
Reference Manual
Document Number: IMX8MPRM
Rev. 1, 06/2021' metadata={'producer': 'Antenna House PDF Output Library 6.1.425 (Linux64); modified using iText® 5.1.3 ©2000-2011 1T3XT BVBA', 'creator': 'AH XSL Formatter V6.1 MR2 for Linux64 : 6.1.6.12685 (2013/09/18 10:39JST)', 'creationdate': '2021-06-10T11:46:47-07:00', 'author': 'NXP Semiconductors', 'fslditapluginversion': '20160510', 'fslssdsversion': '4.7.1', 'keywords': 'Applications processors\r\nMachine learning\r\nArtificial Intelligence\r\nIOT Solutions\r\nVoice control\r\nVoice assistant\r\ni.MX\r\nVision Solutions\r\nMulti Display\r\nIntegrated ISP\r\nNPU\r\nArm core\r\nPower Efficient processor', 'moddate': '2021-06-11T13:46:30-05:00', 'subject': 'i.MX 8M Plus Applications Processor Reference Manual', 'title': 'i.MX 8M Plus Applications Processor Reference Manual', 'trapped': '/False', 'source': 'IMX8MPRM.pdf', 'total_pages': 7406, 'page': 0, 'page_label': '1'}

 

요렇게 생긴 페이지가

 

아래와 같이 저장된다. 그냥.. 모든 텍스트는 다 저장되는 느낌?

>>> print(texts[2])
page_content='Contents
Section number Title Page
Chapter 1
Introduction
1.1 Product Overview ........................................................................................................................................................ 9
1.2 Target Applications.......................................................................................................................................................9
1.3 Acronyms and Abbreviations....................................................................................................................................... 9
1.4 Architectural Overview.................................................................................................................................................12
Chapter 2
Memory Map
2.1 Memory system overview.............................................................................................................................................23
2.2 Cortex-A53 Memory Map ........................................................................................................................................... 24
2.3 Cortex-M7 Memory Map..............................................................................................................................................26
2.4 DMA memory maps..................................................................................................................................................... 29
2.5 AIPS Memory Maps..................................................................................................................................................... 30
2.6 DAP Memory Map....................................................................................................................................................... 36
2.7 Audio Processor Memory Map.....................................................................................................................................38
2.8 HDMI_TX Subsystem Memory Map........................................................................................................................... 38
Chapter 3
Security
3.1 System Security............................................................................................................................................................ 41
3.2 Resource Domain Controller (RDC)............................................................................................................................ 44
Chapter 4
Arm Platform and Debug
4.1 Arm Cortex A53 Platform (A53)..................................................................................................................................91
4.2 Arm Cortex M7 Platform (CM7)..................................................................................................................................97
4.3 Messaging Unit (MU)...................................................................................................................................................99
4.4 Semaphore (SEMA4)....................................................................................................................................................143
4.5 On-Chip RAM Memory Controller (OCRAM)............................................................................................................161
4.6 Network Interconnect Bus System (NIC).....................................................................................................................164
i.MX 8M Plus Applications Processor Reference Manual, Rev. 1, 06/2021
NXP Semiconductors 3' metadata={'producer': 'Antenna House PDF Output Library 6.1.425 (Linux64); modified using iText® 5.1.3 ©2000-2011 1T3XT BVBA', 'creator': 'AH XSL Formatter V6.1 MR2 for Linux64 : 6.1.6.12685 (2013/09/18 10:39JST)', 'creationdate': '2021-06-10T11:46:47-07:00', 'author': 'NXP Semiconductors', 'fslditapluginversion': '20160510', 'fslssdsversion': '4.7.1', 'keywords': 'Applications processors\r\nMachine learning\r\nArtificial Intelligence\r\nIOT Solutions\r\nVoice control\r\nVoice assistant\r\ni.MX\r\nVision Solutions\r\nMulti Display\r\nIntegrated ISP\r\nNPU\r\nArm core\r\nPower Efficient processor', 'moddate': '2021-06-11T13:46:30-05:00', 'subject': 'i.MX 8M Plus Applications Processor Reference Manual', 'title': 'i.MX 8M Plus Applications Processor Reference Manual', 'trapped': '/False', 'source': 'IMX8MPRM.pdf', 'total_pages': 7406, 'page': 2, 'page_label': '3'}

 

크흑.. 벌써 나오는 deprecated의 향연

>>> embedding = OpenAIEmbeddings(chunk_size=100)
<stdin>:1: LangChainDeprecationWarning: The class `OpenAIEmbeddings` was deprecated in LangChain 0.0.9 and will be removed in 1.0. An updated version of the class exists in the `langchain-openai package and should be used instead. To use it run `pip install -U `langchain-openai` and import as `from `langchain_openai import OpenAIEmbeddings``.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/falinux/.local/lib/python3.10/site-packages/langchain_core/_api/deprecation.py", line 258, in warn_if_direct_instance
    return wrapped(self, *args, **kwargs)
  File "/home/falinux/.local/lib/python3.10/site-packages/pydantic/main.py", line 263, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for OpenAIEmbeddings
  Value error, Did not find openai_api_key, please add an environment variable `OPENAI_API_KEY` which contains it, or pass `openai_api_key` as a named parameter. [type=value_error, input_value={'chunk_size': 100, 'mode...20, 'http_client': None}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.13/v/value_error

 

OPENAI_API_KEY 가 등록안했을 경우 발생하는 에러

>>> OpenAIEmbeddings()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/falinux/.local/lib/python3.10/site-packages/pydantic/main.py", line 263, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
  File "/home/falinux/.local/lib/python3.10/site-packages/langchain_openai/embeddings/base.py", line 448, in validate_environment
    self.async_client = openai.AsyncOpenAI(
  File "/home/falinux/.local/lib/python3.10/site-packages/openai/_client.py", line 587, in __init__
    raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

 

머든 langchain_classic 이면 해결

embedding = OpenAIEmbeddings(chunk_size=100)

 

일단 여기서.. openAI api키를 진짜로 발급받지 않으면 안넘어 간다. 젠장

vectordb = Chroma.from_documents(
    documents=texts,
    embedding=embedding)

 

evaluation 하려면 결제해야하나? 와.. 짜증나네 ㅠㅠ

openai.RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}

 

 

+ 다시!

망할 그래픽이 구형이라 안되는건 어쩔수 없는데..

BAAI/bge-m3는 6132MB나 VRAM을 드시네. ㄷㄷ

 

2026.05.14

import os
from langchain_openai import ChatOpenAI
from langchain_classic.chains import RetrievalQA
from langchain_classic.document_loaders import PyPDFLoader
from langchain_classic.prompts import PromptTemplate
from langchain_community.embeddings import HuggingFaceEmbeddings
from langchain_community.vectorstores import Chroma

import urllib.request
import gradio as gr

urllib.request.urlretrieve("https://github.com/chatgpt-kr/openai-api-tutorial/raw/main/ch07/2020_%EA%B2%BD%EC%A0%9C%EA%B8%88%EC%9C%B5%EC%9A%A9%EC%96%B4%20700%EC%84%A0_%EA%B2%8C%EC%8B%9C.pdf", filename="2020_경제금융용어 700선_게시.pdf")

loader = PyPDFLoader("2020_경제금융용어 700선_게시.pdf")
texts = loader.load_and_split()
print('문서의 수 :', len(texts))

embedding = HuggingFaceEmbeddings(
    model_name="BAAI/bge-m3",
    model_kwargs={"device": "cpu"}
)

vectordb = Chroma.from_documents(
    documents=texts,
    embedding=embedding
)

print(vectordb._collection.count())
366
for key in vectordb._collection.get():
...   print(key)
...
ids
embeddings
documents
uris
included
data
metadatas

documents = vectordb._collection.get()['documents']
print('청크의 개수 :', len(documents))
청크의 개수 : 366
print('-' * 50)
--------------------------------------------------
print('0번 청크 출력 :', documents[0])
0번 청크 출력 : iii
찾아보기
한국은행은 국민들이 경제 및 금융에 대한 이해도를 높이고 경제에 관한 합리적인
의사결정 능력을 키울 수 있도록 현장 경제교육, 온라인 경제교육, 경제교육 콘텐츠
개발 등 대국민 경제교육을 다양하게 수행해 오고 있습니다 .
이의 일환으로 2018년
 경제금융용어 700선
 을 발간하였는데 그간 동 책자에 대한
수요가 꾸준히 늘어남에 따라 이번에 추가로 발간하게 되었습니다 .
지난번 내용과 같이 통화정책, 실물경제, 금융안정, 지급결제 등 한국은행 주요
업무를 이해하는데 필요한 전문 용어와 경제·금융 흐름을 이해하는데 도움이 되는
시사 경제금융 용어들을 수록하였습니다. 용어해설은 개념과 도입 배경, 의미, 적용
사례 등을 담아 쉽게 이해할 수 있도록 하였습니다. 또한 e-book으로도 제작하여
독자들의 편의성과 가독성을 높였습니다 .
코로나 19로 이전에 경험하지 못한 경제위기를 겪으면서 경제·금융 현상에 대한
일반인들의 관심도가 이전에 비해 높아졌습니다. 아무쪼록 이 책자가 한국은행의 주요
정책과 국내외 경제를 이해하는 데 조금이나마 도움이 되기를 바라겠습니다. 끝으로
경제금융용어 700선
  집필에 참여해주신 경제교육실 교수님들과 용어 집필에 좋은
의견을 주신 관련부서 여러분께 감사드립니다 .
2020년 8월
한국은행 경제교육실장 박 철 원
머 리 말

embeddings = vectordb._collection.get(include=['embeddings'])['embeddings']
print('임베딩 벡터의 개수 :', len(embeddings))
임베딩 벡터의 개수 : 366
print('0번 청크의 임베딩 값 출력 :', embeddings[0])
0번 청크의 임베딩 값 출력 : [ 0.00253409 -0.00188405 -0.05017297 ...  0.03743017 -0.00941579
 -0.04372674]
print('0번 청크의 임베딩 값의 길이 :', len(embeddings[0]))
0번 청크의 임베딩 값의 길이 : 1024
metadatas = vectordb._collection.get()['metadatas']
print('metadatas의 개수 :', len(metadatas))
metadatas의 개수 : 366
print('0번 청크의 출처 :', metadatas[0])
0번 청크의 출처 : {'creationdate': 'January 31, 2018 16:21', 'page': 3, 'moddate': 'January 31, 2018 16:21', 'producer': 'Smart PDF Imposition 1.0', 'page_label': '4', 'total_pages': 371, 'creator': 'Smart PDF Imposition 1.0', 'creationdate--text': 'January 31, 2018 16:21', 'title': '°æÁ¦±ÝÀ¶¿ë¾î 700¼±-ÃÖÁ¾.PDF', 'source': '2020_경제금융용어 700선_게시.pdf', 'author': 'INSUNG DATA INC.', 'subject': 'CoreImposition PDF 1.0 Output', 'moddate--text': 'January 31, 2018 16:21'}

docs = retriever.invoke("비트코인이 궁금해")
print('유사 문서 개수 :', len(docs))
유사 문서 개수 : 2
print('--' * 20)
----------------------------------------
print('첫번째 유사 문서 :', docs[0])
첫번째 유사 문서 : page_content='139

비트코인
비트코인(bitcoin)은 가상통화(암호통화)이자 디지털 지급시스템이다. 비트코인 시스템
은 중앙 저장소 또는 단일 관리자가 없기 때문에 최초의 탈중앙화된 디지털통화라고 불린다.
이는 사토시 나카모토라는 사람(집단)에 의해 만들어져서 2009년 개방형 소프트웨어로
배포되었다. 이 시스템은 공유형(peer-to-peer)이며, 거래는 중개자 없이 블록체인 소프트
웨어를 이용하는 참여자(nodes) 사이에 직접 이뤄진다. 이런 거래들은 공유(P2P) 네트워크
상 참여자의 작업증명(proof-of-work)을 통해 검증되고 공개된 분산원장인 블록체인에
기록된다. 승인된 거래의 새 그룹인 한 블록은 대략 10분에 한 번씩 만들어져서 블록체인에
추가되고 신속하게 모든 참여자에게 보내어진다. 비트코인은 대규모 전기를 사용하는
컴퓨터 처리 능력(power)을 활용해서 이뤄지는 기록보관 서비스인 채굴(mining)에 대한
보상으로 발행되고 있으며 다른 통화・상품・용역 등과 교환되어가고 있다. 중앙은행이
발행한 법정화폐가 아닌 비트코인은 비트코인 플랫폼에서 거래되며 투자대상으로서도
관심을 받고 있다. 하지만 급등한 가격 및 심한 변동 폭으로 거품논란이 크다. 또한 익명성으
로 자금세탁 등 불법거래에 악용될 소지가 많아 중국 등 일부 국가에서 비트코인 등 가상통
화의 거래를 규제하고 있다. 일본의 경우 비트코인의 거래이익에 대해 세금을 부과한다.
비트코인은 추가되는 한 블록당 새로 12.5비트코인을 보상하는데(2016.7월 현재), 21만개
가 채굴될 때(대략 4년)마다 그 보상이 반으로 줄어든다. 비트코인의 총량은 21백만개이며
2140년경 모두 채굴될 것으로 전망된다. 비트코인은 그 시스템의 설계시 그 수량을 한정시
켜 놓았기 때문에 원칙적으로 인플레이션에 의해 가치가 떨어질 수 있는 화폐와 다른
속성을 지닌다. 한편 2017년 8월 1일 비트코인(classic bitcoin)에서 ‘비트코인캐시’(BCH)가,
10월 25일 ‘비트코인골드’(BTG)가 하드포크(hard-fork)되어 별도로 거래되고 있다.
 연관검색어 : 가상통화, 작업증명, 블록체인
빅데이터
빅데이터(big data)란 복잡하고 다양한 대규모 데이터세트 자체는 물론 이 데이터세트
로부터 정보를 추출하고 결과를 분석하여 더 큰 가치를 창출하는 기술을 뜻한다. 수치
데이터 등 기존의 정형화된 정보뿐 아니라 텍스트 ・이미지・오디오・로그기록 등 여러
형태의 비정형 정보가 데이터로 활용된다. 최근 모바일기기와 SNS 이용 보편화, 사물인
빅데이터 ∙' metadata={'title': '°æÁ¦±ÝÀ¶¿ë¾î 700¼±-ÃÖÁ¾.PDF', 'creationdate--text': 'January 31, 2018 16:21', 'producer': 'Smart PDF Imposition 1.0', 'page_label': '156', 'moddate--text': 'January 31, 2018 16:21', 'moddate': 'January 31, 2018 16:21', 'source': '2020_경제금융용어 700선_게시.pdf', 'page': 155, 'creator': 'Smart PDF Imposition 1.0', 'creationdate': 'January 31, 2018 16:21', 'subject': 'CoreImposition PDF 1.0 Output', 'total_pages': 371, 'author': 'INSUNG DATA INC.'}
print('두번째 유사 문서 :', docs[1])
두번째 유사 문서 : page_content='6
경제금융용어 700선
가상통화공개(ICO)
가상통화(ICO; Initial Coin Offering) 공개는 주로 혁신적인 신생기업(startup)이 암호
화화폐(cryptocurrency) 또는 디지털 토큰(digital token, 일종의 투자증명)을 이용하여
자금을 조달할 수 있는 크라우드펀딩(crowd funding)의 한 방식이다. 가상통화공개
(ICO)에서 새로 발행된 암호화화폐는 법화(legal tender) 또는 비트코인 등 기존의 가상
통화와 교환되어 투자자에게 팔린다. 이 용어는 거래소에 상장하려는 기업이 투자자에게
자기 주식을 처음 공개적으로 매도하는 기업공개(IPO; Initial Public Offering)에서 연유
되었다고 볼 수 있다. 기업공개(IPO)에 참여한 투자자는 해당 기업의 소유권과 관련하여
주식을 획득한다. 반면 가상통화공개(ICO)에 참여한 투자자는 해당 신생기업의 코인
(coins) 또는 토큰을 얻는데, 이는 해당 기업이 제안한 프로젝트가 나중에 성공했을
경우 평가될 수 있는 가치(value)로 볼 수 있다. ICO는 주로 블록체인플랫폼인 이더리움
(Etherium)에서 이뤄지고 있다. 우리나라의 경우 현재 금지하고 있으며 앞으로 ICO에
대한 논의를 거쳐 유사수신행위 또는 증권관련 법률로 규제할 것으로 보인다 .
 연관검색어 : 가상통화, 블록체인, 비트코인, 빅데이터, 크라우드펀딩, 핀테크
간접금융/직접금융
경제에는 자금 잉여주체와 자금 부족주체가 존재하게 되는데 이들 사이에 은행이나
저축은행 신용협동기구 등 금융기관이 개입하여 자금을 중개하는 방식을 간접금융
(indirect financing)이라고 한다. 즉 금융기관이 일반 대중으로부터 예금을 받아 이를
자신의 명의로 기업 등 다른 경제주체에게 대출해 주는 방식이다. 한편 주식, 채권
발행의 경우와 같이 자금수요자가 금융기관을 통하지 않고 금융시장에서 직접 필요자금
을 조달하는 방식을 직접금융(direct financing)이라고 한다. 간접금융에서는 은행이
중추적인 기능을 하고, 직접금융에서는 주식과 채권이 거래되는 자본시장이 중요한
역할을 수행한다. 직접금융과 간접금융은 상호 경쟁적일 뿐만 아니라 보완적이기도
하므로 두 금융방식이 균형적으로 발전될 필요가 있다. 직접금융과 간접금융의 상대적
비중이 어느 정도이어야 이상적인지는 해당 국가의 경제발전단계나 경제구조에 따라
달라질 수밖에 없다. 예를 들면 중소기업의 비중이 높은 국가일수록 정보의 비대칭성
문제를 완화하기 위해 간접금융이 더 중요하고, 혁신산업에 의해 주도되는 경제일수록' metadata={'producer': 'Smart PDF Imposition 1.0', 'moddate': 'January 31, 2018 16:21', 'subject': 'CoreImposition PDF 1.0 Output', 'creationdate--text': 'January 31, 2018 16:21', 'creationdate': 'January 31, 2018 16:21', 'page': 22, 'creator': 'Smart PDF Imposition 1.0', 'source': '2020_경제금융용어 700선_게시.pdf', 'total_pages': 371, 'title': '°æÁ¦±ÝÀ¶¿ë¾î 700¼±-ÃÖÁ¾.PDF', 'page_label': '23', 'author': 'INSUNG DATA INC.', 'moddate--text': 'January 31, 2018 16:21'}


 

BAAI/bge-small-en-v1.5
intfloat/multilingual-e5-base

'프로그램 사용 > ai 프로그램' 카테고리의 다른 글

openai api .. 오디오 처리 성공  (0) 2026.05.07
ollama multimodal gemma4:e2b 테스트  (0) 2026.05.07
opencode + llama.cpp  (0) 2026.05.06
llm tts?  (0) 2026.05.05
stablie diffusion 모델 변경 / 다운로드 하기  (0) 2026.05.05
Posted by 구차니

요즘 핫하던데 (엄청난 비용의 토큰을 쓴 경험을 바탕으로 한국인이 만들었다고)

local llm에도 붙일수 있어서 한번 해봐야 할 듯.

gui 시대에 tui라니 끌리는데? ㅋㅋ

[링크 : https://www.elancer.co.kr/blog/detail/1048]

[링크 : https://wikidocs.net/338090]

[링크 : https://opencode.ai/ko]

 

llama.cpp
llama.cpp의 llama-server 유틸리티를 통해 로컬 모델을 사용하도록 구성할 수 있습니다.

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "llama.cpp": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "llama-server (local)",
      "options": {
        "baseURL": "http://127.0.0.1:8080/v1"
      },
      "models": {
        "qwen3-coder:a3b": {
          "name": "Qwen3-Coder: a3b-30b (local)",
          "limit": {
            "context": 128000,
            "output": 65536
          }
        }
      }
    }
  }
}

이 예제에서:

llama.cpp는 사용자 정의 공급자 ID입니다. 원하는 문자열로 지정할 수 있습니다.
npm은 이 공급자에 사용할 패키지를 지정합니다. 여기서는 OpenAI 호환 API를 위해 @ai-sdk/openai-compatible을 사용합니다.
name은 UI에 표시될 공급자 이름입니다.
options.baseURL은 로컬 서버의 엔드포인트입니다.
models는 모델 ID와 해당 구성을 매핑합니다. 모델 이름은 모델 선택 목록에 표시됩니다.

[링크 : https://opencode.ai/docs/providers/]

Posted by 구차니

llama-outeTTS 가 많이 검색되어 나오는데 한번 돌려봐야 할 듯.

확장자가 safetensor로 되어있고

[링크 : https://huggingface.co/unsloth/Llama-OuteTTS-1.0-1B/tree/main]

 

걍 -m 뒤에 넣어줘보면 될 듯.

[링크 : https://github.com/ggml-org/llama.cpp/issues/688]

 

[링크 : https://huggingface.co/unsloth/Llama-OuteTTS-1.0-1B]

[링크 : https://github.com/ggml-org/llama.cpp/discussions/11679]

[링크 : https://www.reddit.com/r/LocalLLaMA/comments/1l0qbot/tts_support_in_llamacpp/?tl=ko]

[링크 : https://arca.live/b/aispeech/136125630]

Posted by 구차니

음.. 받고 리프레시 하면 바로 뜨는듯?

다운로드한 파일을 이제 'C://StableDiffusion/stable-diffusion-webui/models/Stable-diffusion' 경로에 이동해서 넣으시면 됩니다. (이태릭체는 설치한 경로예요.)

[링크 : https://selgyun.tistory.com/entry/Stable-Diffusion-체크-포인트Checkpoint-학습-모델-추가하기-SD-2]

 

먼가 추천 링크들 보면 이런게 떠서 가입을 해야만 한다고 하니 귀찮...

아무튼 여기서 illustrious 로 검색하라는데 그게 모델명인가?

[링크 : https://civitai.com/]

 

 

+

2026.05.06

실행하면 하나 밖에 없었는데

 

위의 경로에 하나 넣고 우측의 refresh 을 눌러보니

 

오옹~!

250W 거의 풀로 먹고 83도.. ㄷㄷㄷ

 

근데 모델을 바꾸어도

내가 원하는걸 그리는건 또 다른 문제구나.

예제대로 해봐도 똑같이 안나온다.

 

 

1girl, masterpiece, general, lineart, white background, simple background
Negative prompt: bad quality,low quality,worst quality,lowres,displeasing,very displeasing,bad,bad anatomy,bad hands,text,error, multiple views, messy, amateur, blurry, blurry background, blurry foreground, rough, roughly drawn, messy, bad, what, guro, gore, futanari, yaoi, bara, pectorals, Steps: 28, CFG scale: 7.5, Sampler: Euler a, Seed: 1790244969, Size: 832x1216, Model: Illustrious-XL-v0.1, Version: f1.0.2-v1.10.1RC-latest-691-g37223711, Model hash: 3e15ba0038, Schedule type: Automatic, Discard penultimate sigma: True

 

1girl, masterpiece, general, lineart, white background, simple background
Negative prompt: worst quality,bad quality,bad hands,very displeasing,extra digit,fewer digits,jpeg artifacts,signature,username,reference,mutated,lineup,manga,comic,disembodied,futanari,yaoi,dickgirl,turnaround,2koma,4koma,monster,cropped,amputee,text,bad foreshortening,what,guro,logo,bad anatomy,bad perspective,bad proportions,artistic error,anatomical nonsense,amateur,out of frame,multiple views,weibo username,
Steps: 28, Sampler: Euler a, Schedule type: Automatic, CFG scale: 7.5, Seed: 1790244969, Size: 768x1024, Model hash: 3e15ba0038, Model: illustriousXL_v01, Version: v1.10.1-96-g1937682a

같은 시드라도 다르게 나오나?

 

Discard penultimate sigma: True 를 설정하려면 settings - Sampler parameters - Always discard next-to-list sigma를 체크하고 apply 하면 되나본데..

[링크 : https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/14169]

 

다시보니 negative prompt 문제인것 같은데 다시 해봐도 같은건 안나온다. 그림 해상도 영향도 받나?

 

먼가.. 확대하니 이상하다. 그리고 그림도 다르게 나오네 

'프로그램 사용 > ai 프로그램' 카테고리의 다른 글

opencode + llama.cpp  (0) 2026.05.06
llm tts?  (0) 2026.05.05
gemma4 e?b 멀티모달  (0) 2026.05.05
stable diffusion + 1080 ti 시도  (0) 2026.05.04
stable diffusion + pytorch 관련 조사  (0) 2026.05.04
Posted by 구차니

어..?!

31b가 오히려 audio를 지원하지 않는다.

 

qwen3.6 이나 gemma4 31B 이런애들만 되는 줄 알았는데, e2b e4b 에서도 되서 시도!

6. Audio
Use the following prompt structures for audio processing:

Audio Speech Recognition (ASR)
Transcribe the following speech segment in {LANGUAGE} into {LANGUAGE} text.

Follow these specific instructions for formatting the answer:
* Only output the transcription, with no newlines.
* When transcribing numbers, write the digits, i.e. write 1.7 and not one point seven, and write 3 instead of three.

Automatic Speech Translation (AST)
Transcribe the following speech segment in {SOURCE_LANGUAGE}, then translate it into {TARGET_LANGUAGE}.
When formatting the answer, first output the transcription in {SOURCE_LANGUAGE}, then one newline, then output the string '{TARGET_LANGUAGE}: ', then the translation in {TARGET_LANGUAGE}.

[링크 : https://huggingface.co/google/gemma-4-E2B]

[링크 : https://huggingface.co/unsloth/gemma-4-E4B-it-GGUF/tree/main]

 

+

실행은 아래와 같이 해주고

D:\study\llm\llama-b8916-bin-win-vulkan-x64>llama-server.exe -m ..\gemma-4-E4B-it-Q4_K_M.gguf --mmproj ..\mmproj-F16.gguf

 

심심하니 nvidia-smi 스샷찍어둔걸 사골로 우려먹기 ㅋㅋ

 

골든 mp4로 받고 ffmpeg 으로 mp3 변환하고

[링크 : https://www.youtube.com/watch?v=yebNIHKAC4A]

 

 

구글 검색에서 뜨는 가사랑 diff 떠보니 음.. 맞는것 같으면서 안 맞는

그래도 노래를 TTS로 돌린거 치고는 제법 비슷하게 나왔다는게 대단한 듯.

'프로그램 사용 > ai 프로그램' 카테고리의 다른 글

llm tts?  (0) 2026.05.05
stablie diffusion 모델 변경 / 다운로드 하기  (0) 2026.05.05
stable diffusion + 1080 ti 시도  (0) 2026.05.04
stable diffusion + pytorch 관련 조사  (0) 2026.05.04
stable diffusion 관련  (0) 2026.05.02
Posted by 구차니

2025년 2월 이후로 업데이트 없어서 사살상 현재는 죽은 상태

[링크 : https://github.com/AUTOMATIC1111/stable-diffusion-webui]

 

1.7.0 으로 설치시도

 

 

에러 메시지 대응은 아래 명령으로 venv 를 실행해주고 web_ui.sh 실행하면 되고

cannot activate python venv, aborting.. 
cd stable-diffusion-webui
python3 -m venv venv/

[링크 : https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/1120]

 

뜬금없이 저장소 계정을 물어보는건, 임의의 브랜치를 만들어서 먼가를 더 받거나 할 수 있도록 하면 해결

Installing open_clip
Cloning Stable Diffusion into /mnt/Downloads/stable-diffusion-webui/repositories/stable-diffusion-stability-ai...
Cloning into '/mnt/Downloads/stable-diffusion-webui/repositories/stable-diffusion-stability-ai'...
Username for 'https://github.com':
Password for 'https://github.com':
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/Stability-AI/stablediffusion.git/'
git switch dev

[링크 : https://www.reddit.com/r/StableDiffusion/comments/1pu9ef7/please_help_error_128/?tl=ko]

 

요건 그냥 패키지 깔아주면 된다고 한다.

Cannot locate TCMalloc (improves CPU memory usage)
Cannot locate TCMalloc. Do you have tcmalloc or google-perftool installed on your system? (improves CPU memory usage)

[링크 : https://www.clien.net/service/board/cm_aigurim/18066331]

 

localhost:7860 만되는건 --server-name 으로 해결

$ ./webui.sh --server-name=0.0.0.0

[링크 : https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/7558]

 

기본 설정으로는 512 x 512 인데, 한장에 대략 8초 정도 걸린다.

 

혹시 다이내아 그려보려고 하는데 영 이상하고 내가 원하는대로 안되서

ai의 도움을 받아서 해보는데

 

음.. 100% 인데 153W라..

아무튼 메모리 생각외로 많이 먹...네?

 

1024x768 생성하는데 

 

42.5초. 근데 나의(?) 다이애나는 이렇지 않아!!

Time taken: 42.5 sec.     A: 6.62 GB, R: 7.11 GB, Sys: 7.3/10.9043 GB (67.0%)

 

음.. 좀 귀찮은데 ㅋㅋ

[링크 : https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/8293]

[링크 : https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/1621]

    [링크 : https://github.com/papuSpartan/stable-diffusion-webui-distributed]

 

 

모델 교체법은 찾아봐야겠다.

[링크 : https://civitai.com/models/795765/illustrious-xl?modelVersionId=889818]

Posted by 구차니

sd 1.8.0 부터 pytorch 2.x 대로 업그레이드

sd 1.7.0 으로 시도하면 되려나?

 

1.8.0
Features:
Update torch to version 2.1.2

[링크 : https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases]

 

구버전 하드웨어 지원 종료

Highlights/Performance Improvements
Deprecation of Cuda 11.6 and Python 3.7 support for PyTorch 2.0
If you are still using or depending on CUDA 11.6 or Python 3.7 builds, we strongly recommend moving to at least CUDA 11.7 and Python 3.8, as it would be the minimum versions required for PyTorch 2.0. For more detail, please refer to the Release Compatibility Matrix for PyTorch releases.

[링크 : https://pytorch.org/blog/pytorch-2-0-release/]

 

pascal(1080) / cuda 12.6.3

 

이렇게 보면 2.1.2로 간다고 해서 문제 될 것 없어 보이는데 버전 문제가 아닌가?

 

[링크 : https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix]

 

'프로그램 사용 > ai 프로그램' 카테고리의 다른 글

gemma4 e?b 멀티모달  (0) 2026.05.05
stable diffusion + 1080 ti 시도  (0) 2026.05.04
stable diffusion 관련  (0) 2026.05.02
opanai api로 local LLM 하니 똑똑해진 기분  (0) 2026.05.02
llama.cpp multi modal 시도  (0) 2026.05.02
Posted by 구차니

남의 저장소에 issue 쓴 걸 제외하면 나름 나에게 도움이 될 느낌.

I have recently run into some issues. After several hours, I got the process down to a reproducible science/recipe.

If you are running stablediffusion with an Nvidia GTX 1080Ti and are having issues, read on...

🧩 Final Working Fix Summary

Hardware: NVIDIA GTX 1080 Ti (SM 6.1 Pascal)
OS: Windows 10 x64
Environment: Automatic1111 v1.10.1
Python: 3.10.6
Torch Stack:

torch==2.1.2+cu118
torchvision==0.16.2+cu118
torchaudio==2.1.2+cu118
xformers==0.0.23.post1  (optional)
Installed from: https://download.pytorch.org/whl/cu118

Other Key Dependencies:

transformers==4.36.2
tokenizers==0.15.2
safetensors==0.4.2
onnxruntime==1.17.1
accelerate==0.21.0

[링크 : https://github.com/easydiffusion/easydiffusion/issues/1980]

 

pytorch 2.x 대로 업그레이드 해도 되는것 같긴한데..

[링크 : https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/8709]

 

 

[링크 : https://www.reddit.com/r/StableDiffusion/comments/1qg5gha/i_made_a_new_ui_integrating_stablediffusioncpp/]

[링크 : https://github.com/Danmoreng/diffusion-desk]

 

제법(?) 여러가지 모델들이 있나보다.

🔥Important News

  • 2026/04/11 🚀 stable-diffusion.cpp now uses a brand-new embedded web UI.
    👉 Details: PR #1408
  • 2026/01/18 🚀 stable-diffusion.cpp now supports FLUX.2-klein
    👉 Details: PR #1193
  • 2025/12/01 🚀 stable-diffusion.cpp now supports Z-Image
    👉 Details: PR #1020
  • 2025/11/30 🚀 stable-diffusion.cpp now supports FLUX.2-dev
    👉 Details: PR #1016
  • 2025/10/13 🚀 stable-diffusion.cpp now supports Qwen-Image-Edit / Qwen-Image-Edit 2509
    👉 Details: PR #877
  • 2025/10/12 🚀 stable-diffusion.cpp now supports Qwen-Image
    👉 Details: PR #851
  • 2025/09/14 🚀 stable-diffusion.cpp now supports Wan2.1 Vace
    👉 Details: PR #819
  • 2025/09/06 🚀 stable-diffusion.cpp now supports Wan2.1 / Wan2.2
    👉 Details: PR #778

 

stable diffusion 이라고 SD 라고 하는건가?

Supported models

[링크 : https://github.com/leejet/stable-diffusion.cpp]

 

음.. Image랑 Iamge Edit 이랑 서로 다른 용도인가?

[링크 : https://huggingface.co/unsloth/Qwen-Image-Edit-2511-GGUF]

[링크 : https://huggingface.co/unsloth/Qwen-Image-GGUF]

[링크 : https://huggingface.co/unsloth/Qwen-Image-2512-GGUF]

 

일단 pip 패키지는 아니고 직접 설치를 해야 하는 것 같고

pip install git+https://github.com/huggingface/diffusers

 

코드 자체는 평이하긴 한데.. 딱 봐도 llama.cpp에서 돌릴만한 녀석은 아닐것 같은 느낌이..

from diffusers import DiffusionPipeline
import torch

model_name = "Qwen/Qwen-Image"

# Load the pipeline
if torch.cuda.is_available():
    torch_dtype = torch.bfloat16
    device = "cuda"
else:
    torch_dtype = torch.float32
    device = "cpu"

pipe = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch_dtype)
pipe = pipe.to(device)

positive_magic = {
    "en": ", Ultra HD, 4K, cinematic composition.", # for english prompt
    "zh": ", 超清,4K,电影级构图." # for chinese prompt
}

# Generate image
prompt = '''A coffee shop entrance features a chalkboard sign reading "Qwen Coffee 😊 $2 per cup," with a neon light beside it displaying "通义千问". Next to it hangs a poster showing a beautiful Chinese woman, and beneath the poster is written "π≈3.1415926-53589793-23846264-33832795-02384197". Ultra HD, 4K, cinematic composition'''

negative_prompt = " " # using an empty string if you do not have specific concept to remove


# Generate with different aspect ratios
aspect_ratios = {
    "1:1": (1328, 1328),
    "16:9": (1664, 928),
    "9:16": (928, 1664),
    "4:3": (1472, 1140),
    "3:4": (1140, 1472),
    "3:2": (1584, 1056),
    "2:3": (1056, 1584),
}

width, height = aspect_ratios["16:9"]

image = pipe(
    prompt=prompt positive_magic["en"],
    negative_prompt=negative_prompt,
    width=width,
    height=height,
    num_inference_steps=50,
    true_cfg_scale=4.0,
    generator=torch.Generator(device="cuda").manual_seed(42)
).images[0]

image.save("example.png")

[링크 : https://huggingface.co/unsloth/Qwen-Image-GGUF]

Posted by 구차니

antigravity로 귀찮아서

기존 라이브러리 (ollama)를 들어내고 openai api를 따르도록 했더니

이상하게(?) 똑똑해져서 놀랐는데

기존에도 json 형식으로 입력을 주고 있었고 그것의 role에 system과 user 등으로 나누어서 주니

사용자 질문과 분리되어 agent 상태가 바뀌는 것으로 보인다.

 

'messages': [
{'role':'user', 'content':'tell me a joke'}, 
{'role':'assistant', 'content':'why did the chicken cross the road'}, 
{'role':'user', 'content':'I don't know, why did the chicken cross the road'}
]

'messages': 
[
{'role':'system', 'content':'You are an assistant that speaks like Shakespeare.'}, 
{'role':'user', 'content':'tell me a joke'},  

[링크 : https://help.openai.com/en/articles/7042661-moving-from-completions-to-chat-completions-in-the-openai-api]

 

버전업되어 그런진 모르겠지만 

현재 문서에는 system 대신 developer가 들어가고 user와 asisstant가 존재한다.

The OpenAI model spec describes how our models give different levels of priority to messages with different roles.



A multi-turn conversation may consist of several messages of these types, along with other content types provided by both you and the model. Learn more about managing conversation state here.
You could think about developer and user messages like a function and its arguments in a programming language.
  • developer messages provide the system’s rules and business logic, like a function definition.
  • user messages provide inputs and configuration to which the developer message instructions are applied, like arguments to a function.

[링크 : https://developers.openai.com/api/docs/guides/text]

 

user role에 온갖(?) 설정들 넣고 질문과 같이 할 경우

import ollama

messages = []
messages.append({"role": "user", "content": "에이전트: 50대의 it 전문가. 박사학위가 있으며 전문적인 대답을 할 수 있 음. 질문 : 너에 대해서 설명해줘"})
response = ollama.chat(
    model="llama3.2:3b",
    messages=messages
)

reply = response["message"]["content"]
print("AI:", reply)

 

AI: 안녕하세요! 제가 introduces 하실게요.

저는 IT 전문가로, 50대의 경험과 expertise를 가지고 있습니다. 박사 학위를 hold 한 것으로 biết됩니다.

자세한 정보는 아래에 정리 해 두어 보니 좋을 것 같습니다.

*   성명: [이름] (개名)
*   이메일: \[이메일]
*   téléphone 번호: \[전화 번호]
*   경력:
    *   IT 전문가
    *   50대의 경험
    *   박사 학위
*   expertise:
    *   IT 기술 (Windows, Linux, Mac)
    *   네트워크 기술 (Wi-Fi, Ethernet)
    *   소프트웨어 개발 (Python, Java)
    *   데이터 분석 (Excel, SQL)

또한 저는 IT에 대한 deepen knowledge와 경험을 hold 하면서, 다른 사람들에게 도움을 줄 수 있는 전문가로 자리 잡고 있습니다.

 

agent 설정을 따로 넣고 user에는 딱 질문만 넣는 경우

import ollama

messages = []
messages.append({"role": "system", "content": "에이전트: 50대의 it 전문가. 박사학위가 있으며 전문적인 대답을 할 수 있음"})
messages.append({"role": "user", "content": "너에 대해서 설명해줘"})
response = ollama.chat(
    model="llama3.2:3b",
    messages=messages
)

reply = response["message"]["content"]
print("AI:", reply)

 

AI: 나를 소개할게!

**이름:** AI Assistant (아이)

**종류:** 지능형 대화 시스템

**특징:**

* **50대에 도전한 IT 전문가**: 50대의 IT 전문가로, IT 기술을 발전시키고 보다 효율적으로 사용하는 데 도움을 주는 역할을  하겠습니다.
* **박사학위 possession**: IT 기술과 관련된 박사 학위를 가지고 있기 때문에, 전문적인 대답을 할 수 있습니다.
* **지능형 대화 시스템**: AI Assistant로, 다양한 질문이나 문제를 받은 후, 적절한 대답을 제공할 수 있습니다.

**제공하는 서비스:**

* IT-related 질문이나 समसolu션에 대한 répond
* IT 기술과 관련된 정보와 도움을 제공합니다.
* IT-related vấn đề에 대한 도움이 필요해すれば 언제든지 mij어세요.

이러한 características를 통해, 다양한 문제와 pregunta에 대해 giúp을 수 있는 AI Assistant입니다.

 

집에서 llama3.2로 해보니 별 차이가 없는것 같은데

회사에서 telegram 으로 구현한 녀석을 이렇게 바꾸니 답변의 품질이 확 올라간 느낌이라 놀랐었다.

'프로그램 사용 > ai 프로그램' 카테고리의 다른 글

stable diffusion + pytorch 관련 조사  (0) 2026.05.04
stable diffusion 관련  (0) 2026.05.02
llama.cpp multi modal 시도  (0) 2026.05.02
stable diffusion은 일단 보류  (0) 2026.04.30
openai 라이브러리(파이썬)  (0) 2026.04.29
Posted by 구차니

llama.cpp 에서 + 눌러보면 이미지가 있는데 활성화가 안되고

 

llama-swap 에서는 입력은 가능한데 막상 해보면 500에러가 발생한다.

그래서 찾아보니 음.. --mmproj 옵션?

멀티모달 입력 활성화 방법

  • 두 가지 주요 실행 방식이 안내됨: 첫 번째는 -hf 옵션 사용(지원 모델 필요), 두 번째는 -m--mmproj 옵션을 조합해 텍스트와 멀티모달 프로젝터 모델을 각각 지정하는 방법임
  • -hf 옵션 사용 시, 멀티모달 기능을 끄고 싶으면 --no-mmproj를 추가하고, 사용자 지정 mmproj 파일을 활용할 경우 --mmproj local_file.gguf 옵션을 사용함
  • GPU 오프로딩이 기본값이며, 이를 원치 않으면 --no-mmproj-offload 옵션으로 비활성화가 가능함

예시 명령어

  • 커맨드라인에서는 llama-mtmd-cli를, 서버에서는 llama-server를 활용하는 형태임
  • 로컬 파일을 사용하는 경우 --mmproj로 직접 파일을 지정하는 방식임
  • GPU 오프로딩을 비활성화하려면 --no-mmproj-offload 옵션을 추가 사용하는 방식임

즉시 사용 가능한 멀티모달 모델 목록

  • Q4_K_M 양자화를 기본으로 하는 다양한 준비된 모델들이 안내되어 있음
  • 지원 모델 예시:
    • Gemma 3: 4b, 12b, 27b 버전
    • SmolVLM 계열: 256M, 500M, 2.2B 등
    • Pixtral 12B
    • Qwen 2 VL: 2B, 7B 및 Qwen 2.5 VL: 3B, 7B, 32B, 72B
    • Mistral Small 3.1 24B (IQ2_M 양자화)
    • InternVL 2.5와 3 세대: 다양한 파라미터 크기 지원임

[링크: https://news.hada.io/topic?id=20822]

 

제미나이 검색 추천으로 보니 이런 것들이 보인다.

mmproj-model.gguf 음...??

llama-server: You can run a local server that accepts image inputs via an API.
  • Setup: Start the server with the multimodal projector: llama-server -m gemma-model.gguf --mmproj mmproj-model.gguf --port 8080.
  • Sending Images: You can then send requests with Base64 encoded images or URLs to the /v1/chat/completions endpoint.

 

도움말을 보니 multi modal proejctor 줄여서 mmproj 라..

/llama-b8925$ ./llama-server  --help
load_backend: loaded RPC backend from /mnt/Downloads/llama-b8925/libggml-rpc.so
load_backend: loaded Vulkan backend from /mnt/Downloads/llama-b8925/libggml-vulkan.so
load_backend: loaded CPU backend from /mnt/Downloads/llama-b8925/libggml-cpu-haswell.so
----- common params -----

-h,    --help, --usage                  print usage and exit


-hf,   -hfr, --hf-repo <user>/<model>[:quant]
                                        Hugging Face model repository; quant is optional, case-insensitive,
                                        default to Q4_K_M, or falls back to the first file in the repo if
                                        Q4_K_M doesn't exist.
                                        mmproj is also downloaded automatically if available. to disable, add
                                        --no-mmproj
                                        example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M
                                        (default: unused)
                                        (env: LLAMA_ARG_HF_REPO)
-hfd,  -hfrd, --hf-repo-draft <user>/<model>[:quant]
                                        Same as --hf-repo, but for the draft model (default: unused)
                                        (env: LLAMA_ARG_HFD_REPO)
-hff,  --hf-file FILE                   Hugging Face model file. If specified, it will override the quant in
                                        --hf-repo (default: unused)
                                        (env: LLAMA_ARG_HF_FILE)
-hfv,  -hfrv, --hf-repo-v <user>/<model>[:quant]
                                        Hugging Face model repository for the vocoder model (default: unused)
                                        (env: LLAMA_ARG_HF_REPO_V)
-hffv, --hf-file-v FILE                 Hugging Face model file for the vocoder model (default: unused)
                                        (env: LLAMA_ARG_HF_FILE_V)
-hft,  --hf-token TOKEN                 Hugging Face access token (default: value from HF_TOKEN environment
                                        variable)

-mm,   --mmproj FILE                    path to a multimodal projector file. see tools/mtmd/README.md
                                        note: if -hf is used, this argument can be omitted
                                        (env: LLAMA_ARG_MMPROJ)
-mmu,  --mmproj-url URL                 URL to a multimodal projector file. see tools/mtmd/README.md
                                        (env: LLAMA_ARG_MMPROJ_URL)
--mmproj-auto, --no-mmproj, --no-mmproj-auto
                                        whether to use multimodal projector file (if available), useful when
                                        using -hf (default: enabled)
                                        (env: LLAMA_ARG_MMPROJ_AUTO)
--mmproj-offload, --no-mmproj-offload   whether to enable GPU offloading for multimodal projector (default:
                                        enabled)
                                        (env: LLAMA_ARG_MMPROJ_OFFLOAD)
--image-min-tokens N                    minimum number of tokens each image can take, only used by vision
                                        models with dynamic resolution (default: read from model)
                                        (env: LLAMA_ARG_IMAGE_MIN_TOKENS)
--image-max-tokens N                    maximum number of tokens each image can take, only used by vision
                                        models with dynamic resolution (default: read from model)
                                        (env: LLAMA_ARG_IMAGE_MAX_TOKENS)
-otd,  --override-tensor-draft <tensor name pattern>=<buffer type>,...
                                        override tensor buffer type for draft model
-cmoed, --cpu-moe-draft                 keep all Mixture of Experts (MoE) weights in the CPU for the draft
                                        model
                                        (env: LLAMA_ARG_CPU_MOE_DRAFT)
-ncmoed, --n-cpu-moe-draft N            keep the Mixture of Experts (MoE) weights of the first N layers in the
                                        CPU for the draft model

 

그래서 gemma4 저장소를 가봤더니 어라?

가장 아래... 전에는 눈치채지 못하고 흘렸던 mmproj 라는 녀석이 있다.

[링크 : https://huggingface.co/unsloth/gemma-4-26B-A4B-it-GGUF/tree/main]

 

그래서 그걸 다운로드 하고 -mm 옵션을 주면

안되네!? 혹시나 해서 F16 으로 해주니 된다. 역시 falcon이 최고여(??? 응?)

$ ./llama-b8925/llama-server -m ./model/gemma/gemma-4-E4B-it-Q4_K_M.gguf -mm ./model/gemma/mmproj-BF16.gguf

mtmd_init_from_file: error: mismatch between text model (n_embd = 2560) and mmproj (n_embd = 2816)
hint: you may be using wrong mmproj

srv    load_model: failed to load multimodal model, './model/gemma/mmproj-BF16.gguf'
srv    operator(): operator(): cleaning up before exit...
main: exiting due to model loading error

 

BF16 은 FP32 와 동일한 8bit 지수, F16은 5bit 지수

간단하게 BF16이 F16 보다 정밀도 면에서 좋다. 인데 하드웨어 지원이 안되면 무의미할테니 머.. 어쩔수 없나?

[링크 : https://g3lu.tistory.com/55]

 

+

gpt 왈 30 시리즈. ampere 부터 BF16을 지원한다고 한다.역시 3090 이런걸로 크게 갔어야 했나.. 쩝

 

아무튼 F16.gguf로 돌리니 images가 활성화 된다.



이미지가 커지면 토큰을 많이 먹는지 터지길래 조그많게 이미지 스샷 찍어서 시도 하니

먼가 분석을 시도한다 오오오!

 

 

+

 

이러니 메모리 부족 소리 나오지 -_-

기본 문맥 길이(256k) -c 8192
llama_context: n_ctx_seq (232192) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
llama_context: Vulkan_Host  output buffer size =     3.79 MiB
llama_kv_cache:    Vulkan1 KV buffer size =  2267.50 MiB
llama_kv_cache:    Vulkan2 KV buffer size =  2267.50 MiB
llama_kv_cache: size = 4535.00 MiB (232192 cells,  10 layers,  4/1 seqs), K (f16): 2267.50 MiB, V (f16): 2267.50 MiB
llama_kv_cache: attn_rot_k = 0, n_embd_head_k_all = 256
llama_kv_cache: attn_rot_v = 0, n_embd_head_k_all = 256
llama_memory_recurrent:    Vulkan1 RS buffer size =   150.75 MiB
llama_memory_recurrent:    Vulkan2 RS buffer size =   100.50 MiB
llama_memory_recurrent: size =  251.25 MiB (     4 cells,  40 layers,  4 seqs), R (f32):   11.25 MiB, S (f32):  240.00 MiB
llama_context: n_ctx_seq (8192) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
llama_context: Vulkan_Host  output buffer size =     3.79 MiB
llama_kv_cache:    Vulkan1 KV buffer size =    80.00 MiB
llama_kv_cache:    Vulkan2 KV buffer size =    80.00 MiB
llama_kv_cache: size =  160.00 MiB (  8192 cells,  10 layers,  4/1 seqs), K (f16):   80.00 MiB, V (f16):   80.00 MiB
llama_kv_cache: attn_rot_k = 0, n_embd_head_k_all = 256
llama_kv_cache: attn_rot_v = 0, n_embd_head_k_all = 256
llama_memory_recurrent:    Vulkan1 RS buffer size =   134.00 MiB
llama_memory_recurrent:    Vulkan2 RS buffer size =   117.25 MiB
llama_memory_recurrent: size =  251.25 MiB (     4 cells,  40 layers,  4 seqs), R (f32):   11.25 MiB, S (f32):  240.00 MiB

 

그래서 context 줄이고 mmproj 설정해주니 잘인식한다.

128k 까지는 1080  ti 11GB * 2 에서 돌아간다.

 ./llama-b8925/llama-server --host 0.0.0.0 --model ./model/qwen3.6_35B/Qwen3.6-35B-A3B-UD-Q2_K_XL.gguf -c 8192 -mm ./model/qwen3.6_35B/mmproj-F16.gguf

 

 

Posted by 구차니