Skip to content

keras_nlp option to store and load from the local drive? #1050

Answered by jbischof
ramkumarkoppu asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, @ramkumarkoppu! It's a little involved but the easiest workflow would be this (colab version).

The same workflow applies if you finetune the weights with a training loop. Just save and load back into the backbone later.

import keras
import keras_nlp

# Download directly or save the relevant attributes off the model
weights_file = keras.utils.get_file(
    "model.h5",
    "https://storage.googleapis.com/keras-nlp/models/gpt2_base_en/v1/model.h5",
)
vocab_file = keras.utils.get_file(
    "vocab.txt",
    "https://storage.googleapis.com/keras-nlp/models/gpt2_base_en/v1/vocab.json",
)
merges_file = keras.utils.get_file(
    "merges.json",
    "https://storage.googleapis.com/keras-nlp/mod…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ramkumarkoppu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants