|
|
import tensorflow as tf
|
|
|
import sentencepiece as spm
|
|
|
import json
|
|
|
import os
|
|
|
import numpy as np
|
|
|
import os
|
|
|
import json
|
|
|
import random
|
|
|
import re
|
|
|
import tensorflow as tf
|
|
|
import sentencepiece as spm
|
|
|
import matplotlib.pyplot as plt
|
|
|
from tqdm import tqdm
|
|
|
from tensorflow import keras
|
|
|
from tensorflow.keras import layers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DATA_DIR = "output4"
|
|
|
SPM_MODEL = "icefire_spm.model"
|
|
|
CHECKPOINT_PATH = "got_qa_transformer.keras"
|
|
|
BATCH_SIZE = 150
|
|
|
EPOCHS = 20
|
|
|
VAL_SPLIT = 0.05
|
|
|
MAX_QUESTION_WORDS = 25
|
|
|
MAX_ANSWER_WORDS = 60
|
|
|
SEQ_LEN_EN = 30
|
|
|
SEQ_LEN_TE = 64
|
|
|
VOCAB_SIZE = 30_000
|
|
|
EMBED_DIM = 256
|
|
|
DENSE_DIM = 512
|
|
|
NUM_HEADS = 8
|
|
|
NUM_LAYERS_ENC = 1
|
|
|
NUM_LAYERS_DEC = 1
|
|
|
sp = spm.SentencePieceProcessor(model_file=SPM_MODEL)
|
|
|
START_ID = sp.bos_id()
|
|
|
END_ID = sp.eos_id()
|
|
|
print(f"Using <bos>={START_ID}, <eos>={END_ID}")
|
|
|
|
|
|
class PositionalEmbedding(layers.Layer):
|
|
|
def __init__(self, seq_len, vocab_size, embed_dim, **kwargs):
|
|
|
super().__init__(**kwargs)
|
|
|
self.token_emb = layers.Embedding(vocab_size, embed_dim)
|
|
|
|
|
|
self.pos_emb = layers.Embedding(seq_len, embed_dim)
|
|
|
self.seq_len = seq_len
|
|
|
|
|
|
def call(self, x):
|
|
|
length = tf.shape(x)[-1]
|
|
|
|
|
|
positions = tf.range(start=0, limit=length, delta=1)
|
|
|
return self.token_emb(x) + self.pos_emb(positions)
|
|
|
|
|
|
|
|
|
def get_config(self):
|
|
|
cfg = super().get_config()
|
|
|
cfg.update({"seq_len": self.seq_len, "vocab_size": VOCAB_SIZE, "embed_dim": EMBED_DIM})
|
|
|
return cfg
|
|
|
|
|
|
class TransformerEncoder(layers.Layer):
|
|
|
def __init__(self, embed_dim, dense_dim, num_heads, **kwargs):
|
|
|
super().__init__(**kwargs)
|
|
|
self.attn = layers.MultiHeadAttention(num_heads, embed_dim)
|
|
|
self.ffn = keras.Sequential([layers.Dense(dense_dim, activation="relu"), layers.Dense(embed_dim)])
|
|
|
self.ln1 = layers.LayerNormalization()
|
|
|
self.ln2 = layers.LayerNormalization()
|
|
|
|
|
|
def call(self, x, mask=None):
|
|
|
if mask is not None: mask = mask[:, tf.newaxis, :]
|
|
|
attn = self.attn(x, x, attention_mask=mask)
|
|
|
x = self.ln1(x + attn)
|
|
|
ffn = self.ffn(x)
|
|
|
return self.ln2(x + ffn)
|
|
|
|
|
|
def get_config(self):
|
|
|
cfg = super().get_config()
|
|
|
cfg.update({"embed_dim": EMBED_DIM, "dense_dim": DENSE_DIM, "num_heads": NUM_HEADS})
|
|
|
return cfg
|
|
|
|
|
|
class TransformerDecoder(layers.Layer):
|
|
|
def __init__(self, embed_dim, dense_dim, num_heads, **kwargs):
|
|
|
super().__init__(**kwargs)
|
|
|
self.self_attn = layers.MultiHeadAttention(num_heads, embed_dim)
|
|
|
self.cross_attn = layers.MultiHeadAttention(num_heads, embed_dim)
|
|
|
self.ffn = keras.Sequential([layers.Dense(dense_dim, activation="relu"), layers.Dense(embed_dim)])
|
|
|
self.ln1 = layers.LayerNormalization()
|
|
|
self.ln2 = layers.LayerNormalization()
|
|
|
self.ln3 = layers.LayerNormalization()
|
|
|
|
|
|
def get_causal_mask(self, x):
|
|
|
seq_len = tf.shape(x)[1]
|
|
|
mask = tf.linalg.band_part(tf.ones((seq_len, seq_len)), -1, 0)
|
|
|
return tf.cast(mask, tf.int32)[tf.newaxis, ...]
|
|
|
|
|
|
def call(self, x, enc_out, mask=None):
|
|
|
causal_mask = self.get_causal_mask(x)
|
|
|
attn1 = self.self_attn(x, x, attention_mask=causal_mask)
|
|
|
x = self.ln1(x + attn1)
|
|
|
padding_mask = mask[:, tf.newaxis, :] if mask is not None else None
|
|
|
attn2 = self.cross_attn(x, enc_out, enc_out, attention_mask=padding_mask)
|
|
|
x = self.ln2(x + attn2)
|
|
|
ffn = self.ffn(x)
|
|
|
return self.ln3(x + ffn)
|
|
|
|
|
|
def get_config(self):
|
|
|
cfg = super().get_config()
|
|
|
cfg.update({"embed_dim": EMBED_DIM, "dense_dim": DENSE_DIM, "num_heads": NUM_HEADS})
|
|
|
return cfg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEC_INPUT_LEN = SEQ_LEN_TE - 1
|
|
|
|
|
|
def build_model():
|
|
|
|
|
|
enc_in = keras.Input(shape=(SEQ_LEN_EN,), dtype="int64", name="encoder_inputs")
|
|
|
|
|
|
|
|
|
dec_in = keras.Input(shape=(DEC_INPUT_LEN,), dtype="int64", name="decoder_inputs")
|
|
|
|
|
|
|
|
|
|
|
|
enc_emb = PositionalEmbedding(SEQ_LEN_EN, VOCAB_SIZE, EMBED_DIM)(enc_in)
|
|
|
x = enc_emb
|
|
|
for _ in range(NUM_LAYERS_ENC):
|
|
|
x = TransformerEncoder(EMBED_DIM, DENSE_DIM, NUM_HEADS)(x)
|
|
|
enc_out = x
|
|
|
|
|
|
|
|
|
|
|
|
dec_emb = PositionalEmbedding(DEC_INPUT_LEN, VOCAB_SIZE, EMBED_DIM)(dec_in)
|
|
|
x = dec_emb
|
|
|
for _ in range(NUM_LAYERS_DEC):
|
|
|
|
|
|
x = TransformerDecoder(EMBED_DIM, DENSE_DIM, NUM_HEADS)(x, enc_out)
|
|
|
|
|
|
|
|
|
logits = layers.Dense(VOCAB_SIZE)(x)
|
|
|
|
|
|
model = keras.Model([enc_in, dec_in], logits)
|
|
|
return model
|
|
|
|
|
|
|
|
|
|
|
|
def masked_loss(y_true, y_pred):
|
|
|
loss_fn = keras.losses.SparseCategoricalCrossentropy(from_logits=True, reduction='none')
|
|
|
loss = loss_fn(y_true, y_pred)
|
|
|
mask = tf.cast(tf.not_equal(y_true, 0), loss.dtype)
|
|
|
return tf.reduce_sum(loss * mask) / tf.reduce_sum(mask)
|
|
|
|
|
|
def masked_accuracy(y_true, y_pred):
|
|
|
y_pred = tf.argmax(y_pred, axis=-1, output_type=y_true.dtype)
|
|
|
matches = tf.cast(tf.equal(y_true, y_pred), tf.float32)
|
|
|
mask = tf.cast(tf.not_equal(y_true, 0), tf.float32)
|
|
|
return tf.reduce_sum(matches * mask) / tf.reduce_sum(mask)
|
|
|
|
|
|
|
|
|
|
|
|
with open("tokenizer_info.json") as f:
|
|
|
info = json.load(f)
|
|
|
|
|
|
SPM_MODEL = info["spm_model"]
|
|
|
START_ID = info["start_id"]
|
|
|
END_ID = info["end_id"]
|
|
|
SEQ_LEN_EN = info["seq_len_en"]
|
|
|
SEQ_LEN_TE = info["seq_len_te"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sp = spm.SentencePieceProcessor(model_file=SPM_MODEL)
|
|
|
model = keras.models.load_model(CHECKPOINT_PATH, custom_objects={
|
|
|
"PositionalEmbedding": PositionalEmbedding,
|
|
|
"TransformerEncoder": TransformerEncoder,
|
|
|
"TransformerDecoder": TransformerDecoder,
|
|
|
"masked_loss": masked_loss,
|
|
|
"masked_accuracy": masked_accuracy
|
|
|
})
|
|
|
def predict_step(src, tgt):
|
|
|
return model([src, tgt], training=False)
|
|
|
DEC_INPUT_LEN = SEQ_LEN_TE - 1
|
|
|
def tokenize_question(question):
|
|
|
ids = sp.encode(question, out_type=int)
|
|
|
if len(ids) < SEQ_LEN_EN:
|
|
|
ids = ids + [0] * (SEQ_LEN_EN - len(ids))
|
|
|
else:
|
|
|
ids = ids[:SEQ_LEN_EN]
|
|
|
return np.array([ids], dtype=np.int64)
|
|
|
def decode_sequence(question, max_len=60):
|
|
|
src_np = tokenize_question(question)
|
|
|
src = tf.constant(src_np, dtype=tf.int64)
|
|
|
|
|
|
|
|
|
tgt = tf.constant([[START_ID]], dtype=tf.int64)
|
|
|
|
|
|
for _ in range(max_len):
|
|
|
|
|
|
cur_len = int(tf.shape(tgt)[1].numpy())
|
|
|
|
|
|
pad_len = DEC_INPUT_LEN - cur_len
|
|
|
if pad_len < 0:
|
|
|
|
|
|
tgt_for_model = tgt[:, -DEC_INPUT_LEN:]
|
|
|
effective_pos = DEC_INPUT_LEN - 1
|
|
|
else:
|
|
|
|
|
|
paddings = [[0, 0], [0, pad_len]]
|
|
|
tgt_for_model = tf.pad(tgt, paddings, constant_values=0)
|
|
|
effective_pos = cur_len - 1
|
|
|
|
|
|
|
|
|
logits = predict_step(src, tgt_for_model)
|
|
|
|
|
|
|
|
|
next_logits = logits[:, effective_pos, :]
|
|
|
next_id = tf.argmax(next_logits, axis=-1, output_type=tf.int64)
|
|
|
|
|
|
|
|
|
next_id = tf.expand_dims(next_id, axis=-1)
|
|
|
tgt = tf.concat([tgt, next_id], axis=-1)
|
|
|
|
|
|
|
|
|
if int(next_id.numpy()[0][0]) == END_ID:
|
|
|
break
|
|
|
|
|
|
|
|
|
ids = tgt[0].numpy()
|
|
|
ids = ids[1:]
|
|
|
if END_ID in ids:
|
|
|
ids = ids[:np.where(ids == END_ID)[0][0]]
|
|
|
return sp.decode(ids.tolist())
|
|
|
|
|
|
|
|
|
|
|
|
questions = """who is the father of tyrion lannister,
|
|
|
who killed robert baratheon,
|
|
|
who is the mother of jon snow,
|
|
|
who betrayed ned stark,
|
|
|
who is the king beyond the wall,
|
|
|
who trained arya stark in braavos,
|
|
|
who poisoned joffrey baratheon,
|
|
|
who burned the sept of baelor,
|
|
|
who killed ramsay bolton,
|
|
|
who created the white walkers,
|
|
|
who is known as the kingslayer,
|
|
|
who leads the dothraki horde,
|
|
|
who is the three eyed raven,
|
|
|
who killed the night king,
|
|
|
who commanded the unsullied army
|
|
|
What does Robb's army do at the Green Fork of the Trident?
|
|
|
Who plays Maester Aemon in season 5?
|
|
|
What is 'General Electric' related to in this text?
|
|
|
Where did the line 'I brought us' appear?
|
|
|
What is House Bracken? (Part 19)
|
|
|
Who is Tyana Wylde?
|
|
|
What was the political outcome of the "Battle of the Kingsroad"?
|
|
|
What is "Log in"?
|
|
|
What is the Dothraki language?
|
|
|
Which house holds Tyshara Lannister?
|
|
|
What is the relationship between NAIL and HAMMER?
|
|
|
What was Charles Dance's role in the TV film 'Trial & Retribution'?
|
|
|
What is "The Bellingham Herald"?
|
|
|
How many major awards did The Dick Van Dyke Show win at the 18th Primetime Emmy Awards?
|
|
|
Where did the line 'I imagine you're right.' appear?
|
|
|
What is stated in the section A Game of Thrones about Lyanna Stark? (Part 1)
|
|
|
What is the relationship between CERSEI LANNISTER and King Robert I Baratheon?
|
|
|
What is the scientific name for the brittle star belonging to the family Ophiocamacidae?
|
|
|
What are the fantasy subgenres that are characterized by their focus on magical girls or similar protagonists?
|
|
|
What is the "40th Daytime Creative Arts Emmy Awards"?
|
|
|
What were the titles of the Polish editions of 'A Feast for Crows'?
|
|
|
What is stated in the section Birth about Years after Aegon's Conquest/Calculations Ages (Continued2)? (Part 473)
|
|
|
What is A Game of Thrones-Chapter 19? (Part 2)
|
|
|
When was House Harlaw of the Tower of Glimmering founded?
|
|
|
What does 'Print/export' offer?
|
|
|
What passage is cited by 'A Clash of Kings, Theon I, pp. 172û173'?
|
|
|
Who is the spouse of Hosman Norcross?
|
|
|
Where did the line 'while the rest of you played.' appear?
|
|
|
What is stated in the section Character about Myles Mooton?
|
|
|
What is the relationship between BALON GREYJOY and GOODBROTHER?
|
|
|
What are the words of House Uller of Hellholt?
|
|
|
Why did George R. R. Martin not make complete world maps available early on?
|
|
|
What is the meaning of "Nonbelief" in the context of "Religious unbelief"?
|
|
|
What is the significance of '5th_International_Emmy_Awards'?
|
|
|
Who played Frances in season 6?
|
|
|
Where did the line 'we'll get there before the dead.' appear?
|
|
|
What is Jon Pox? (Part 1)
|
|
|
What is the relationship between House Martell and Princess Elia?
|
|
|
What are the seats of House Stark of Winterfell?
|
|
|
What is the time usage for the 'Family_tree_of_Tytos_Lannister' template?
|
|
|
What is the "House of Black and White"?
|
|
|
Which actor won Outstanding Lead Actor in a Comedy Series?
|
|
|
What is the gender of Hallyne?
|
|
|
What items did Tyrion regain possession of thanks to Catelyn Stark's intervention?
|
|
|
What is stated in the section Birth about Years after Aegon's Conquest/Calculations Ages? (Part 349)
|
|
|
What is Harbert Paege? (Part 4)
|
|
|
What is the relationship between ALESANDER and SYMOND?
|
|
|
What is the purpose of the flaps on a dust jacket?
|
|
|
What is Fantasmas (TV series)?
|
|
|
What is the "Iron Throne"?
|
|
|
Which song was performed by Flight of the Conchords from "Unnatural Love"?
|
|
|
In which TV series seasons does Nail appear?
|
|
|
I see no lord. Only a dog dressed in chickenboneswho rattles when he rides.
|
|
|
What is described in the House Jast during the Books[] section in House_Jast?
|
|
|
What is Lysa Arryn? (Part 14)
|
|
|
What is stated in the section References and Notes about A Storm of Swords-Chapter 73? (Part 1)
|
|
|
Who is DELENA FLORENT?
|
|
|
How did Ned Stark's execution affect the Stark children?
|
|
|
What was the reason for splitting A Feast for Crows and A Dance with Dragons into two volumes?
|
|
|
What is the 'Choice Awards 2018'?
|
|
|
What is the "63rd Primetime Emmy Awards"?
|
|
|
What are the titles held by Sylas?
|
|
|
What did Jaime remind Ser Boros Blount of regarding Tommen's safety?
|
|
|
Where did the line 'that even dragons burned in flight.' appear?
|
|
|
What is Peach? (Part 5)
|
|
|
What is the Conflict of First Battle of Tumbleton?
|
|
|
What is stated in the section Chapter 3: Mors II about List of characters created for the Cyanide game? (Part 7)
|
|
|
Who is SER DAVEN?
|
|
|
When is "The Winds of Winter" expected to be released?
|
|
|
What is the title of the first book in the A Song of Ice and Fire series?
|
|
|
What happened to Storm's End during the War of the Usurper?
|
|
|
What happened to Wyman Manderly's heir, Ser Wylis?
|
|
|
What is the purpose of the 'Navbox' template?
|
|
|
Who is Cragorn and where is he at the beginning of the text?
|
|
|
What was the overall approval rating for Game of Thrones season 5 on Rotten Tomatoes?
|
|
|
What is the Lannister sigil and words?
|
|
|
Where did the line 'in Maester Aemon's library.' appear?
|
|
|
What is Years after Aegon's Conquest/Calculations Ages (Continued)? (Part 169)
|
|
|
What is mentioned in the history of Rosamund Ball?
|
|
|
What is stated in the section The Queen's protectors about House Targaryen? (Part 7)
|
|
|
What is Doreah? (Part 2)
|
|
|
What is stated in the section Episode 6: A Golden Crown about List of characters created forGame of Thrones? (Part 1133)
|
|
|
What is the relationship between CASS and TANSY?
|
|
|
Who is MAESTER OMER?
|
|
|
Which actresses have 4 nominations?
|
|
|
How are the Shadow Men described?
|
|
|
What is Oldtown associated with?
|
|
|
What is Slaver's Bay?
|
|
|
What is 'Merman'?
|
|
|
Who are some notable servants and vassals of House Targaryen?
|
|
|
What is 'Anthrax_(American_band)'?
|
|
|
What is the significance of the 'Triple Crown of Acting'?
|
|
|
Who is Jay Sandrich?
|
|
|
Who captures Brienne, Podrick, and Hyle, and why are they threatened?
|
|
|
What is the gender of Palla?
|
|
|
What is the significance of the 'jhat'?
|
|
|
What was Euron Crows Eye doing across the world?
|
|
|
What is the final verse of 'The Dornishman's Wife' as sung in the tent?
|
|
|
Where did the line 'I defended the city' appear?
|
|
|
Where did the line 'They'd pass wildling villages.' appear?
|
|
|
Where did the line 'I like her pretty.' appear?
|
|
|
What happened to the æJaqen = Syrio ForelÆ mask theory?
|
|
|
What is stated in the section Character about Willam Dustin? (Part 1)
|
|
|
What is Sphinx? (Part 14)
|
|
|
What is the Notable places of New Castle?
|
|
|
What is Landing of the Golden Company? (Part 3)
|
|
|
What is stated in the section House Keath at the end of the third century about House Keath? (Part 1)
|
|
|
What is stated in the section A Clash of Kings about Greywater Watch? (Part 2)
|
|
|
What is stated in the section A Game of Thrones about Doreah? (Part 6)
|
|
|
What is Category:Images by Zach Graves? (Part 1)
|
|
|
What is A Game of Thrones-Chapter 21? (Part 5)
|
|
|
What is the Location of Ashford?
|
|
|
What is Category:Dromonds?
|
|
|
What is the Page of A Clash of Kings-Chapter 35?
|
|
|
What is mentioned in the history of Allard Royce? (Part 2)
|
|
|
What is the relationship between MELLARIO and PRINCESS ARIANNE?
|
|
|
What is the relationship between MORYA and Lord Walder Frey?
|
|
|
What is the relationship between HARWIN and Hullen?
|
|
|
What is the relationship between SER DAMION LANNISTER and TYWIN LANNISTER?
|
|
|
What is the relationship between TYWIN LANNISTER and SER DAMION LANNISTER?
|
|
|
What is the relationship between Steffon Seaworth and Davos Seaworth?
|
|
|
What is the relationship between Unspecified Patriarch and SER EMMON?
|
|
|
What is the relationship between JON SNOW and GHOST?
|
|
|
What is the relationship between Lord and ùMaceÆs household at Highgarden?
|
|
|
What is the relationship between EDRIC STORM and GERALD GOWER?
|
|
|
What is the relationship between King Balon Greyjoy and MAESTER WENDAMYR?
|
|
|
What is the relationship between LADY MARGOT and Lord Titus Peake?
|
|
|
What is the relationship between Grey King and House Greyjoy?
|
|
|
What is the relationship between LORD TITUS PEAKE and Lady Margot?
|
|
|
What is the relationship between King Balon Greyjoy and DAGMER called CLEFTJAW?
|
|
|
What is the relationship between Aegon the Conquerer and Lord Edmyn Tully?
|
|
|
What is the relationship between THEON GREYJOY and WEX?
|
|
|
What is stated in the section Appearance and Character about Aerea Targaryen? (Part 4)
|
|
|
What is stated in the section Synopsis about A Clash of Kings-Chapter 11? (Part 2)
|
|
|
What is the Place of A Storm of Swords-Chapter 17?
|
|
|
What is stated in the section The Princess and the Queen about Errata of history novellas? (Part 4)
|
|
|
What is stated in the section A Dance with DragonsAppendix about Errata of main series? (Part 8)
|
|
|
What is stated in the section A Dance with Dragons about Holy Refuge?
|
|
|
What is Hugh Hammer? (Part 6)
|
|
|
What is stated in the section Rivers in Essos about List of rivers? (Part 6)
|
|
|
What is stated in the section A Clash of Kings about Marriage? (Part 2)
|
|
|
What is stated in the section A Dance with Dragons about Nymella Toland?
|
|
|
What is stated in the section A Dance with Dragons about Tattered Prince? (Part 2)
|
|
|
What are references in First_Men?
|
|
|
Where did the line 'What are our words?' appear?
|
|
|
Where did the line 'but I don't want to see' appear?
|
|
|
Where did the line 'I'm not kissing your fucking hand.' appear?
|
|
|
Where did the line 'I killed my lover' appear?
|
|
|
Where did the line 'But you have many miles to go.' appear?
|
|
|
Where did the line 'Who was the first?' appear?
|
|
|
How did Sansa explain her father's statement that Joffrey was not the king?
|
|
|
"You would execute your own son?"
|
|
|
What question did Xaro Xhoan Daxos ask after Daenerys freed him?
|
|
|
What are the aliases of Dudley?
|
|
|
How did Garth VII deal with the alliance between the Storm King and the King of the Rock?
|
|
|
What was the 'Best Variety Show' winner?
|
|
|
When did Game of Thrones Season 7 get its premiere date on HBO?
|
|
|
What is the significance of "Howland Sharp"?
|
|
|
What does 'Expensive parser function count: 33/500' indicate about the page's processing?
|
|
|
What jape led to the undoing of Saera and her companions?
|
|
|
Who is Samwell Tarly?
|
|
|
What is the genre of 'The Saint of Bright Doors' by Vajra Chandrasekera?
|
|
|
Which market is currently the only one where the HBO Go brand is still active?
|
|
|
What is the relationship between IGON VYRWEL and MACE TYRELL?
|
|
|
What is A Game of Thrones-Chapter 23? (Part 2)
|
|
|
What is Helman Tallhart? (Part 10)
|
|
|
What is Marselen? (Part 3)
|
|
|
What is stated in the section The Triarchy and the Daughters' War about Tyrosh? (Part 1)
|
|
|
What is described in the References and Notes[] section in Meleys?
|
|
|
Where did the line 'You look pale, child.' appear?
|
|
|
Where did the line 'I know that I can't.' appear?
|
|
|
What was Tyrion Lannister's internal thought about Prince Oberyn Martell's wit?
|
|
|
Who is Aeron Greyjoy?
|
|
|
What is Catelyn Stark's primary motivation?
|
|
|
What are the allegiances of Gerion Lannister?
|
|
|
What did Lysa eventually admit?
|
|
|
Which programs tied for Outstanding Art Direction for Variety or Nonfiction Programming?
|
|
|
Who rules Westeros at the beginning of the story?
|
|
|
Who wrote the third episode of Season 2, "The Burning Mill"?
|
|
|
What is the significance of "Archived from the original on 21 August 2007"?
|
|
|
What is Bernie Sanders' self-description mentioned in The Guardian article from April 30, 2015?
|
|
|
What does Jon's mission beyond the Wall signify?
|
|
|
What is the relationship between HALLIS MOLLEN and his uncles and aunts?
|
|
|
What is the Issue of Armond Connington?
|
|
|
What is stated in the section Initial invasion about First Dornish War? (Part 5)
|
|
|
What is Lanna?
|
|
|
What is stated in the section Known tattooed characters about Tattoo? (Part 14)
|
|
|
Where did the line 'for such a pretext?' appear?
|
|
|
Where did the line 'just to gut these three.' appear?
|
|
|
Who was the man that took it upon himself to be a hero?
|
|
|
What happened to Sandor (The Hound) Clegane's face?
|
|
|
Myranda shares gossip with Sansa, reminding her of Jeyne.
|
|
|
What is "The Daily Show with Jon Stewart"?
|
|
|
What was the condition of Khal Drogo after the injury that developed into sepsis?
|
|
|
What happened between Arrax and Vhagar?
|
|
|
What is King's Landing (A Song of Ice and Fire)?
|
|
|
What is the primary source material for the "Game of Thrones" television series?
|
|
|
Who is SER BRYNDEN TULLY?
|
|
|
What is Canker Jeyne? (Part 1)
|
|
|
What is stated in the section Historical Members about House Westerling? (Part 2)
|
|
|
What is Rhaegar Targaryen? (Part 10)
|
|
|
What is described in the History[] section in Hallis_Hornwood?
|
|
|
Where did the line 'Wearing the crown for so many years' appear?
|
|
|
What did Arianne ask to see instead of her father the next morning?
|
|
|
When did "A Golden Crown" first air?
|
|
|
What does 'the hundred gods of the Kingdom of Sarnor still worshipped' signify?
|
|
|
Which program won the award for Outstanding Limited Series?
|
|
|
What is the significance of the 'golden stag' as a symbol?
|
|
|
What does "Is Nobody Going to San Antone?" by Walton Simons in 'Texas Hold 'Em' imply?
|
|
|
What is the meter of the poem "Fire and Ice"?
|
|
|
What is the relationship between Aegon the Dragon and Torrhen Stark?
|
|
|
What is stated in the section Goals about Great ranging? (Part 1)
|
|
|
What is stated in the section Grasses about Plants? (Part 5)
|
|
|
What are references in Hallyne?
|
|
|
Where did the line 'A girl has no desires.' appear?
|
|
|
Where does Jeor Mormont send Jon Snow and Qhorin Halfhand?
|
|
|
When was Harlan Hunter born?
|
|
|
What is "PBS"?
|
|
|
What is the significance of 'the Lightning Lord'?
|
|
|
What types of decks do players control in A Game of Thrones: The Card Game?
|
|
|
"The consequences are grave when you discharge a cardiac patient without further assessment."
|
|
|
What is Aegon Targaryen (son of Rhaegar)/Theories? (Part 15)
|
|
|
What is Horas Harroway? (Part 2)
|
|
|
What is stated in the section A Storm of Swords about Robin Ryger?
|
|
|
Where did the line 'and put leeches on me.' appear?
|
|
|
What kind of person was Qotho, one of Khal Drogo's bloodriders?
|
|
|
Who played Wun Wun in season 6?
|
|
|
Where did Arianne Martell and her companions await the arrival of Myrcella Baratheon?
|
|
|
What is "Red Prophet by Orson Scott Card (1989)"?
|
|
|
Who was the squire captured and brought to the Red Keep?
|
|
|
What historical parallels are noted regarding Cersei's introduction and her loyalty to House Lannister over her husband, the king?
|
|
|
What resemblance do scholars note between House Stark/House of York and House Lannister/House of Lancaster?
|
|
|
What motif does Larrington describe regarding the presumed deaths of two young Targaryen heirs in the novel's pre-history?
|
|
|
To whom is Petyr Baelish compared by scholars, and why?
|
|
|
To whom is Khal Drogo compared, and why?
|
|
|
How does Westeros' primary religious institution compare to the medieval Catholic Church?
|
|
|
What similarities have critics noted between the Wall in the novel and historical structures?
|
|
|
What cultures are cited as influences for the Dothraki culture?
|
|
|
In what ways are female characters entered into marriage in the novel?
|
|
|
How does Borowska-Szerszun interpret Daenerys' narrative regarding traditional fairy tales?
|
|
|
What consequence does Larrington attribute to Daenerys' growing influence over Drogo?
|
|
|
What political alliances are established through the marriages of Cersei and Catelyn?
|
|
|
How is the betrothal of Cersei and Catelyn's children used for political purposes?
|
|
|
What is the described nature of the betrothal between Joffrey and Sansa?
|
|
|
What is a contested topic regarding the series' female characters?
|
|
|
How is the series' depiction of rape described by scholars and fans?
|
|
|
What does Mariah Larsson state about Drogo's knowledge of Daenerys' language and its use?
|
|
|
According to Carroll, what "problematizes" Daenerys' consent, and what is his description of Drogo's actions?
|
|
|
How does Daenerys attempt to prevent or mitigate sexual violence by her husband's warriors?
|
|
|
What is the consequence of Daenerys intervening to prevent the rape of another woman?
|
|
|
How is Cersei depicted as being subjected to sexual violence?
|
|
|
How does Marta Eidsvσg contrast Cersei's role as a mother?
|
|
|
How is Catelyn Stark depicted in relation to her children, including Ned's illegitimate son?
|
|
|
Why is Catelyn's role as a viewpoint character considered unusual?
|
|
|
What is Robert's reaction to the news of Daenerys' marriage and potential offspring?
|
|
|
What symbolism does Carroll note regarding Daenerys and the dragons?
|
|
|
How does Sheilagh O'Brien describe the maegi Mirri Maz Duur and her symbolism?
|
|
|
What does Anne Gjelsvik suggest Mirri Maz Duur represents, and what is the consequence of her actions?
|
|
|
What symbolic action does Daenerys take against Mirri Maz Duur?
|
|
|
What does Blaszkiewicz say about Aerys' reign and its impact?
|
|
|
How is Robert described in comparison to Aerys, and what is his perceived failing as king?
|
|
|
How does Hudson describe Cersei's actions regarding Robert's authority?
|
|
|
How does Walton describe Ned Stark's role as a feudal lord?
|
|
|
What does Pavlac say the "game of thrones" refers to?
|
|
|
What does Cersei Lannister tell Ned about participation in the game of thrones?
|
|
|
What event drives the disputed succession and the "game of thrones"?
|
|
|
What is the basis for the HBO television series Game of Thrones?
|
|
|
How did the television series Game of Thrones diverge from the novel A Game of Thrones?
|
|
|
What major change did the television series make to the novel's timeline?
|
|
|
Which characters' ages were increased in the television series compared to the novel?
|
|
|
Who adapted A Game of Thrones as a graphic novel, anwho provided the art?
|
|
|
What were some of the problems Daniel Abraham faced in adapting A Game of Thrones as a graphic novel?
|
|
|
What is A Game of Thrones: Genesis?
|
|
|
What classification does Martin use for writers' approaches to storytelling?
|
|
|
How has Martin's work impacted discussions about the series' authentic representation, according to Helen Young?
|
|
|
What is Helen Young's description of Tolkien's background versus Martin's?
|
|
|
What does Young note about the dramatic effect of Eddard Stark's death?
|
|
|
What characterizes 'portal-quest fantasy'?
|
|
|
How is the Three-Eyed Crow's dialogue presented in portal-quest fantasy, using Bran as an example?
|
|
|
What observation does Gary Westfahl highlight regarding Lord Eddard Stark and dire-wolf pups?
|
|
|
What does David Symons note about Martin's work in university classes?
|
|
|
What belief do some fans hold about the series' medieval portrayal, and what is Carroll's counter-argument?
|
|
|
What is Ned's remark to Catelyn about religion, and what difficulty does Larrington note?
|
|
|
When did Martin have the idea for the Wall, and where did it originate?
|
|
|
How does Carroll describe Cersei as a narrative foil to Sansa?
|
|
|
What difficulty do commentators have with analyzing rape in A Song of Ice and Fire, according to Carroll?
|
|
|
|
|
|
"""
|
|
|
|
|
|
print("\n Running inference on Game of Thrones QA model\n")
|
|
|
|
|
|
for q in questions.split('\n'):
|
|
|
try:
|
|
|
answer = decode_sequence(q)
|
|
|
print(f"Q: {q}")
|
|
|
print(f"A: {answer} \n")
|
|
|
except Exception as e:
|
|
|
print(f"Error for question [{q}]: {e}\n")
|
|
|
|
|
|
|