Post's Content

출처 : https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/5674

🖥️ 개인적인 의견
한글로 번역해도 뭔지 모르겠음.
그래서 아래 쪽에 사진을 준비함.

같은 조건 하에서
2~12단계까지 Clip Skip을 했음.
6단계는 실수로 누락됨.

그림을 보고 그냥 감으로 느끼세요.

🖥️ Clip Skip

CLIP 모델(1.x 버전에서 사용되는 텍스트 임베딩)은 계층으로 구성된 구조를 가지고 있습니다. 각 계층은 이전 계층보다 구체적입니다. 예를 들어, 1번째 계층이 "사람"이라면 2번째 계층은 "남성"과 "여성"이 될 수 있습니다. 그리고 "남성"을 선택하면 3번째 계층에서는 "남자", "소년", "청년", "아버지", "할아버지" 등으로 구체화될 수 있습니다. 이는 CLIP 모델의 실제 구조는 아니지만 예시를 위해 설명한 것입니다.

1.5 버전의 모델은 예를 들어 12개의 계층으로 구성됩니다. 여기서 12번째 계층은 텍스트 임베딩의 마지막 계층입니다. 각 계층은 일정한 크기의 행렬로 이루어져 있으며, 각 계층은 추가적인 행렬들을 가지고 있습니다. 따라서 4x4 크기의 첫 번째 계층은 그 아래에 4개의 4x4 행렬을 가지게 됩니다. 이렇게 계층이 깊어질수록 텍스트 공간의 차원은 엄청나게 커집니다.

그렇다면 왜 CLIP의 계층을 이른 시점에 멈추고 싶을까요? "소"라는 단어에 대한 세부 카테고리가 중요하지 않을 수 있습니다. 특히 이러한 세부 카테고리는 품질의 차이가 있을 수 있습니다. 따라서 "소"라는 단어를 찾고 있다면 "애버딘 앵거스 수소"와 같은 하위 카테고리는 원하지 않을 수 있습니다.

CLIP 스킵은 사실상 "텍스트 모델의 정확도 설정"으로 볼 수 있습니다. 이를 XY 스크립트와 함께 테스트할 수 있습니다. 각 CLIP 스테이지가 더 정확한 설명을 가지고 있는 것을 확인할 수 있습니다. 따라서 상세한 프롬프트가 "숲에 서 있는 젊은 남성"에 대한 것이라면, 낮은 CLIP 스테이지에서는 "남성이 서 있는" 사진을 얻을 수 있고, 더 깊은 계층에서는 "서 있는 젊은 남성", "숲에 서 있는 젊은 남성"과 같은 사진을 얻을 수 있습니다.

CLIP 스킵은 CLIP을 사용하거나 CLIP을 기반으로 하는 모델에서만 작동합니다. 즉, 1.x 버전 및 이에 파생된 모델에서 작동하며, 2.0 버전 및 이에 파생된 모델은 OpenCLIP을 사용하기 때문에 CLIP과 상호작용하지 않습니다.

🖥️ 그렇다면 Clip Skip은 CFG 와 같은가?

아니요. CFG는 완전히 다른 것입니다. 이미지를 생성하는 과정을 여행으로 상상해 보세요. 프롬프트는 도착지에 대한 지침이지만, 도착하는 방법은 제시되지 않습니다. 인공지능의 작업은 기본적으로 다음과 같은 간단한 수학 계산을 수행하는 것입니다: 프롬프트 - 잠재 의문 ≈ 0. CFG는 실제로 프롬프트의 곱셈 요소입니다. 따라서 (프롬프트 * cfg) - 의문 토큰 ≈ 0입니다. 이것은 극도로 단순화된 설명이지만, 아이디어를 전달하는 데 충분합니다. 추가적인 연구를 하실 수 있도록 해주는 것입니다.

이제 가상의 상황을 상상해 보겠습니다. 또는 실제로 SD(세부 설정에 따라 조정한 경우)의 0 CFG를 가정해 보겠습니다. 이 경우 AI는 무작위 가우시안 노이즈를 0으로 근사화하기 위해 필요한 것을 생성할 것입니다. AI는 항상 그림이나 노이즈를 보면 무언가를 찾습니다. 그것이 AI의 일부분이며 "아무것도 보이지 않습니다"라고 할 수 없습니다. 우리가 아는 바에 따르면, 0으로 어떤 것을 곱하면 0이 됩니다. 따라서 (프롬프트 * 0) - 의문 ≈ 0은 의문 ≈ 0으로 변환됩니다. 반대로, 이론적으로 최대 CFG는 AI가 프롬프트의 토큰 뒤에서 찾은 것만 찾도록 만듭니다. 이것이 매우 극단적인 왜곡과 대조를 얻는 이유입니다. 실제로는 AI가 프롬프트의 해당 토큰에 대한 가장 순수한 표현을 추출하는 것입니다. 이것은 훈련 과정 중에 계산된 패턴의 평균 총합입니다.

