Spaces:
Runtime error
Runtime error
Update train.py
Browse files
train.py
CHANGED
|
@@ -4,7 +4,7 @@ from datasets import Dataset
|
|
| 4 |
|
| 5 |
|
| 6 |
# Prepare the dataset (simplified)
|
| 7 |
-
def prepare_text_dataset(data):
|
| 8 |
# Split the text into smaller chunks (consider logical divisions of the Constitution)
|
| 9 |
chunks = [data[i:i+chunk_size] for i in range(0, len(data), chunk_size)]
|
| 10 |
# Convert chunks to dictionaries with a single feature "text"
|
|
@@ -56,7 +56,7 @@ def init():
|
|
| 56 |
)
|
| 57 |
|
| 58 |
# Start training
|
| 59 |
-
trainer.train()
|
| 60 |
|
| 61 |
# Save the fine-tuned model
|
| 62 |
model.save_pretrained("./fine-tuned_model")
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
# Prepare the dataset (simplified)
|
| 7 |
+
def prepare_text_dataset(data, chunk_size):
|
| 8 |
# Split the text into smaller chunks (consider logical divisions of the Constitution)
|
| 9 |
chunks = [data[i:i+chunk_size] for i in range(0, len(data), chunk_size)]
|
| 10 |
# Convert chunks to dictionaries with a single feature "text"
|
|
|
|
| 56 |
)
|
| 57 |
|
| 58 |
# Start training
|
| 59 |
+
trainer.train(chunk_size)
|
| 60 |
|
| 61 |
# Save the fine-tuned model
|
| 62 |
model.save_pretrained("./fine-tuned_model")
|