Skip to content

Commit

Permalink
J
Browse files Browse the repository at this point in the history
  • Loading branch information
jcollopy-tulane committed Apr 29, 2024
1 parent dcad358 commit aca9766
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions nlp/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,9 @@ def train_bert():
'''
Get BERT
'''



gauth = GoogleAuth()
gauth.LocalWebserverAuth() # Follow the authentication steps
drive = GoogleDrive(gauth)

# Replace 'file_id_here' with the file ID from the Google Drive link
file_id = 'https://drive.google.com/file/d/1K26N14tCziLm97ie7YeBBK8d_fz9oIg3/view?usp=sharing'

# Download the file
downloaded_file = drive.CreateFile({'id': file_id})
downloaded_file.GetContentFile('bert_model.pth')

# Load the model from the downloaded file
model_state_dict = torch.load('bert_model.pth', map_location=torch.device('cpu'))
model = AutoModelForSequenceClassification.from_pretrained('prajjwal1/bert-mini', num_labels=2)
model.load_state_dict(torch.load('bert_model.pth'))
tokenizer = BertTokenizerFast.from_pretrained('prajjwal1/bert-mini')

def tokenize(data, max_length=87):
Expand Down

0 comments on commit aca9766

Please sign in to comment.