lachie0232 commited on
Commit
6bdf21e
·
verified ·
1 Parent(s): 634865d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,11 +1,11 @@
1
- from transformers import Trainer, TrainingArguments, DeepSeekForQuestionAnswering, DeepSeekTokenizer
2
  from datasets import load_dataset
3
 
4
- # Load the DeepSeek model and tokenizer
5
- model = DeepSeekForQuestionAnswering.from_pretrained("DeepSeek/DeepSeek-v3")
6
- tokenizer = DeepSeekTokenizer.from_pretrained("DeepSeek/DeepSeek-v3")
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 the fine-tuning
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