Upload 9 files
Browse files- Metal_gui_original_quotation_identification_BERT_infrence.py +308 -0
- quotation_identifer_model/checkpoint-1000/config.json +25 -0
- quotation_identifer_model/checkpoint-1000/optimizer.pt +3 -0
- quotation_identifer_model/checkpoint-1000/pytorch_model.bin +3 -0
- quotation_identifer_model/checkpoint-1000/rng_state.pth +3 -0
- quotation_identifer_model/checkpoint-1000/scheduler.pt +3 -0
- quotation_identifer_model/checkpoint-1000/trainer_state.json +0 -0
- quotation_identifer_model/checkpoint-1000/training_args.bin +3 -0
- sample_text.txt +67 -0
Metal_gui_original_quotation_identification_BERT_infrence.py
ADDED
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import re
|
3 |
+
import torch
|
4 |
+
import threading
|
5 |
+
from transformers import BertTokenizerFast, DistilBertTokenizer, DistilBertForSequenceClassification
|
6 |
+
from tqdm import tqdm
|
7 |
+
import tkinter as tk
|
8 |
+
from tkinter import filedialog, messagebox, scrolledtext, ttk
|
9 |
+
from tkinter.font import Font
|
10 |
+
|
11 |
+
# Check if Metal is available
|
12 |
+
device = torch.device('mps') if torch.backends.mps.is_available() else torch.device('cpu')
|
13 |
+
|
14 |
+
def replace_titles_and_abbreviations(text):
|
15 |
+
replacements = {
|
16 |
+
r"Mr\.": "<MR>", r"Ms\.": "<MS>", r"Mrs\.": "<MRS>", r"Dr\.": "<DR>",
|
17 |
+
r"Prof\.": "<PROF>", r"Rev\.": "<REV>", r"Gen\.": "<GEN>", r"Sen\.": "<SEN>",
|
18 |
+
r"Rep\.": "<REP>", r"Gov\.": "<GOV>", r"Lt\.": "<LT>", r"Sgt\.": "<SGT>",
|
19 |
+
r"Capt\.": "<CAPT>", r"Cmdr\.": "<CMDR>", r"Adm\.": "<ADM>", r"Maj\.": "<MAJ>",
|
20 |
+
r"Col\.": "<COL>", r"St\.": "<ST>", r"Co\.": "<CO>", r"Inc\.": "<INC>",
|
21 |
+
r"Corp\.": "<CORP>", r"Ltd\.": "<LTD>", r"Jr\.": "<JR>", r"Sr\.": "<SR>",
|
22 |
+
r"Ph\.D\.": "<PHD>", r"M\.D\.": "<MD>", r"B\.A\.": "<BA>", r"B\.S\.": "<BS>",
|
23 |
+
r"M\.A\.": "<MA>", r"M\.S\.": "<MS>", r"LL\.B\.": "<LLB>", r"LL\.M\.": "<LLM>",
|
24 |
+
r"J\.D\.": "<JD>", r"Esq\.": "<ESQ>",
|
25 |
+
}
|
26 |
+
for pattern, replacement in replacements.items():
|
27 |
+
text = re.sub(pattern, replacement, text)
|
28 |
+
return text
|
29 |
+
|
30 |
+
def revert_titles_and_abbreviations(text):
|
31 |
+
replacements = {
|
32 |
+
"<MR>": "Mr.", "<MS>": "Ms.", "<MRS>": "Mrs.", "<DR>": "Dr.",
|
33 |
+
"<PROF>": "Prof.", "<REV>": "Rev.", "<GEN>": "Gen.", "<SEN>": "Sen.",
|
34 |
+
"<REP>": "Rep.", "<GOV>": "Gov.", "<LT>": "Lt.", "<SGT>": "Sgt.",
|
35 |
+
"<CAPT>": "Capt.", "<CMDR>": "Cmdr.", "<ADM>": "Adm.", "<MAJ>": "Maj.",
|
36 |
+
"<COL>": "Col.", "<ST>": "St.", "<CO>": "Co.", "<INC>": "Inc.",
|
37 |
+
"<CORP>": "Corp.", "<LTD>": "Ltd.", "<JR>": "Jr.", "<SR>": "Sr.",
|
38 |
+
"<PHD>": "Ph.D.", "<MD>": "M.D.", "<BA>": "B.A.", "<BS>": "B.S.",
|
39 |
+
"<MA>": "M.A.", "<MS>": "M.S.", "<LLB>": "LL.B.", "<LLM>": "LL.M.",
|
40 |
+
"<JD>": "J.D.", "<ESQ>": "Esq.",
|
41 |
+
}
|
42 |
+
for placeholder, original in replacements.items():
|
43 |
+
text = re.sub(placeholder, original, text)
|
44 |
+
return text
|
45 |
+
|
46 |
+
def split_text_by_pauses(text):
|
47 |
+
text = replace_titles_and_abbreviations(text)
|
48 |
+
pattern = r'[.!,;?:]'
|
49 |
+
parts = [part.strip() for part in re.split(pattern, text) if part.strip()]
|
50 |
+
parts_with_punctuation = [
|
51 |
+
part + text[text.find(part) + len(part)]
|
52 |
+
if text.find(part) + len(part) < len(text) and text[text.find(part) + len(part)] in '.!,;?'
|
53 |
+
else part for part in parts
|
54 |
+
]
|
55 |
+
parts_with_punctuation = [revert_titles_and_abbreviations(part) for part in parts_with_punctuation]
|
56 |
+
return parts_with_punctuation
|
57 |
+
|
58 |
+
def Process_txt_into_BERT_quotes_input_dataframe(filepath):
|
59 |
+
tokenizer = BertTokenizerFast.from_pretrained('bert-base-uncased')
|
60 |
+
|
61 |
+
with open(filepath, 'r', encoding='utf-8') as file:
|
62 |
+
text = file.read()
|
63 |
+
|
64 |
+
sentences = split_text_by_pauses(text)
|
65 |
+
|
66 |
+
data = {
|
67 |
+
'Text': [],
|
68 |
+
'Context': [],
|
69 |
+
'Text start char': [],
|
70 |
+
'Text end char': [],
|
71 |
+
'Context start char': [],
|
72 |
+
'Context end char': [],
|
73 |
+
'Is Quote': [],
|
74 |
+
'Speaker': []
|
75 |
+
}
|
76 |
+
|
77 |
+
tokenized_text = tokenizer.tokenize(text)
|
78 |
+
encoded_text = tokenizer.encode_plus(text, add_special_tokens=False, return_offsets_mapping=True)
|
79 |
+
offsets = encoded_text['offset_mapping']
|
80 |
+
|
81 |
+
for sentence in sentences:
|
82 |
+
start_idx, end_idx = text.find(sentence), text.find(sentence) + len(sentence)
|
83 |
+
start_token_idx = next((i for i, offset in enumerate(offsets) if offset[0] == start_idx), None)
|
84 |
+
end_token_idx = next((i for i, offset in enumerate(offsets) if offset[1] == end_idx), None)
|
85 |
+
|
86 |
+
if start_token_idx is not None and end_token_idx is not None:
|
87 |
+
context_start_token_idx = max(0, start_token_idx - 200)
|
88 |
+
context_end_token_idx = min(len(tokenized_text), end_token_idx + 200)
|
89 |
+
|
90 |
+
context_start_char = offsets[context_start_token_idx][0]
|
91 |
+
context_end_char = offsets[min(context_end_token_idx, len(offsets) - 1)][1]
|
92 |
+
|
93 |
+
context = text[context_start_char:context_end_char]
|
94 |
+
|
95 |
+
data['Text'].append(sentence)
|
96 |
+
data['Context'].append(context)
|
97 |
+
data['Text start char'].append(start_idx)
|
98 |
+
data['Text end char'].append(end_idx)
|
99 |
+
data['Context start char'].append(context_start_char)
|
100 |
+
data['Context end char'].append(context_end_char)
|
101 |
+
data['Is Quote'].append('')
|
102 |
+
data['Speaker'].append('')
|
103 |
+
|
104 |
+
df = pd.DataFrame(data)
|
105 |
+
|
106 |
+
return df
|
107 |
+
|
108 |
+
def predict_quote(context, text, model_checkpoint_path="./quotation_identifer_model/checkpoint-1000"):
|
109 |
+
formatted_input = f"{context} : Is Sentence Quote : {text}"
|
110 |
+
|
111 |
+
model = DistilBertForSequenceClassification.from_pretrained(model_checkpoint_path).to(device)
|
112 |
+
tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased')
|
113 |
+
|
114 |
+
tokenized_input = tokenizer(formatted_input, padding="max_length", truncation=True, max_length=512, return_tensors="pt").to(device)
|
115 |
+
|
116 |
+
with torch.no_grad():
|
117 |
+
outputs = model(**tokenized_input)
|
118 |
+
|
119 |
+
predicted_label = torch.argmax(outputs.logits).item()
|
120 |
+
|
121 |
+
label_encoder = {0: "Not a Quote", 1: "Quote"}
|
122 |
+
|
123 |
+
return label_encoder[predicted_label] == "Quote"
|
124 |
+
|
125 |
+
def fill_is_quote_column(df, model_checkpoint_path="./quotation_identifer_model/checkpoint-1000"):
|
126 |
+
if 'Is Quote' not in df.columns:
|
127 |
+
df['Is Quote'] = None
|
128 |
+
|
129 |
+
tqdm.pandas(desc="Processing rows", unit="row")
|
130 |
+
|
131 |
+
for index, row in tqdm(df.iterrows(), total=len(df)):
|
132 |
+
context = row['Context']
|
133 |
+
text = row['Text']
|
134 |
+
df.at[index, 'Is Quote'] = predict_quote(context, text, model_checkpoint_path)
|
135 |
+
|
136 |
+
return df
|
137 |
+
|
138 |
+
def transfer_quotes(complete_df, incomplete_df):
|
139 |
+
for index, row in complete_df.iterrows():
|
140 |
+
is_quote = row['Is Quote']
|
141 |
+
if pd.notna(is_quote):
|
142 |
+
incomplete_df.at[index, 'Is Quote'] = is_quote
|
143 |
+
|
144 |
+
return incomplete_df
|
145 |
+
|
146 |
+
def visualize_quotes(df, is_dark_mode=False):
|
147 |
+
root = tk.Toplevel()
|
148 |
+
root.title("Text Visualization")
|
149 |
+
root.geometry("800x600")
|
150 |
+
|
151 |
+
style = ttk.Style(root)
|
152 |
+
style.theme_use('clam')
|
153 |
+
|
154 |
+
main_frame = ttk.Frame(root, padding="20")
|
155 |
+
main_frame.pack(fill=tk.BOTH, expand=True)
|
156 |
+
|
157 |
+
title_font = Font(family="Helvetica", size=24, weight="bold")
|
158 |
+
title_label = ttk.Label(main_frame, text="Quote Visualization (Identified quotes are highlighted in blue)", font=title_font)
|
159 |
+
title_label.pack(pady=(0, 20))
|
160 |
+
|
161 |
+
text_box = scrolledtext.ScrolledText(main_frame, width=80, height=30, wrap=tk.WORD, font=("Helvetica", 12))
|
162 |
+
text_box.pack(fill=tk.BOTH, expand=True)
|
163 |
+
|
164 |
+
def set_color_scheme(is_dark):
|
165 |
+
if is_dark:
|
166 |
+
style.configure("TFrame", background="#2c2c2c")
|
167 |
+
style.configure("TLabel", background="#2c2c2c", foreground="white")
|
168 |
+
text_box.config(bg="#2c2c2c", fg="white", insertbackground="white")
|
169 |
+
text_box.tag_configure('quote', background='#4a86e8', foreground='white')
|
170 |
+
root.configure(bg="#2c2c2c")
|
171 |
+
else:
|
172 |
+
style.configure("TFrame", background="#f0f0f0")
|
173 |
+
style.configure("TLabel", background="#f0f0f0", foreground="black")
|
174 |
+
text_box.config(bg="white", fg="black", insertbackground="black")
|
175 |
+
text_box.tag_configure('quote', background='#4a86e8', foreground='black')
|
176 |
+
root.configure(bg="#f0f0f0")
|
177 |
+
|
178 |
+
def highlight_text():
|
179 |
+
text_box.delete('1.0', tk.END)
|
180 |
+
for _, row in df.iterrows():
|
181 |
+
text = row['Text']
|
182 |
+
is_quote = row['Is Quote']
|
183 |
+
if is_quote:
|
184 |
+
text_box.insert(tk.END, text + "\n", 'quote')
|
185 |
+
else:
|
186 |
+
text_box.insert(tk.END, text + "\n")
|
187 |
+
|
188 |
+
set_color_scheme(is_dark_mode)
|
189 |
+
highlight_text()
|
190 |
+
|
191 |
+
root.mainloop()
|
192 |
+
|
193 |
+
class QuoteIdentifierApp:
|
194 |
+
def __init__(self, master):
|
195 |
+
self.master = master
|
196 |
+
self.master.title("Quote Identifier")
|
197 |
+
self.master.geometry("600x450")
|
198 |
+
self.master.resizable(False, False)
|
199 |
+
|
200 |
+
self.style = ttk.Style()
|
201 |
+
self.style.theme_use('clam')
|
202 |
+
|
203 |
+
self.is_dark_mode = False
|
204 |
+
self.create_widgets()
|
205 |
+
self.set_light_mode()
|
206 |
+
|
207 |
+
def create_widgets(self):
|
208 |
+
self.main_frame = ttk.Frame(self.master, padding="20")
|
209 |
+
self.main_frame.pack(fill=tk.BOTH, expand=True)
|
210 |
+
|
211 |
+
title_font = Font(family="Helvetica", size=24, weight="bold")
|
212 |
+
title_label = ttk.Label(self.main_frame, text="Quote Identifier", font=title_font)
|
213 |
+
title_label.pack(pady=(0, 20))
|
214 |
+
|
215 |
+
btn_frame = ttk.Frame(self.main_frame)
|
216 |
+
btn_frame.pack(fill=tk.X, pady=10)
|
217 |
+
|
218 |
+
self.open_file_btn = ttk.Button(btn_frame, text="Open Text File", command=self.open_file, style="AccentButton.TButton")
|
219 |
+
self.open_file_btn.pack(side=tk.LEFT, padx=(0, 10))
|
220 |
+
|
221 |
+
self.identify_quotes_btn = ttk.Button(btn_frame, text="Run Identify Quotes", command=self.identify_quotes, style="AccentButton.TButton")
|
222 |
+
self.identify_quotes_btn.pack(side=tk.LEFT)
|
223 |
+
|
224 |
+
self.dark_mode_btn = ttk.Button(self.main_frame, text="Toggle Dark Mode", command=self.toggle_dark_mode, style="TButton")
|
225 |
+
self.dark_mode_btn.pack(pady=10)
|
226 |
+
|
227 |
+
self.status_label = ttk.Label(self.main_frame, text="Ready", font=("Helvetica", 12))
|
228 |
+
self.status_label.pack(pady=10)
|
229 |
+
|
230 |
+
self.progress_bar = ttk.Progressbar(self.main_frame, orient=tk.HORIZONTAL, length=300, mode='determinate')
|
231 |
+
self.progress_bar.pack(pady=10)
|
232 |
+
|
233 |
+
def set_light_mode(self):
|
234 |
+
self.style.configure("TFrame", background="#f0f0f0")
|
235 |
+
self.style.configure("TButton", background="#e0e0e0", foreground="black")
|
236 |
+
self.style.configure("AccentButton.TButton", background="#4a86e8", foreground="white")
|
237 |
+
self.style.configure("TLabel", background="#f0f0f0", foreground="black")
|
238 |
+
self.master.configure(bg="#f0f0f0")
|
239 |
+
self.is_dark_mode = False
|
240 |
+
|
241 |
+
def set_dark_mode(self):
|
242 |
+
self.style.configure("TFrame", background="#2c2c2c")
|
243 |
+
self.style.configure("TButton", background="#3c3c3c", foreground="white")
|
244 |
+
self.style.configure("AccentButton.TButton", background="#4a86e8", foreground="white")
|
245 |
+
self.style.configure("TLabel", background="#2c2c2c", foreground="white")
|
246 |
+
self.master.configure(bg="#2c2c2c")
|
247 |
+
self.is_dark_mode = True
|
248 |
+
|
249 |
+
def toggle_dark_mode(self):
|
250 |
+
if self.is_dark_mode:
|
251 |
+
self.set_light_mode()
|
252 |
+
else:
|
253 |
+
self.set_dark_mode()
|
254 |
+
|
255 |
+
def open_file(self):
|
256 |
+
filepath = filedialog.askopenfilename(filetypes=[("Text files", "*.txt")])
|
257 |
+
if filepath:
|
258 |
+
self.status_label.config(text=f"File selected: {filepath}")
|
259 |
+
self.filepath = filepath
|
260 |
+
else:
|
261 |
+
self.status_label.config(text="No file selected")
|
262 |
+
|
263 |
+
def identify_quotes(self):
|
264 |
+
if hasattr(self, 'filepath'):
|
265 |
+
self.status_label.config(text="Processing... Please wait.")
|
266 |
+
self.progress_bar['value'] = 0
|
267 |
+
self.master.update()
|
268 |
+
|
269 |
+
def process_quotes():
|
270 |
+
df = Process_txt_into_BERT_quotes_input_dataframe(self.filepath)
|
271 |
+
df = self.fill_is_quote_column_with_progress(df)
|
272 |
+
self.master.after(0, lambda: self.finish_processing(df))
|
273 |
+
|
274 |
+
threading.Thread(target=process_quotes, daemon=True).start()
|
275 |
+
else:
|
276 |
+
messagebox.showwarning("No File Selected", "Please select a text file first.")
|
277 |
+
|
278 |
+
def fill_is_quote_column_with_progress(self, df):
|
279 |
+
if 'Is Quote' not in df.columns:
|
280 |
+
df['Is Quote'] = None
|
281 |
+
|
282 |
+
total_rows = len(df)
|
283 |
+
for index, row in enumerate(tqdm(df.iterrows(), total=total_rows, desc="Processing rows", unit="row")):
|
284 |
+
context = row[1]['Context']
|
285 |
+
text = row[1]['Text']
|
286 |
+
df.at[index, 'Is Quote'] = predict_quote(context, text)
|
287 |
+
|
288 |
+
progress = (index + 1) / total_rows * 100
|
289 |
+
self.master.after(0, lambda p=progress: self.update_progress(p))
|
290 |
+
|
291 |
+
return df
|
292 |
+
|
293 |
+
def update_progress(self, value):
|
294 |
+
self.progress_bar['value'] = value
|
295 |
+
self.master.update_idletasks()
|
296 |
+
|
297 |
+
def finish_processing(self, df):
|
298 |
+
self.progress_bar['value'] = 100
|
299 |
+
self.status_label.config(text="Quote identification complete!")
|
300 |
+
visualize_quotes(df, self.is_dark_mode)
|
301 |
+
|
302 |
+
def create_gui():
|
303 |
+
root = tk.Tk()
|
304 |
+
app = QuoteIdentifierApp(root)
|
305 |
+
root.mainloop()
|
306 |
+
|
307 |
+
if __name__ == "__main__":
|
308 |
+
create_gui()
|
quotation_identifer_model/checkpoint-1000/config.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "distilbert-base-uncased",
|
3 |
+
"activation": "gelu",
|
4 |
+
"architectures": [
|
5 |
+
"DistilBertForSequenceClassification"
|
6 |
+
],
|
7 |
+
"attention_dropout": 0.1,
|
8 |
+
"dim": 768,
|
9 |
+
"dropout": 0.1,
|
10 |
+
"hidden_dim": 3072,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"max_position_embeddings": 512,
|
13 |
+
"model_type": "distilbert",
|
14 |
+
"n_heads": 12,
|
15 |
+
"n_layers": 6,
|
16 |
+
"pad_token_id": 0,
|
17 |
+
"problem_type": "single_label_classification",
|
18 |
+
"qa_dropout": 0.1,
|
19 |
+
"seq_classif_dropout": 0.2,
|
20 |
+
"sinusoidal_pos_embds": false,
|
21 |
+
"tie_weights_": true,
|
22 |
+
"torch_dtype": "float32",
|
23 |
+
"transformers_version": "4.30.0",
|
24 |
+
"vocab_size": 30522
|
25 |
+
}
|
quotation_identifer_model/checkpoint-1000/optimizer.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e21aed7c35cfefa93118971a420fe14893d95736dac398704f7633168ca47c78
|
3 |
+
size 535701498
|
quotation_identifer_model/checkpoint-1000/pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9ae8c959e1d9422d571f25beb32f051c1598a120595f2cc561ad9fc73c38e703
|
3 |
+
size 267855978
|
quotation_identifer_model/checkpoint-1000/rng_state.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5317a2fc18eacc03c223a72064f1c14c21c19dc84f0c2d0a7daeb726d218ba3e
|
3 |
+
size 14244
|
quotation_identifer_model/checkpoint-1000/scheduler.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:241f68f21f4f92d7d38b9008513df0dfc6d00224a7e125958cd1bf69975fb379
|
3 |
+
size 1064
|
quotation_identifer_model/checkpoint-1000/trainer_state.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
quotation_identifer_model/checkpoint-1000/training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b6183a921f240b660c30bb64732af34d3523f7d3cce7f8be9dd27ab5b2e1c4f6
|
3 |
+
size 4280
|
sample_text.txt
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
In the heart of Everwood, a quaint village nestled deep within an enchanted forest, magic was a part of everyday life. The village's most extraordinary residents, though, were the students of Everwood Academy for Magical Arts.
|
2 |
+
|
3 |
+
One crisp autumn morning, young Eliza Thorne and her best friend, Milo Garrison, strolled through the cobblestone streets of the village. Eliza, with her bushy brown hair and curious eyes, was always brimming with questions. Milo, a tall boy with tousled blonde hair and an air of mischief, was more interested in adventure.
|
4 |
+
|
5 |
+
"Eliza, do you think Professor Merriwether really knows where the Enchanted Amulet is hidden?" Milo asked, his eyes twinkling with excitement.
|
6 |
+
|
7 |
+
Eliza adjusted her glasses and replied thoughtfully, "Professor Merriwether mentioned it in passing during last week's Transfiguration class. She seemed quite... mysterious about it."
|
8 |
+
|
9 |
+
"That's what makes it so intriguing," Milo said with a grin. "Imagine if we could find it before anyone else!"
|
10 |
+
|
11 |
+
As they reached the cobbled square, their friend, Fiona Bright, joined them. Fiona was known for her fiery red hair and quick wit. She waved enthusiastically.
|
12 |
+
|
13 |
+
"Morning, you two!" Fiona called out. "I overheard the most fascinating rumor at breakfast. Apparently, the Enchanted Amulet can grant a single wish."
|
14 |
+
|
15 |
+
Eliza's eyes widened. "A wish? That sounds incredible! But it must be protected by powerful magic."
|
16 |
+
|
17 |
+
Just then, a familiar figure approached: Professor Merriwether herself, a tall woman with silver hair that shimmered like moonlight. She had a knowing smile on her face.
|
18 |
+
|
19 |
+
"Good morning, students," Professor Merriwether greeted them warmly. "I see you're in high spirits today."
|
20 |
+
|
21 |
+
"Professor Merriwether!" Milo said, barely containing his excitement. "We were just talking about the Enchanted Amulet. Do you think it’s really hidden somewhere in Everwood?"
|
22 |
+
|
23 |
+
Professor Merriwether’s eyes sparkled with amusement. "Ah, the Enchanted Amulet. It’s a legend many have sought after, but few have found. What makes you so interested?"
|
24 |
+
|
25 |
+
Eliza took a deep breath. "We heard it can grant a wish, and we were wondering if we might try to find it."
|
26 |
+
|
27 |
+
Professor Merriwether chuckled softly. "The amulet does indeed hold great power, but it’s not something to be taken lightly. It requires both wisdom and courage to seek it out. Remember, not all wishes are as straightforward as they seem."
|
28 |
+
|
29 |
+
Fiona’s face lit up. "We’re ready for any challenge! Where should we start?"
|
30 |
+
|
31 |
+
Professor Merriwether paused, considering. "Very well. There is an old map in the library that might help you. But be cautious—it has a mind of its own and is known to test those who seek the amulet."
|
32 |
+
|
33 |
+
The trio exchanged excited glances and hurried to the academy’s grand library. Rows of towering bookshelves and ancient tomes surrounded them. They found the map tucked away in a dusty, leather-bound book.
|
34 |
+
|
35 |
+
Eliza spread the map across a table. "It looks like it leads to the Whispering Woods."
|
36 |
+
|
37 |
+
Milo frowned. "I’ve heard those woods are haunted by mischievous sprites."
|
38 |
+
|
39 |
+
Fiona nodded, her eyes gleaming with determination. "Then we’d better be prepared."
|
40 |
+
|
41 |
+
As they ventured into the Whispering Woods, the air grew thick with magic. The trees seemed to whisper secrets, and shadows danced at the edges of their vision. Suddenly, a group of tiny, glowing sprites appeared, blocking their path.
|
42 |
+
|
43 |
+
"To pass, you must answer our riddles," the sprites chimed in unison.
|
44 |
+
|
45 |
+
Milo stepped forward. "We’re ready. What’s your first riddle?"
|
46 |
+
|
47 |
+
One of the sprites fluttered closer and asked, "I have cities, but no houses. I have mountains, but no trees. I have water, but no fish. What am I?"
|
48 |
+
|
49 |
+
Eliza’s eyes lit up. "A map!"
|
50 |
+
|
51 |
+
The sprites giggled and parted, allowing them to continue. They faced more riddles and magical challenges, each one testing their resolve and teamwork.
|
52 |
+
|
53 |
+
Finally, after what seemed like hours, they arrived at a hidden glen where the Enchanted Amulet rested upon an ancient pedestal. The amulet glowed with a soft, inviting light.
|
54 |
+
|
55 |
+
Eliza hesitated. "Remember what Professor Merriwether said about wishes."
|
56 |
+
|
57 |
+
Milo nodded. "Let’s make sure our wish is for something that truly matters."
|
58 |
+
|
59 |
+
Fiona placed her hand on the amulet and spoke softly. "We wish for the wisdom and courage to always do what’s right."
|
60 |
+
|
61 |
+
The amulet’s glow intensified, and a warm, gentle breeze enveloped them. They felt a deep sense of fulfillment and clarity.
|
62 |
+
|
63 |
+
As they made their way back to Everwood, Professor Merriwether awaited them with a proud smile.
|
64 |
+
|
65 |
+
"You have learned much today," she said. "The true magic lies not in the wish itself, but in the journey and the choices you make along the way."
|
66 |
+
|
67 |
+
The trio smiled, their hearts full of newfound wisdom and friendship. They knew that whatever adventures lay ahead, they would face them together, guided by the lessons they had learned.
|