따라서 CFG는 단순히 AI에게 프롬프트에 대해 얼마나 구체적으로 작동해야 하는지 알려주는 것입니다. CFG의 임의의 척도를 상상해 보겠습니다. 1. 이 우주, 2. 우리 은하 단위, 3. 우리 은하, 4. 우리 은하 일부, 5. 우리 태양계, 6. 지구, 7. 지구의 한쪽, 8. 대륙, 9. 나라, 10. 나라의 일부 지역, 11. 도시, 12. 도시 일부, 13. 특정 거리, 14. 특정 주소의 건물, 15. 건물의 특정 층, 16. 아파트의 특정 집, 17. 아파트의 특정 방, 18. 방 안의 특정 선반, 19. 선반 위의 특정 상자... 등등. 일부 시점에서는 너무 구체적인 것들이 됩니다. 이것이 CFG가 사실상 "창의성 슬라이더"로 불리는 이유입니다. AI가 그림을 채우기 위해 찾아갈 수 있는 다른 것들의 양을 정의하는 것입니다. AI에는 "이해"할 수 있는 한계가 있으며, 보다 넓은 용어일수록 더 가치가 있습니다. 얼굴은 매우 넓은 개념이며, 눈, 코, 입은 덜 넓은 개념입니다. 그러나 이들은 얼굴과 연결되어 있습니다.

따라서 CFG는 모델의 구조와는 관련이 없습니다. 즉, CLIP 레이어를 사용하는지 여부와 관련이 없습니다. CFG는 단지 모델 내에서 얼마나 구체적으로 탐색해야 하는지에 대한 것이지, 어떻게 탐색하는지에 대한 것은 아닙니다. 절대적인 이론적 최대 CFG의 경우, "소년의 얼굴"을 프롬프트로 제시한다면, 기본적인 정의에 가장 가까운 것을 얻게 됩니다. 이를 직접 테스트해 보았습니다. 수천 단계로 100 CFG로 설정했습니다. 어느 시점에서는 사물이 기하학적인 모양과 대칭적인 것들로 붕괴됩니다. 기본적으로 얼굴이 무엇인가요? 특정한 인간 얼굴을 말하는 것은 아닙니다. 그것은 기하학적 모양의 평면에 불과합니다. 더 높은 척도를 탐색함에 따라 얼굴은 사실상 다이아몬드 모양이 되며, 복도가 있는 검은 구멍이 있고, 그 사이에는 삼각형이 있으며, 그 아래에는 몇 개의 선이 있습니다. AI가 이것을 만들었으므로 AI는 "잘못된" 것이 아닙니다. 이들은 사람 얼굴의 기본적인 패턴입니다. 그러나 피부 질감, 머리카락, 깊이 등과 같은 요소를 가져오지 않았습니다. AI는 프롬프트의 요구 사항을 충족하기 위해 필요한 것만 정확하게 얻은 것입니다.

Uploader's Information

Prompter: 탈퇴회원[1864] https://prompts.co.kr/탈퇴회원[1864]
  • Info
  • Date 2023-05-23 20:14:37 +0900
  • Actions
    목록
  • Liked by

Related Pictures

Picture's Exif Data

  • Prompt
    Masterpiece, top-notch, solo female, vibrant, exquisitely crafted eyes and intricate facial features, cinematic lighting, close-up shot, intricately detailed CG unity 8k wallpaper, snowy white hair, individual, radiant smile, ornate skirt, swirling petals, blooming meadow, sky, overcast sky, architecture, moonlit, moon, nocturnal, dark ambiance: 1.3, illumination, fantastical, traditional Korean dress (hanbok)
    COPY
  • Negative Prompt
    ng_deepnegative_v1_75t, badhandv4
    COPY
  • Info
    Steps: 40
    Sampler: DPM++ 2M Karras
    CFG scale: 8.0
    Seed: 3434058507  
    Size: 512x512
    Model hash: 2d0010aca5 
    Model: darkSushi25D25D_v20
    Denoising strength: 0.25
    Clip skip: 2
    Version: 1.1.1-102-g8ca50f82
    Hires upscale: 2.0
    Hires steps: 5
    Hires upscaler: R-ESRGAN 4x+ Anime6B
    
        

