Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -93,7 +93,10 @@ if (should_train_model=='1'): #train model
|
|
93 |
|
94 |
repo_name = "Reyad-Ahmmed/hf-data-timeframe"
|
95 |
|
96 |
-
tokenizer = BertTokenizer.from_pretrained(repo_name, subfolder="bert_embeddings_finetune
|
|
|
|
|
|
|
97 |
# I made sure to add all the ones in the training and eval data to this list
|
98 |
# since we are training using data that only contains the left tag - we don't need right tags added to this list
|
99 |
new_tokens = ['<EMPLOYEE_FIRST_NAME>', '<EMPLOYEE_LAST_NAME>','<POINT_ADDRESS>', '<TRUCK_NAME>', '<POINT_CLASS_NAME>', '<POINT_NAME>', '<TRUCK_CLASS_NAME>', '<TRUCK_STATUS_NAME>]']
|
@@ -101,7 +104,9 @@ if (should_train_model=='1'): #train model
|
|
101 |
|
102 |
|
103 |
# Model
|
104 |
-
model = BertForSequenceClassification.from_pretrained(repo_name, subfolder="bert_embeddings_finetune", output_attentions=True, num_labels=len(label_mapping), output_hidden_states=True).to('cpu')
|
|
|
|
|
105 |
|
106 |
# Reset tokenizer size to include the new size after adding the tags to the tokenizer's tokens
|
107 |
model.resize_token_embeddings(len(tokenizer))
|
|
|
93 |
|
94 |
repo_name = "Reyad-Ahmmed/hf-data-timeframe"
|
95 |
|
96 |
+
#tokenizer = BertTokenizer.from_pretrained(repo_name, subfolder="bert_embeddings_finetune
|
97 |
+
|
98 |
+
tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
|
99 |
+
|
100 |
# I made sure to add all the ones in the training and eval data to this list
|
101 |
# since we are training using data that only contains the left tag - we don't need right tags added to this list
|
102 |
new_tokens = ['<EMPLOYEE_FIRST_NAME>', '<EMPLOYEE_LAST_NAME>','<POINT_ADDRESS>', '<TRUCK_NAME>', '<POINT_CLASS_NAME>', '<POINT_NAME>', '<TRUCK_CLASS_NAME>', '<TRUCK_STATUS_NAME>]']
|
|
|
104 |
|
105 |
|
106 |
# Model
|
107 |
+
#model = BertForSequenceClassification.from_pretrained(repo_name, subfolder="bert_embeddings_finetune", output_attentions=True, num_labels=len(label_mapping), output_hidden_states=True).to('cpu')
|
108 |
+
|
109 |
+
model = BertForSequenceClassification.from_pretrained("bert-base-uncased", output_attentions=True, num_labels=len(label_mapping), output_hidden_states=True).to('cpu')
|
110 |
|
111 |
# Reset tokenizer size to include the new size after adding the tags to the tokenizer's tokens
|
112 |
model.resize_token_embeddings(len(tokenizer))
|