curiousily / Getting-Things-Done-with-Pytorch

Jupyter Notebook tutorials on solving real-world problems with Machine Learning & Deep Learning using PyTorch. Topics: Face detection with Detectron 2, Time Series anomaly detection with LSTM Autoencoders, Object Detection with YOLO v5, Build your first Neural Network, Time Series forecasting for Coronavirus daily cases, Sentiment Analysis with BER
https://mlexpert.io
Apache License 2.0
2.35k stars 632 forks source link

Problem printing the shape of last_hidden_state and pooled_output #22

Closed ulfat191 closed 2 years ago

ulfat191 commented 2 years ago

Change this line -> bert_model = BertModel.from_pretrained(PRE_TRAINED_MODEL_NAME) to bert_model = BertModel.from_pretrained(PRE_TRAINED_MODEL_NAME, return_dict=False)

as a result the dict will not return str rather will return tensor.

It will help you with other parts of code as well.