Giter Club home page Giter Club logo

koclip's Introduction

Hi there ๐Ÿ‘‹ I'm Jake.

google-scholar linkedin twitter blog

I'm passionate about generative modeling, text-to-speech, NLP, and recommendation systems.

Currently, I'm a senior at Yale studying CS and Math. Previously, I was a

koclip's People

Contributors

choiking10 avatar guijinson avatar jaketae avatar minsik-ai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

koclip's Issues

inference.ipynb ๋งˆ์ง€๋ง‰ cell

์•ˆ๋…•ํ•˜์„ธ์š”. ์ข‹์€ ๋ชจ๋ธ ๋งŒ๋“ค์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

ํ•ด๋‹น repository์˜ inference.ipynb์˜ ๋งˆ์ง€๋ง‰ cell์— "text" ๋ผ๋Š” ์ด๋ฆ„์˜ ๊ฐ์ฒด๊ฐ€ ํ•„์š”ํ•ด๋ณด์ž…๋‹ˆ๋‹ค.

๋งˆ์ง€๋ง‰ cell์˜ ๋งจ ์ฒซ์ค„์— ์•„๋ž˜์™€ ๊ฐ™์ด ์ถ”๊ฐ€ํ•˜๋ฉด ๋ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค.

๊ธฐ์กด

inputs = processor(
    text=["์†ŒํŒŒ ์œ„์— ๊ณ ์–‘์ด", "๊ฐ•์•„์ง€์™€ ๊ฐ•์•„์ง€ ์ฃผ์ธ", "์ณ‡๋ฐ”ํ€ด๋ฅผ ๋‹ฌ๋ฆฌ๋Š” ํ–„์Šคํ„ฐ", "์ž๋™์ฐจ"],
    images=image, 
    return_tensors="jax", # could also be "pt" 
    padding=True
)

...(์ƒ๋žต)...

์ˆ˜์ • (์ œ์•ˆ)

text = ["์†ŒํŒŒ ์œ„์— ๊ณ ์–‘์ด", "๊ฐ•์•„์ง€์™€ ๊ฐ•์•„์ง€ ์ฃผ์ธ", "์ณ‡๋ฐ”ํ€ด๋ฅผ ๋‹ฌ๋ฆฌ๋Š” ํ–„์Šคํ„ฐ", "์ž๋™์ฐจ"]
inputs = processor(
    text=text,
    images=image, 
    return_tensors="jax", # could also be "pt" 
    padding=True
)

...(์ƒ๋žต)...

GPU๋ฅผ ์ด์šฉํ•œ ํ•™์Šต ๋ฐฉ๋ฒ• ๋ฌธ์˜

์•ˆ๋…•ํ•˜์„ธ์š”
KOCLIP์„ ์ด์šฉํ•˜์—ฌ ์ €ํฌ๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ด์šฉํ•˜์—ฌ ํ•™์Šต์„ ์‹œ์ผœ๋ณด๋ ค๊ณ  ํ•˜๋Š”๋ฐ
์ œ๊ณตํ•ด์ฃผ์‹  run.py, train.sh ๋ฅผ ์ด์šฉํ•ด์„œ ํ•™์Šต์„ ํ•˜๋ฉด
CPU๋งŒ ์‚ฌ์šฉ์„ ํ•ฉ๋‹ˆ๋‹ค

os.environ["CUDA_VISIBLE_DEVICES"]
ํ˜น์€
export CUDA_VISIBLE_DEVICES ๋ฅผ ์ด์šฉํ•˜์—ฌ ์ง€์ •์„ ํ•ด ์ค€ ํ›„
ํ•™์Šต์„ ํ•˜์—ฌ๋„ GPU๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  CPU๋งŒ ์‚ฌ์šฉ์„ ํ•˜์—ฌ ํ•™์Šต์ด ์ง„ํ–‰๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

GPU๋กœ ํ•™์Šต์„ ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ๋”ฐ๋กœ ์žˆ๋Š”๊ฑด์ง€, ์•„๋‹ˆ๋ฉด ์ œ๊ฐ€ ์†Œ์Šค๋ฅผ ์ˆ˜์ •ํ•ด์„œ ์ ์šฉ ๋˜๋„๋ก ๋ณ€๊ฒฝ ํ•ด์•ผ ํ•˜๋Š”๊ฑด์ง€
์•ˆ๋‚ด ๋ถ€ํƒ ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค.

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

ํ•™์Šต ๊ด€๋ จ ๋ฌธ์˜ 2๊ฐ€์ง€.

์•ˆ๋…•ํ•˜์„ธ์š”. KOCLIP ํ•™์Šต ์ง„ํ–‰ ๋„์ค‘ ์˜๋ฌธ์ ์ด ์ƒ๊ฒจ ์งˆ๋ฌธ์„ ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

  1. ํ•™์Šต์„ ์ง„ํ–‰ํ•˜๋ฉด Loss ์™€ Eval Loss๊ฐ€ ํ•ญ์ƒ ๋™์ผํ•ฉ๋‹ˆ๋‹ค. (Learning Rate๋Š” ๊ณ„์† ์ค„์–ด๋“ฌ)
    ์ €์˜ ๋ฐ์ดํ„ฐ๋งŒ ๊ทธ๋Ÿฐ๊ฒŒ ์•„๋‹ˆ๋ผ, ์˜ˆ์‹œ๋กœ ์žˆ๋Š” coco ๋ฐ์ดํ„ฐ๋„ ๋™์ผํ•ฉ๋‹ˆ๋‹ค.
    ์ด๊ฒŒ ์ •์ƒ์ ์ธ ํ•™์Šต์ด ๋งž๋Š”๊ฑด์ง€,, ํ™•์ธ ์š”์ฒญ ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

1-1 . KoCLIP ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” coco ๋ฐ์ดํ„ฐ์™€ train.sh ๋ฅผ ์ด์šฉํ•˜์—ฌ ํ•™์Šต

  • Eval Loss ๋Š” Epoch 2๋ถ€ํ„ฐ ๊ณ„์† ๋™์ผ. ๊ทธ๋ƒฅ Loss ๋Š” Epoch 3๋ถ€ํ„ฐ ๋™์ผ

09/04/2023 11:01:46 - INFO - main - ***** Running training *****
09/04/2023 11:01:46 - INFO - main - Num examples = 413915
09/04/2023 11:01:46 - INFO - main - Num Epochs = 40
09/04/2023 11:01:46 - INFO - main - Instantaneous batch size per device = 64
09/04/2023 11:01:46 - INFO - main - Total train batch size (w. parallel & distributed) = 64
09/04/2023 11:01:46 - INFO - main - Total optimization steps = 258680
Epoch... (1/40 | Loss: 4.158902168273926, Learning Rate: 4.8750189307611436e-05)
Epoch... (1/40 | Eval Loss: 4.158883094787598)
Epoch... (2/40 | Loss: 4.158882141113281, Learning Rate: 4.7500190703431144e-05)
Epoch... (2/40 | Eval Loss: 4.1588826179504395)
Epoch... (3/40 | Loss: 4.158883094787598, Learning Rate: 4.625019209925085e-05)
Epoch... (3/40 | Eval Loss: 4.1588826179504395)
Epoch... (4/40 | Loss: 4.158883094787598, Learning Rate: 4.5000189857091755e-05)
Epoch... (4/40 | Eval Loss: 4.1588826179504395)
Epoch... (5/40 | Loss: 4.158883094787598, Learning Rate: 4.375019125291146e-05)
Epoch... (5/40 | Eval Loss: 4.1588826179504395)

1-2. ์ค€๋น„ํ•œ ํ•™์Šต์šฉ ๋ฐ์ดํ„ฐ์™€ train.sh ๋ฅผ ์ด์šฉํ•˜์—ฌ ํ•™์Šต

  • Loss ์™€ Eval loss ๋ชจ๋‘ Epoch 1๋ถ€ํ„ฐ ๊ณ„์† ๋™์ผ (Epoch 4์˜ Eval loss ๋‹ค๋ฆ„)

08/31/2023 15:16:15 - INFO - main - ***** Running training *****
08/31/2023 15:16:15 - INFO - main - Num examples = 2474242
08/31/2023 15:16:15 - INFO - main - Num Epochs = 40
08/31/2023 15:16:15 - INFO - main - Instantaneous batch size per device = 64
08/31/2023 15:16:15 - INFO - main - Total train batch size (w. parallel & distributed) = 64
08/31/2023 15:16:15 - INFO - main - Total optimization steps = 1546400
Epoch... (1/40 | Loss: 4.158883094787598, Learning Rate: 4.8750029236543924e-05)
Epoch... (1/40 | Eval Loss: 4.1588826179504395)
Epoch... (2/40 | Loss: 4.158883094787598, Learning Rate: 4.750003063236363e-05)
Epoch... (2/40 | Eval Loss: 4.1588826179504395)
Epoch... (3/40 | Loss: 4.158883094787598, Learning Rate: 4.625003202818334e-05)
Epoch... (3/40 | Eval Loss: 4.1588826179504395)
Epoch... (4/40 | Loss: 4.158883094787598, Learning Rate: 4.500002978602424e-05)
Epoch... (4/40 | Eval Loss: 4.158883094787598)
Epoch... (5/40 | Loss: 4.158883094787598, Learning Rate: 4.375003118184395e-05)
Epoch... (5/40 | Eval Loss: 4.1588826179504395)
Epoch... (6/40 | Loss: 4.158883094787598, Learning Rate: 4.250002893968485e-05)
Epoch... (6/40 | Eval Loss: 4.1588826179504395)
Epoch... (7/40 | Loss: 4.158883094787598, Learning Rate: 4.125003033550456e-05)
Epoch... (7/40 | Eval Loss: 4.1588826179504395)
Epoch... (8/40 | Loss: 4.158883094787598, Learning Rate: 4.000003173132427e-05)
Epoch... (8/40 | Eval Loss: 4.1588826179504395)
Epoch... (9/40 | Loss: 4.158883094787598, Learning Rate: 3.875002948916517e-05)
Epoch... (9/40 | Eval Loss: 4.1588826179504395)
Epoch... (10/40 | Loss: 4.158883094787598, Learning Rate: 3.750003088498488e-05)
Epoch... (10/40 | Eval Loss: 4.1588826179504395)

