This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import AutoModelForMaskedLM | |
roberta = AutoModelForMaskedLM.from_pretrained("roberta-large") | |
print(roberta) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import seaborn as sns | |
def average_word_count(list_of_texts): | |
""" | |
Returns the average word count of a list of texts. | |
""" | |
total_count = 0 | |
for text in list_of_texts: | |
text = text.replace("'", ' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This snippet requires you to install Hugging Face's datasets module | |
from datasets import load_dataset | |
import pandas as pd | |
Dataframe = pd.DataFrame({}) | |
questions = load_dataset('squad')['train']['question'][:3000] | |
Dataframe = Dataframe.append(pd.DataFrame({'Text' : questions, 'Source' : 'squad'})) | |
questions = load_dataset('hotpot_qa', 'distractor')['train']['question'][:3000] |
NewerOlder