Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -61,10 +61,13 @@ transformers.utils.logging.set_verbosity_error()
|
|
61 |
task_name = 'sst2'
|
62 |
model_type = 'transkimer'
|
63 |
|
|
|
|
|
|
|
64 |
# Load pretrained model and tokenizer
|
65 |
model_path_key = f'{model_type}_{task_name}_not_pad'
|
66 |
model_path = model_path_dict[model_path_key]
|
67 |
-
config = AutoConfig.from_pretrained(model_path, num_labels=
|
68 |
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased', use_fast=True)
|
69 |
model = TranskimerForSequenceClassification.from_pretrained(model_path,from_tf=bool(".ckpt" in model_path),config=config,)
|
70 |
|
@@ -72,9 +75,6 @@ model = TranskimerForSequenceClassification.from_pretrained(model_path,from_tf=b
|
|
72 |
sentence1_key, sentence2_key = task_to_keys[task_name]
|
73 |
|
74 |
processor = processors[task_name]()
|
75 |
-
label_list = processor.get_labels()
|
76 |
-
|
77 |
-
label_to_id = {v: i for i, v in enumerate(label_list)}
|
78 |
|
79 |
padding = False
|
80 |
|
|
|
61 |
task_name = 'sst2'
|
62 |
model_type = 'transkimer'
|
63 |
|
64 |
+
label_list = processor.get_labels()
|
65 |
+
label_to_id = {v: i for i, v in enumerate(label_list)}
|
66 |
+
|
67 |
# Load pretrained model and tokenizer
|
68 |
model_path_key = f'{model_type}_{task_name}_not_pad'
|
69 |
model_path = model_path_dict[model_path_key]
|
70 |
+
config = AutoConfig.from_pretrained(model_path, num_labels=len(label_list), finetuning_task=task_name)
|
71 |
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased', use_fast=True)
|
72 |
model = TranskimerForSequenceClassification.from_pretrained(model_path,from_tf=bool(".ckpt" in model_path),config=config,)
|
73 |
|
|
|
75 |
sentence1_key, sentence2_key = task_to_keys[task_name]
|
76 |
|
77 |
processor = processors[task_name]()
|
|
|
|
|
|
|
78 |
|
79 |
padding = False
|
80 |
|