Spaces:
Sleeping
Sleeping
diabolic6045
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import torch
|
|
5 |
import transformers
|
6 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer, Trainer, TrainingArguments, DataCollatorForLanguageModeling
|
7 |
from datasets import Dataset
|
8 |
-
import spaces
|
9 |
|
10 |
# Set random seeds for reproducibility
|
11 |
random.seed(42)
|
@@ -59,7 +59,7 @@ def prepare_dataset(data, tokenizer, block_size=128):
|
|
59 |
tokenized_dataset.set_format(type='torch', columns=['input_ids', 'attention_mask', 'labels'])
|
60 |
return tokenized_dataset
|
61 |
|
62 |
-
@spaces.GPU()
|
63 |
def fitness_function(individual, train_dataset, tokenizer, model_state_dict):
|
64 |
# Initialize the model inside this function
|
65 |
model = GPT2LMHeadModel.from_pretrained('gpt2')
|
|
|
5 |
import transformers
|
6 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer, Trainer, TrainingArguments, DataCollatorForLanguageModeling
|
7 |
from datasets import Dataset
|
8 |
+
# import spaces
|
9 |
|
10 |
# Set random seeds for reproducibility
|
11 |
random.seed(42)
|
|
|
59 |
tokenized_dataset.set_format(type='torch', columns=['input_ids', 'attention_mask', 'labels'])
|
60 |
return tokenized_dataset
|
61 |
|
62 |
+
# @spaces.GPU()
|
63 |
def fitness_function(individual, train_dataset, tokenizer, model_state_dict):
|
64 |
# Initialize the model inside this function
|
65 |
model = GPT2LMHeadModel.from_pretrained('gpt2')
|