Picture's Exif Data

  • Prompt
    Masterpiece, top-notch, solo female, vibrant, exquisitely crafted eyes and intricate facial features, cinematic lighting, close-up shot, intricately detailed CG unity 8k wallpaper, snowy white hair, individual, radiant smile, ornate skirt, swirling petals, blooming meadow, sky, overcast sky, architecture, moonlit, moon, nocturnal, dark ambiance: 1.3, illumination, fantastical, traditional Korean dress (hanbok)
    COPY
  • Negative Prompt
    ng_deepnegative_v1_75t, badhandv4
    COPY
  • Info
    Steps: 40
    Sampler: DPM++ 2M Karras
    CFG scale: 8.0
    Seed: 3923801642  
    Size: 512x512
    Model hash: 2d0010aca5 
    Model: darkSushi25D25D_v20
    Denoising strength: 0.25
    Clip skip: 3
    Version: 1.1.1-102-g8ca50f82
    Hires upscale: 2.0
    Hires steps: 5
    Hires upscaler: R-ESRGAN 4x+ Anime6B
    
        

Picture's Exif Data

  • Prompt
    Masterpiece, top-notch, solo female, vibrant, exquisitely crafted eyes and intricate facial features, cinematic lighting, close-up shot, intricately detailed CG unity 8k wallpaper, snowy white hair, individual, radiant smile, ornate skirt, swirling petals, blooming meadow, sky, overcast sky, architecture, moonlit, moon, nocturnal, dark ambiance: 1.3, illumination, fantastical, traditional Korean dress (hanbok)
    COPY
  • Negative Prompt
    ng_deepnegative_v1_75t, badhandv4
    COPY
  • Info
    Steps: 40
    Sampler: DPM++ 2M Karras
    CFG scale: 8.0
    Seed: 2888432520  
    Size: 512x512
    Model hash: 2d0010aca5 
    Model: darkSushi25D25D_v20
    Denoising strength: 0.25
    Clip skip: 4
    Version: 1.1.1-102-g8ca50f82
    Hires upscale: 2.0
    Hires steps: 5
    Hires upscaler: R-ESRGAN 4x+ Anime6B
    
        

Picture's Exif Data

  • Prompt
    Masterpiece, top-notch, solo female, vibrant, exquisitely crafted eyes and intricate facial features, cinematic lighting, close-up shot, intricately detailed CG unity 8k wallpaper, snowy white hair, individual, radiant smile, ornate skirt, swirling petals, blooming meadow, sky, overcast sky, architecture, moonlit, moon, nocturnal, dark ambiance: 1.3, illumination, fantastical, traditional Korean dress (hanbok)
    COPY
  • Negative Prompt
    ng_deepnegative_v1_75t, badhandv4
    COPY
  • Info
    Steps: 40
    Sampler: DPM++ 2M Karras
    CFG scale: 8.0
    Seed: 169698924  
    Size: 512x512
    Model hash: 2d0010aca5 
    Model: darkSushi25D25D_v20
    Denoising strength: 0.25
    Clip skip: 5
    Version: 1.1.1-102-g8ca50f82
    Hires upscale: 2.0
    Hires steps: 5
    Hires upscaler: R-ESRGAN 4x+ Anime6B
    
        

Picture's Exif Data

  • Prompt
    Masterpiece, top-notch, solo female, vibrant, exquisitely crafted eyes and intricate facial features, cinematic lighting, close-up shot, intricately detailed CG unity 8k wallpaper, snowy white hair, individual, radiant smile, ornate skirt, swirling petals, blooming meadow, sky, overcast sky, architecture, moonlit, moon, nocturnal, dark ambiance: 1.3, illumination, fantastical, traditional Korean dress (hanbok)
    COPY
  • Negative Prompt
    ng_deepnegative_v1_75t, badhandv4
    COPY
  • Info
    Steps: 40
    Sampler: DPM++ 2M Karras
    CFG scale: 8.0
    Seed: 1637486588  
    Size: 512x512
    Model hash: 2d0010aca5 
    Model: darkSushi25D25D_v20
    Denoising strength: 0.25
    Clip skip: 7
    Version: 1.1.1-102-g8ca50f82
    Hires upscale: 2.0
    Hires steps: 5
    Hires upscaler: R-ESRGAN 4x+ Anime6B
    
        

Picture's Exif Data

  • Prompt
    Masterpiece, top-notch, solo female, vibrant, exquisitely crafted eyes and intricate facial features, cinematic lighting, close-up shot, intricately detailed CG unity 8k wallpaper, snowy white hair, individual, radiant smile, ornate skirt, swirling petals, blooming meadow, sky, overcast sky, architecture, moonlit, moon, nocturnal, dark ambiance: 1.3, illumination, fantastical, traditional Korean dress (hanbok)
    COPY
  • Negative Prompt
    ng_deepnegative_v1_75t, badhandv4
    COPY
  • Info
    Steps: 40
    Sampler: DPM++ 2M Karras
    CFG scale: 8.0
    Seed: 3174935253  
    Size: 512x512
    Model hash: 2d0010aca5 
    Model: darkSushi25D25D_v20
    Denoising strength: 0.25
    Clip skip: 8
    Version: 1.1.1-102-g8ca50f82
    Hires upscale: 2.0
    Hires steps: 5
    Hires upscaler: R-ESRGAN 4x+ Anime6B
    
        

