Spaces:
Runtime error
Runtime error
lachie0232
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
from transformers import Trainer, TrainingArguments,
|
2 |
from datasets import load_dataset
|
3 |
|
4 |
-
# Load the
|
5 |
-
model =
|
6 |
-
tokenizer =
|
7 |
|
8 |
-
# Load dataset
|
9 |
dataset = load_dataset("json", data_files={"train": "your_dataset_train.json", "test": "your_dataset_test.json"})
|
10 |
|
11 |
# Tokenize the dataset
|
@@ -25,7 +25,7 @@ training_args = TrainingArguments(
|
|
25 |
weight_decay=0.01
|
26 |
)
|
27 |
|
28 |
-
# Initialize Trainer
|
29 |
trainer = Trainer(
|
30 |
model=model,
|
31 |
args=training_args,
|
@@ -33,7 +33,7 @@ trainer = Trainer(
|
|
33 |
eval_dataset=tokenized_datasets['test']
|
34 |
)
|
35 |
|
36 |
-
# Start
|
37 |
trainer.train()
|
38 |
|
39 |
# Save the model after fine-tuning
|
|
|
1 |
+
from transformers import Trainer, TrainingArguments, AutoModelForQuestionAnswering, AutoTokenizer
|
2 |
from datasets import load_dataset
|
3 |
|
4 |
+
# Load the model and tokenizer from the Hub
|
5 |
+
model = AutoModelForQuestionAnswering.from_pretrained("DeepSeek/DeepSeek-v3")
|
6 |
+
tokenizer = AutoTokenizer.from_pretrained("DeepSeek/DeepSeek-v3")
|
7 |
|
8 |
+
# Load your dataset
|
9 |
dataset = load_dataset("json", data_files={"train": "your_dataset_train.json", "test": "your_dataset_test.json"})
|
10 |
|
11 |
# Tokenize the dataset
|
|
|
25 |
weight_decay=0.01
|
26 |
)
|
27 |
|
28 |
+
# Initialize the Trainer
|
29 |
trainer = Trainer(
|
30 |
model=model,
|
31 |
args=training_args,
|
|
|
33 |
eval_dataset=tokenized_datasets['test']
|
34 |
)
|
35 |
|
36 |
+
# Start fine-tuning
|
37 |
trainer.train()
|
38 |
|
39 |
# Save the model after fine-tuning
|