Spaces:
Sleeping
Sleeping
fixing padding
Browse files
app.py
CHANGED
|
@@ -108,7 +108,7 @@ def generate_request_local(authority, kw1, kw2, kw3):
|
|
| 108 |
keywords = [kw for kw in [kw1, kw2, kw3] if kw]
|
| 109 |
keyword_string = ", ".join(keywords)
|
| 110 |
prompt = (
|
| 111 |
-
"You are an expert at writing formal Freedom of Information requests to UK public authorities.
|
| 112 |
f"""Generate a formal Freedom of Information request to {authority} using these keywords: {keyword_string}"""
|
| 113 |
)
|
| 114 |
|
|
@@ -118,13 +118,13 @@ def generate_request_local(authority, kw1, kw2, kw3):
|
|
| 118 |
|
| 119 |
# Set generation parameters
|
| 120 |
generation_params = {
|
| 121 |
-
"max_new_tokens":
|
| 122 |
"temperature": 0.3,
|
| 123 |
"top_p": 0.95,
|
| 124 |
"top_k": 50,
|
| 125 |
"repetition_penalty": 1.1,
|
| 126 |
"do_sample": True,
|
| 127 |
-
"
|
| 128 |
}
|
| 129 |
|
| 130 |
# Generate text sequences
|
|
|
|
| 108 |
keywords = [kw for kw in [kw1, kw2, kw3] if kw]
|
| 109 |
keyword_string = ", ".join(keywords)
|
| 110 |
prompt = (
|
| 111 |
+
"You are an expert at writing formal Freedom of Information requests to UK public authorities."
|
| 112 |
f"""Generate a formal Freedom of Information request to {authority} using these keywords: {keyword_string}"""
|
| 113 |
)
|
| 114 |
|
|
|
|
| 118 |
|
| 119 |
# Set generation parameters
|
| 120 |
generation_params = {
|
| 121 |
+
"max_new_tokens": 250,
|
| 122 |
"temperature": 0.3,
|
| 123 |
"top_p": 0.95,
|
| 124 |
"top_k": 50,
|
| 125 |
"repetition_penalty": 1.1,
|
| 126 |
"do_sample": True,
|
| 127 |
+
"eos_token_id": tokenizer.eos_token_id
|
| 128 |
}
|
| 129 |
|
| 130 |
# Generate text sequences
|