Picture's Exif Data

  • Prompt
    Masterpiece, top-notch, solo female, vibrant, exquisitely crafted eyes and intricate facial features, cinematic lighting, close-up shot, intricately detailed CG unity 8k wallpaper, snowy white hair, individual, radiant smile, ornate skirt, swirling petals, blooming meadow, sky, overcast sky, architecture, moonlit, moon, nocturnal, dark ambiance: 1.3, illumination, fantastical, traditional Korean dress (hanbok)
    COPY
  • Negative Prompt
    ng_deepnegative_v1_75t, badhandv4
    COPY
  • Info
    Steps: 40
    Sampler: DPM++ 2M Karras
    CFG scale: 8.0
    Seed: 171040086  
    Size: 512x512
    Model hash: 2d0010aca5 
    Model: darkSushi25D25D_v20
    Denoising strength: 0.25
    Clip skip: 9
    Version: 1.1.1-102-g8ca50f82
    Hires upscale: 2.0
    Hires steps: 5
    Hires upscaler: R-ESRGAN 4x+ Anime6B
    
        

Picture's Exif Data

  • Prompt
    Masterpiece, top-notch, solo female, vibrant, exquisitely crafted eyes and intricate facial features, cinematic lighting, close-up shot, intricately detailed CG unity 8k wallpaper, snowy white hair, individual, radiant smile, ornate skirt, swirling petals, blooming meadow, sky, overcast sky, architecture, moonlit, moon, nocturnal, dark ambiance: 1.3, illumination, fantastical, traditional Korean dress (hanbok)
    COPY
  • Negative Prompt
    ng_deepnegative_v1_75t, badhandv4
    COPY
  • Info
    Steps: 40
    Sampler: DPM++ 2M Karras
    CFG scale: 8.0
    Seed: 961852883  
    Size: 512x512
    Model hash: 2d0010aca5 
    Model: darkSushi25D25D_v20
    Denoising strength: 0.25
    Clip skip: 10
    Version: 1.1.1-102-g8ca50f82
    Hires upscale: 2.0
    Hires steps: 5
    Hires upscaler: R-ESRGAN 4x+ Anime6B
    
        

Picture's Exif Data

  • Prompt
    Masterpiece, top-notch, solo female, vibrant, exquisitely crafted eyes and intricate facial features, cinematic lighting, close-up shot, intricately detailed CG unity 8k wallpaper, snowy white hair, individual, radiant smile, ornate skirt, swirling petals, blooming meadow, sky, overcast sky, architecture, moonlit, moon, nocturnal, dark ambiance: 1.3, illumination, fantastical, traditional Korean dress (hanbok)
    COPY
  • Negative Prompt
    ng_deepnegative_v1_75t, badhandv4
    COPY
  • Info
    Steps: 40
    Sampler: DPM++ 2M Karras
    CFG scale: 8.0
    Seed: 1271268991  
    Size: 512x512
    Model hash: 2d0010aca5 
    Model: darkSushi25D25D_v20
    Denoising strength: 0.25
    Clip skip: 11
    Version: 1.1.1-102-g8ca50f82
    Hires upscale: 2.0
    Hires steps: 5
    Hires upscaler: R-ESRGAN 4x+ Anime6B
    
        

Picture's Exif Data

  • Prompt
    Masterpiece, top-notch, solo female, vibrant, exquisitely crafted eyes and intricate facial features, cinematic lighting, close-up shot, intricately detailed CG unity 8k wallpaper, snowy white hair, individual, radiant smile, ornate skirt, swirling petals, blooming meadow, sky, overcast sky, architecture, moonlit, moon, nocturnal, dark ambiance: 1.3, illumination, fantastical, traditional Korean dress (hanbok)
    COPY
  • Negative Prompt
    ng_deepnegative_v1_75t, badhandv4
    COPY
  • Info
    Steps: 40
    Sampler: DPM++ 2M Karras
    CFG scale: 8.0
    Seed: 3372850916  
    Size: 512x512
    Model hash: 2d0010aca5 
    Model: darkSushi25D25D_v20
    Denoising strength: 0.25
    Clip skip: 12
    Version: 1.1.1-102-g8ca50f82
    Hires upscale: 2.0
    Hires steps: 5
    Hires upscaler: R-ESRGAN 4x+ Anime6B
    
        
  • DokgoSam2

    비슷한 글을 초보자 입장에서 old.prompts.co.kr 에 작성한 글이 있었는데, backup하여 두었는지 찾아보고, 저도 올려봐야겠습니다.

    좋은 글 감사합니다.

    2023-05-25 00:35:04 +0900