ohmeow / ohmeow_website

Apache License 2.0
24 stars 21 forks source link

`NameError: name 'HF_MODELS' is not defined` #9

Closed paulowoicho closed 4 years ago

paulowoicho commented 4 years ago

Hi, I am trying to follow your helpful tutorial (Text Generation with blurry) to fine-tune BART on a dataset of my own, however when I run the following code:

pretrained_model_name = "bart-large-cnn"

hf_arch, hf_tokenizer, hf_config, hf_model = \
    BLURR_MODEL_HELPER.get_hf_objects(pretrained_model_name, BartTokenizer, HF_MODELS.BartForConditionalGeneration)

hf_arch, type(hf_tokenizer), type(hf_config), type(hf_model)

I get the following error:

NameError: name 'HF_MODELS' is not defined

I also encounter another error saying BartTokenizer does not have an attribute called name.

I have not changed anything in the notebook and running it as it is. I wonder if I am missing anything. Thanks

abheesht17 commented 4 years ago

Change it to:

pretrained_model_name = "facebook/bart-large-cnn"
hf_arch, hf_config, hf_tokenizer, hf_model = BLURR_MODEL_HELPER.get_hf_objects(pretrained_model_name, 
                                                                               model_cls=BartForConditionalGeneration)

hf_arch, type(hf_config), type(hf_tokenizer), type(hf_model)

Follow this notebook: https://github.com/ohmeow/blurr/blob/master/nbs/02e_modeling-text-generation.ipynb

ohmeow commented 4 years ago

Yah, I've been messing with the API since I published the notebook ... thanks for the reminder to update it. :)

Glad you found the solution. The docs are up-to-date.

Thanks - wg

On Tue, Jul 28, 2020 at 11:51 AM abheesht17 notifications@github.com wrote:

Change it to:

pretrained_model_name = "facebook/bart-large-cnn" hf_arch, hf_config, hf_tokenizer, hf_model = BLURR_MODEL_HELPER.get_hf_objects(pretrained_model_name, model_cls=BartForConditionalGeneration)

hf_arch, type(hf_config), type(hf_tokenizer), type(hf_model)

Follow this notebook: https://github.com/ohmeow/blurr/blob/master/nbs/02e_modeling-text-generation.ipynb

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ohmeow/ohmeow_website/issues/9#issuecomment-665215305, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADNMC5XN6HPS43I6CVKZDR54M4JANCNFSM4PIHZT5A .

ohmeow commented 4 years ago

Just updated the colab notebook so closing this out. Lmk how things go.