์ด๋ ‡๊ฒŒ 25 ์—ํญ๊นŒ์ง€ ๋Œ๋ฆฌ๋‹ค๊ฐ€ ๋„์ €ํžˆ ์•„๋‹Œ ๊ฒƒ ๊ฐ™์•„์„œ ์ข…๋ฃŒ ํ–ˆ์Šต๋‹ˆ๋‹ค.

  1. configuration ํŒŒ์ผ ๋ฐ weight ํŒŒ์ผ ์ €์žฅ
    ํ˜„์žฌ train.sh ๋ฐ run.py ๊ตฌ์„ฑ์œผ๋กœ ํ•™์Šต์„ ์ง„ํ–‰ํ•˜๋ฉด
    ์—ํญ์„ ๋Œ ๋•Œ ๋งˆ๋‹ค
    Configuration saved in /home/test/koclip/checkpoint/config.json
    Model weights saved in /home/test/koclip/checkpoint/flax_model.msgpack

์ด๋ ‡๊ฒŒ ํ•ญ์ƒ ๊ฐ™์€ ๊ฒฝ๋กœ์— ํŒŒ์ผ์„ ๋ฎ์–ด์“ฐ๊ฒŒ ๋˜๋Š”๋ฐ
ํ•ญ์ƒ ๋ชจ๋“  ๊ฒฝ์šฐ์— ๋ฎ์–ด ์“ฐ๊ฒŒ ๋˜๋Š”๊ฑด์ง€ ์•„๋‹ˆ๋ฉด, ์ตœ์ ์˜ ์ผ€์ด์Šค๊ฐ€ ๋ฐœ๊ฒฌ๋˜๋ฉด ๊ทธ๋•Œ๋งŒ ๋ฎ์–ด์“ฐ๊ฒŒ ๋˜๋Š”๊ฑด์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.

๋‹ต๋ณ€ ์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!

TypeError: __init__() got an unexpected keyword argument '_do_init'

Colab ํ™˜๊ฒฝ์—์„œ ์‹คํ–‰ ์‹œ ์œ„์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋‚ฉ๋‹ˆ๋‹ค.
ํ˜น์‹œ ์–ด๋– ํ•œ ์ด์œ ์—์„œ ์ƒ๊ฒจ๋‚˜๋Š” ์˜ค๋ฅ˜์ด์‹ ์ง€ ํ™•์ธํ•ด ์ฃผ์‹ค ์ˆ˜ ์žˆ์œผ์‹ ๊ฐ€์š”?

TypeError                                 Traceback (most recent call last)
[<ipython-input-8-20ea54d41cb6>](https://localhost:8080/#) in <module>
      5 from koclip import load_koclip
      6 
----> 7 model, processor = load_koclip("koclip-base")
      8 

2 frames
[/content/koclip/koclip/model.py](https://localhost:8080/#) in __init__(self, config, input_shape, seed, dtype, **kwargs)
    159             )
    160 
--> 161         module = self.module_class(config=config, dtype=dtype, **kwargs)
    162         super().__init__(
    163             config, module, input_shape=input_shape, seed=seed, dtype=dtype

TypeError: __init__() got an unexpected keyword argument '_do_init'

*** ValueError: You have to specify pixel_values for text embedding

Hi I'm trying to extract text embedding and get the *** ValueError: You have to specify pixel_values error.
Here are the code to reproduce:

    repo = "koclip/koclip-base-pt" 
    model = AutoModel.from_pretrained(repo)
    tokenizer = AutoTokenizer.from_pretrained(repo)
    text_only_inputs = tokenizer(text="test", return_tensors="pt", padding=True)
    model(**text_only_inputs)

Appreciate for any solutions. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.