Code Monkey home page Code Monkey logo

Comments (4)

rmokady avatar rmokady commented on July 24, 2024

Hi @cenjinglun,
It seems that you have a mismatch between the pretrained model and the configuration. Note that these models are using with MLP mapping network and not transformer.

To my opinion, the best way to make sure the pretrained model and configuration is matched, is using the colab notebook we provide.

I'll also will try to make it more clear in the readme.

from clip_prefix_caption.

cenjinglun avatar cenjinglun commented on July 24, 2024

Thank you very much for pointing out my mistakes.

I want to run it on local, so I downloaded the weights mentioned above. However, because I am not so familiar with the code, I only replaced the model_path in clip_prefix_captioning_inference.ipynb.

model = ClipCaptionPrefix(prefix_length, clip_length=40, prefix_size=640, num_layers=8, mapping_type='transformer')
model_path = 'path/to/coco_weight.pt'       # what I add
model.load_state_dict(torch.load(model_path, map_location=CPU))

If possible, could you tell me the where shoule I load these weights?

from clip_prefix_caption.

rmokady avatar rmokady commented on July 24, 2024

You can use the exact code appear in the notebook:
model = ClipCaptionModel(prefix_length) model.load_state_dict(torch.load(model_path, map_location=CPU))
Of course you need you use also other cells

Looking at your code, it seems you used the transformer notebook instead
Please try the clip_prefix_captioning_inference.ipynb notebook

from clip_prefix_caption.

cenjinglun avatar cenjinglun commented on July 24, 2024

Ok, it works.

Thanks.

from clip_prefix_caption.

Related Issues (20)

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.