Update app.py
Browse files
app.py
CHANGED
|
@@ -18,13 +18,13 @@ def load_and_preprocess_data():
|
|
| 18 |
example['prompt'],
|
| 19 |
truncation=True,
|
| 20 |
padding='max_length',
|
| 21 |
-
max_length=
|
| 22 |
)
|
| 23 |
rejected_tokenized = tokenizer(
|
| 24 |
example['prompt'],
|
| 25 |
truncation=True,
|
| 26 |
padding='max_length',
|
| 27 |
-
max_length=
|
| 28 |
)
|
| 29 |
|
| 30 |
# Combine chosen and rejected in one sequence
|
|
@@ -35,7 +35,7 @@ def load_and_preprocess_data():
|
|
| 35 |
}
|
| 36 |
|
| 37 |
# Ensure the lengths match; adjust if necessary
|
| 38 |
-
max_length =
|
| 39 |
if len(inputs['input_ids']) > max_length:
|
| 40 |
inputs['input_ids'] = inputs['input_ids'][:max_length]
|
| 41 |
inputs['attention_mask'] = inputs['attention_mask'][:max_length]
|
|
|
|
| 18 |
example['prompt'],
|
| 19 |
truncation=True,
|
| 20 |
padding='max_length',
|
| 21 |
+
max_length=500
|
| 22 |
)
|
| 23 |
rejected_tokenized = tokenizer(
|
| 24 |
example['prompt'],
|
| 25 |
truncation=True,
|
| 26 |
padding='max_length',
|
| 27 |
+
max_length=500
|
| 28 |
)
|
| 29 |
|
| 30 |
# Combine chosen and rejected in one sequence
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
# Ensure the lengths match; adjust if necessary
|
| 38 |
+
max_length = 500 * 2 # Since we're combining two sequences
|
| 39 |
if len(inputs['input_ids']) > max_length:
|
| 40 |
inputs['input_ids'] = inputs['input_ids'][:max_length]
|
| 41 |
inputs['attention_mask'] = inputs['attention_mask'][:max_length]
|