Giter Site home page Giter Site logo

compressedbart's People

Contributors

alafalaki avatar

Watchers

 avatar

compressedbart's Issues

Initialization from Bart-Large does not work

Hello,
Thank you for sharing the code for this project here.

I was trying to convert a Bart-large pre-trained checkpoint into CompressedBart. The checkpoint is available on HuggingFace. I used the following code:

ae = architectures.Autoencoder(bart_encoder_emb_size=768,
                            first_proj=first_projection,
                            second_proj=second_projection,
                            third_proj=third_projection,
                            max_len=max_input_length)
# Initialize compressedBART
cbart_config = BartConfig.from_pretrained(bart_checkpoint)
cbart_config.enc_d_model = cbart_config.d_model
cbart_config.d_model = 384
CBart_model = architectures.CBartForConditionalGeneration.from_pretrained(checkpoint_dir,
                                                           config=cbart_config,ae=ae,ignore_mismatched_sizes=True)

# Load the weights and put it on GPU
ae_checkpoint = os.path.join( checkpoint_dir, "ae-checkpoint.pth" )
if torch.cuda.is_available():
   ae_checkpoint = torch.load(ae_checkpoint)

else:
   ae_checkpoint = torch.load(ae_checkpoint, map_location=torch.device('cpu'))

CBart_model.model.encoder.ae.load_state_dict(ae_checkpoint['model'])
del ae_checkpoint

#CBart_model.eval()

if torch.cuda.is_available():
   CBart_model.to("cuda")

So far everything works. However, after I pass the model to the Trainer class and start evaluating (or training) I get the following error:

RuntimeError: mat1 and mat2 shapes cannot be multiplied (4096x1024 and 768x576)

Is it because I am using the 384 checkpoint and should instead use the 540? Could you please share this checkpoint again since the link expired.

Many thanks.
Best wishes.

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.