Spaces:
Configuration error
Configuration error
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
from transformers import BertTokenizer, TFBertForSequenceClassification
|
| 2 |
-
from tensorflow.keras.optimizers import Adam
|
| 3 |
-
from tensorflow.keras.losses import SparseCategoricalCrossentropy
|
| 4 |
-
|
| 5 |
-
# Load pre-trained BERT model and tokenizer
|
| 6 |
-
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
|
| 7 |
-
model = TFBertForSequenceClassification.from_pretrained('bert-base-uncased')
|
| 8 |
-
|
| 9 |
-
# Tokenize sample text
|
| 10 |
-
inputs = tokenizer("Hello, this is a sentiment analysis example.", return_tensors="tf")
|
| 11 |
-
|
| 12 |
-
# Fine-tuning BERT model
|
| 13 |
-
model.compile(optimizer=Adam(learning_rate=3e-5), loss=SparseCategoricalCrossentropy(from_logits=True))
|
| 14 |
-
model.fit(inputs['input_ids'], [1], epochs=1) # Dummy training example
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|