Upload 13 files
Browse files- .gitattributes +3 -0
- 10.json +0 -0
- 15.json +0 -0
- 16.json +0 -0
- got-q-a-transformer.ipynb +0 -0
- got_qa_acc.png +3 -0
- got_qa_loss.png +3 -0
- got_qa_transformer.keras +3 -0
- hp.py +6 -0
- icefire_spm.model +3 -0
- icefire_spm.vocab +0 -0
- infer.py +553 -0
- ques.txt +0 -0
- tokenizer_info.json +1 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
got_qa_acc.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
got_qa_loss.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
got_qa_transformer.keras filter=lfs diff=lfs merge=lfs -text
|
10.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
15.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
16.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
got-q-a-transformer.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
got_qa_acc.png
ADDED
|
Git LFS Details
|
got_qa_loss.png
ADDED
|
Git LFS Details
|
got_qa_transformer.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:11207e66e974289e5e27551c5b02d4174603e7526f4a68d35434ab2c17de8c4c
|
| 3 |
+
size 441533309
|
hp.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
|
| 3 |
+
with open('output\\got_full_pages\\0102__chunks\\chunk001.json', mode='r',encoding='utf-8') as f:
|
| 4 |
+
data = json.load(f)
|
| 5 |
+
for obj in data:
|
| 6 |
+
print(obj['question'])
|
icefire_spm.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f9144b97b245e302c4fac7b6887ffbca52d34d8ce8d75e4be713178b7365b722
|
| 3 |
+
size 740136
|
icefire_spm.vocab
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
infer.py
ADDED
|
@@ -0,0 +1,553 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import tensorflow as tf
|
| 2 |
+
import sentencepiece as spm
|
| 3 |
+
import json
|
| 4 |
+
import os
|
| 5 |
+
import numpy as np
|
| 6 |
+
import os
|
| 7 |
+
import json
|
| 8 |
+
import random
|
| 9 |
+
import re
|
| 10 |
+
import tensorflow as tf
|
| 11 |
+
import sentencepiece as spm
|
| 12 |
+
import matplotlib.pyplot as plt
|
| 13 |
+
from tqdm import tqdm
|
| 14 |
+
from tensorflow import keras
|
| 15 |
+
from tensorflow.keras import layers
|
| 16 |
+
# ================================
|
| 17 |
+
# 8. Model Layers
|
| 18 |
+
# ================================
|
| 19 |
+
# ================================
|
| 20 |
+
# 1. CONFIG
|
| 21 |
+
# ================================
|
| 22 |
+
DATA_DIR = "output4" # UPDATE THIS
|
| 23 |
+
SPM_MODEL = "icefire_spm.model"
|
| 24 |
+
CHECKPOINT_PATH = "got_qa_transformer.keras"
|
| 25 |
+
BATCH_SIZE = 150
|
| 26 |
+
EPOCHS = 20
|
| 27 |
+
VAL_SPLIT = 0.05
|
| 28 |
+
MAX_QUESTION_WORDS = 25
|
| 29 |
+
MAX_ANSWER_WORDS = 60
|
| 30 |
+
SEQ_LEN_EN = 30
|
| 31 |
+
SEQ_LEN_TE = 64
|
| 32 |
+
VOCAB_SIZE = 30_000
|
| 33 |
+
EMBED_DIM = 256
|
| 34 |
+
DENSE_DIM = 512
|
| 35 |
+
NUM_HEADS = 8
|
| 36 |
+
NUM_LAYERS_ENC = 1
|
| 37 |
+
NUM_LAYERS_DEC = 1
|
| 38 |
+
sp = spm.SentencePieceProcessor(model_file=SPM_MODEL)
|
| 39 |
+
START_ID = sp.bos_id() # <bos>
|
| 40 |
+
END_ID = sp.eos_id() # <eos>
|
| 41 |
+
print(f"Using <bos>={START_ID}, <eos>={END_ID}")
|
| 42 |
+
|
| 43 |
+
class PositionalEmbedding(layers.Layer):
|
| 44 |
+
def __init__(self, seq_len, vocab_size, embed_dim, **kwargs):
|
| 45 |
+
super().__init__(**kwargs)
|
| 46 |
+
self.token_emb = layers.Embedding(vocab_size, embed_dim)
|
| 47 |
+
# Initializes a positional embedding matrix of size (seq_len, embed_dim)
|
| 48 |
+
self.pos_emb = layers.Embedding(seq_len, embed_dim)
|
| 49 |
+
self.seq_len = seq_len # Stored for get_config
|
| 50 |
+
|
| 51 |
+
def call(self, x):
|
| 52 |
+
length = tf.shape(x)[-1]
|
| 53 |
+
# Creates positions [0, 1, 2, ..., length-1] dynamically
|
| 54 |
+
positions = tf.range(start=0, limit=length, delta=1)
|
| 55 |
+
return self.token_emb(x) + self.pos_emb(positions)
|
| 56 |
+
|
| 57 |
+
# get_config remains correct for serialization
|
| 58 |
+
def get_config(self):
|
| 59 |
+
cfg = super().get_config()
|
| 60 |
+
cfg.update({"seq_len": self.seq_len, "vocab_size": VOCAB_SIZE, "embed_dim": EMBED_DIM})
|
| 61 |
+
return cfg
|
| 62 |
+
|
| 63 |
+
class TransformerEncoder(layers.Layer):
|
| 64 |
+
def __init__(self, embed_dim, dense_dim, num_heads, **kwargs):
|
| 65 |
+
super().__init__(**kwargs)
|
| 66 |
+
self.attn = layers.MultiHeadAttention(num_heads, embed_dim)
|
| 67 |
+
self.ffn = keras.Sequential([layers.Dense(dense_dim, activation="relu"), layers.Dense(embed_dim)])
|
| 68 |
+
self.ln1 = layers.LayerNormalization()
|
| 69 |
+
self.ln2 = layers.LayerNormalization()
|
| 70 |
+
|
| 71 |
+
def call(self, x, mask=None):
|
| 72 |
+
if mask is not None: mask = mask[:, tf.newaxis, :]
|
| 73 |
+
attn = self.attn(x, x, attention_mask=mask)
|
| 74 |
+
x = self.ln1(x + attn)
|
| 75 |
+
ffn = self.ffn(x)
|
| 76 |
+
return self.ln2(x + ffn)
|
| 77 |
+
|
| 78 |
+
def get_config(self):
|
| 79 |
+
cfg = super().get_config()
|
| 80 |
+
cfg.update({"embed_dim": EMBED_DIM, "dense_dim": DENSE_DIM, "num_heads": NUM_HEADS})
|
| 81 |
+
return cfg
|
| 82 |
+
|
| 83 |
+
class TransformerDecoder(layers.Layer):
|
| 84 |
+
def __init__(self, embed_dim, dense_dim, num_heads, **kwargs):
|
| 85 |
+
super().__init__(**kwargs)
|
| 86 |
+
self.self_attn = layers.MultiHeadAttention(num_heads, embed_dim)
|
| 87 |
+
self.cross_attn = layers.MultiHeadAttention(num_heads, embed_dim)
|
| 88 |
+
self.ffn = keras.Sequential([layers.Dense(dense_dim, activation="relu"), layers.Dense(embed_dim)])
|
| 89 |
+
self.ln1 = layers.LayerNormalization()
|
| 90 |
+
self.ln2 = layers.LayerNormalization()
|
| 91 |
+
self.ln3 = layers.LayerNormalization()
|
| 92 |
+
|
| 93 |
+
def get_causal_mask(self, x):
|
| 94 |
+
seq_len = tf.shape(x)[1]
|
| 95 |
+
mask = tf.linalg.band_part(tf.ones((seq_len, seq_len)), -1, 0)
|
| 96 |
+
return tf.cast(mask, tf.int32)[tf.newaxis, ...]
|
| 97 |
+
|
| 98 |
+
def call(self, x, enc_out, mask=None):
|
| 99 |
+
causal_mask = self.get_causal_mask(x)
|
| 100 |
+
attn1 = self.self_attn(x, x, attention_mask=causal_mask)
|
| 101 |
+
x = self.ln1(x + attn1)
|
| 102 |
+
padding_mask = mask[:, tf.newaxis, :] if mask is not None else None
|
| 103 |
+
attn2 = self.cross_attn(x, enc_out, enc_out, attention_mask=padding_mask)
|
| 104 |
+
x = self.ln2(x + attn2)
|
| 105 |
+
ffn = self.ffn(x)
|
| 106 |
+
return self.ln3(x + ffn)
|
| 107 |
+
|
| 108 |
+
def get_config(self):
|
| 109 |
+
cfg = super().get_config()
|
| 110 |
+
cfg.update({"embed_dim": EMBED_DIM, "dense_dim": DENSE_DIM, "num_heads": NUM_HEADS})
|
| 111 |
+
return cfg
|
| 112 |
+
|
| 113 |
+
# ================================
|
| 114 |
+
# 9. Build Model (2 inputs!)
|
| 115 |
+
# Assuming SEQ_LEN_TE is 64 (based on the error: expected 64, found 63)
|
| 116 |
+
# Set this variable based on the constant defined in your global scope
|
| 117 |
+
DEC_INPUT_LEN = SEQ_LEN_TE - 1
|
| 118 |
+
|
| 119 |
+
def build_model():
|
| 120 |
+
# Encoder Input: The question sequence length (SEQ_LEN_EN) is unchanged.
|
| 121 |
+
enc_in = keras.Input(shape=(SEQ_LEN_EN,), dtype="int64", name="encoder_inputs")
|
| 122 |
+
|
| 123 |
+
# Decoder Input: MUST be SEQ_LEN_TE - 1 (e.g., 63) to match the sliced data.
|
| 124 |
+
dec_in = keras.Input(shape=(DEC_INPUT_LEN,), dtype="int64", name="decoder_inputs")
|
| 125 |
+
|
| 126 |
+
# --- Encoder Stack ---
|
| 127 |
+
# PositionalEmbedding for the Encoder (uses original length)
|
| 128 |
+
enc_emb = PositionalEmbedding(SEQ_LEN_EN, VOCAB_SIZE, EMBED_DIM)(enc_in)
|
| 129 |
+
x = enc_emb
|
| 130 |
+
for _ in range(NUM_LAYERS_ENC):
|
| 131 |
+
x = TransformerEncoder(EMBED_DIM, DENSE_DIM, NUM_HEADS)(x)
|
| 132 |
+
enc_out = x
|
| 133 |
+
|
| 134 |
+
# --- Decoder Stack ---
|
| 135 |
+
# PositionalEmbedding for the Decoder (uses the new, shorter length)
|
| 136 |
+
dec_emb = PositionalEmbedding(DEC_INPUT_LEN, VOCAB_SIZE, EMBED_DIM)(dec_in)
|
| 137 |
+
x = dec_emb
|
| 138 |
+
for _ in range(NUM_LAYERS_DEC):
|
| 139 |
+
# Pass the encoder output (enc_out) to the decoder cross-attention
|
| 140 |
+
x = TransformerDecoder(EMBED_DIM, DENSE_DIM, NUM_HEADS)(x, enc_out)
|
| 141 |
+
|
| 142 |
+
# Final dense layer to predict vocabulary token logits
|
| 143 |
+
logits = layers.Dense(VOCAB_SIZE)(x)
|
| 144 |
+
|
| 145 |
+
model = keras.Model([enc_in, dec_in], logits)
|
| 146 |
+
return model
|
| 147 |
+
# ================================
|
| 148 |
+
# 10. Loss & Metrics
|
| 149 |
+
# ================================
|
| 150 |
+
def masked_loss(y_true, y_pred):
|
| 151 |
+
loss_fn = keras.losses.SparseCategoricalCrossentropy(from_logits=True, reduction='none')
|
| 152 |
+
loss = loss_fn(y_true, y_pred)
|
| 153 |
+
mask = tf.cast(tf.not_equal(y_true, 0), loss.dtype)
|
| 154 |
+
return tf.reduce_sum(loss * mask) / tf.reduce_sum(mask)
|
| 155 |
+
|
| 156 |
+
def masked_accuracy(y_true, y_pred):
|
| 157 |
+
y_pred = tf.argmax(y_pred, axis=-1, output_type=y_true.dtype)
|
| 158 |
+
matches = tf.cast(tf.equal(y_true, y_pred), tf.float32)
|
| 159 |
+
mask = tf.cast(tf.not_equal(y_true, 0), tf.float32)
|
| 160 |
+
return tf.reduce_sum(matches * mask) / tf.reduce_sum(mask)
|
| 161 |
+
# ================================
|
| 162 |
+
# Load Config
|
| 163 |
+
# ================================
|
| 164 |
+
with open("tokenizer_info.json") as f:
|
| 165 |
+
info = json.load(f)
|
| 166 |
+
|
| 167 |
+
SPM_MODEL = info["spm_model"]
|
| 168 |
+
START_ID = info["start_id"]
|
| 169 |
+
END_ID = info["end_id"]
|
| 170 |
+
SEQ_LEN_EN = info["seq_len_en"]
|
| 171 |
+
SEQ_LEN_TE = info["seq_len_te"]
|
| 172 |
+
|
| 173 |
+
# ================================
|
| 174 |
+
# Load Model & Tokenizer
|
| 175 |
+
# ================================
|
| 176 |
+
sp = spm.SentencePieceProcessor(model_file=SPM_MODEL)
|
| 177 |
+
model = keras.models.load_model(CHECKPOINT_PATH, custom_objects={
|
| 178 |
+
"PositionalEmbedding": PositionalEmbedding,
|
| 179 |
+
"TransformerEncoder": TransformerEncoder,
|
| 180 |
+
"TransformerDecoder": TransformerDecoder,
|
| 181 |
+
"masked_loss": masked_loss,
|
| 182 |
+
"masked_accuracy": masked_accuracy
|
| 183 |
+
})
|
| 184 |
+
def predict_step(src, tgt):
|
| 185 |
+
return model([src, tgt], training=False)
|
| 186 |
+
DEC_INPUT_LEN = SEQ_LEN_TE - 1
|
| 187 |
+
def tokenize_question(question):
|
| 188 |
+
ids = sp.encode(question, out_type=int)
|
| 189 |
+
if len(ids) < SEQ_LEN_EN:
|
| 190 |
+
ids = ids + [0] * (SEQ_LEN_EN - len(ids))
|
| 191 |
+
else:
|
| 192 |
+
ids = ids[:SEQ_LEN_EN]
|
| 193 |
+
return np.array([ids], dtype=np.int64)
|
| 194 |
+
def decode_sequence(question, max_len=60):
|
| 195 |
+
src_np = tokenize_question(question) # numpy (1, SEQ_LEN_EN)
|
| 196 |
+
src = tf.constant(src_np, dtype=tf.int64) # tf.Tensor (1, SEQ_LEN_EN)
|
| 197 |
+
|
| 198 |
+
# Start token (1,1)
|
| 199 |
+
tgt = tf.constant([[START_ID]], dtype=tf.int64)
|
| 200 |
+
|
| 201 |
+
for _ in range(max_len):
|
| 202 |
+
# current length as Python int
|
| 203 |
+
cur_len = int(tf.shape(tgt)[1].numpy()) # scalar Python int
|
| 204 |
+
|
| 205 |
+
pad_len = DEC_INPUT_LEN - cur_len # Python int
|
| 206 |
+
if pad_len < 0:
|
| 207 |
+
# truncate to last DEC_INPUT_LEN tokens
|
| 208 |
+
tgt_for_model = tgt[:, -DEC_INPUT_LEN:]
|
| 209 |
+
effective_pos = DEC_INPUT_LEN - 1 # we will read logits at this index
|
| 210 |
+
else:
|
| 211 |
+
# pad on right with PAD_ID (assumed 0)
|
| 212 |
+
paddings = [[0, 0], [0, pad_len]] # plain Python list of ints
|
| 213 |
+
tgt_for_model = tf.pad(tgt, paddings, constant_values=0) # (1, DEC_INPUT_LEN)
|
| 214 |
+
effective_pos = cur_len - 1 # index of latest token's logits
|
| 215 |
+
|
| 216 |
+
# call the model (predict_step should accept tensors shaped (1, SEQ_LEN_EN) and (1, DEC_INPUT_LEN))
|
| 217 |
+
logits = predict_step(src, tgt_for_model) # shape (1, DEC_INPUT_LEN, VOCAB)
|
| 218 |
+
|
| 219 |
+
# Use Python int index into logits
|
| 220 |
+
next_logits = logits[:, effective_pos, :] # shape (1, vocab)
|
| 221 |
+
next_id = tf.argmax(next_logits, axis=-1, output_type=tf.int64) # shape (1,)
|
| 222 |
+
|
| 223 |
+
# make (1,1) and append
|
| 224 |
+
next_id = tf.expand_dims(next_id, axis=-1) # (1,1)
|
| 225 |
+
tgt = tf.concat([tgt, next_id], axis=-1) # (1, cur_len+1)
|
| 226 |
+
|
| 227 |
+
# stop if end token produced
|
| 228 |
+
if int(next_id.numpy()[0][0]) == END_ID:
|
| 229 |
+
break
|
| 230 |
+
|
| 231 |
+
# remove start token and truncate at END_ID if present
|
| 232 |
+
ids = tgt[0].numpy()
|
| 233 |
+
ids = ids[1:] # drop START
|
| 234 |
+
if END_ID in ids:
|
| 235 |
+
ids = ids[:np.where(ids == END_ID)[0][0]]
|
| 236 |
+
return sp.decode(ids.tolist())
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
questions = """who is the father of tyrion lannister,
|
| 241 |
+
who killed robert baratheon,
|
| 242 |
+
who is the mother of jon snow,
|
| 243 |
+
who betrayed ned stark,
|
| 244 |
+
who is the king beyond the wall,
|
| 245 |
+
who trained arya stark in braavos,
|
| 246 |
+
who poisoned joffrey baratheon,
|
| 247 |
+
who burned the sept of baelor,
|
| 248 |
+
who killed ramsay bolton,
|
| 249 |
+
who created the white walkers,
|
| 250 |
+
who is known as the kingslayer,
|
| 251 |
+
who leads the dothraki horde,
|
| 252 |
+
who is the three eyed raven,
|
| 253 |
+
who killed the night king,
|
| 254 |
+
who commanded the unsullied army
|
| 255 |
+
What does Robb's army do at the Green Fork of the Trident?
|
| 256 |
+
Who plays Maester Aemon in season 5?
|
| 257 |
+
What is 'General Electric' related to in this text?
|
| 258 |
+
Where did the line 'I brought us' appear?
|
| 259 |
+
What is House Bracken? (Part 19)
|
| 260 |
+
Who is Tyana Wylde?
|
| 261 |
+
What was the political outcome of the "Battle of the Kingsroad"?
|
| 262 |
+
What is "Log in"?
|
| 263 |
+
What is the Dothraki language?
|
| 264 |
+
Which house holds Tyshara Lannister?
|
| 265 |
+
What is the relationship between NAIL and HAMMER?
|
| 266 |
+
What was Charles Dance's role in the TV film 'Trial & Retribution'?
|
| 267 |
+
What is "The Bellingham Herald"?
|
| 268 |
+
How many major awards did The Dick Van Dyke Show win at the 18th Primetime Emmy Awards?
|
| 269 |
+
Where did the line 'I imagine you're right.' appear?
|
| 270 |
+
What is stated in the section A Game of Thrones about Lyanna Stark? (Part 1)
|
| 271 |
+
What is the relationship between CERSEI LANNISTER and King Robert I Baratheon?
|
| 272 |
+
What is the scientific name for the brittle star belonging to the family Ophiocamacidae?
|
| 273 |
+
What are the fantasy subgenres that are characterized by their focus on magical girls or similar protagonists?
|
| 274 |
+
What is the "40th Daytime Creative Arts Emmy Awards"?
|
| 275 |
+
What were the titles of the Polish editions of 'A Feast for Crows'?
|
| 276 |
+
What is stated in the section Birth about Years after Aegon's Conquest/Calculations Ages (Continued2)? (Part 473)
|
| 277 |
+
What is A Game of Thrones-Chapter 19? (Part 2)
|
| 278 |
+
When was House Harlaw of the Tower of Glimmering founded?
|
| 279 |
+
What does 'Print/export' offer?
|
| 280 |
+
What passage is cited by 'A Clash of Kings, Theon I, pp. 172û173'?
|
| 281 |
+
Who is the spouse of Hosman Norcross?
|
| 282 |
+
Where did the line 'while the rest of you played.' appear?
|
| 283 |
+
What is stated in the section Character about Myles Mooton?
|
| 284 |
+
What is the relationship between BALON GREYJOY and GOODBROTHER?
|
| 285 |
+
What are the words of House Uller of Hellholt?
|
| 286 |
+
Why did George R. R. Martin not make complete world maps available early on?
|
| 287 |
+
What is the meaning of "Nonbelief" in the context of "Religious unbelief"?
|
| 288 |
+
What is the significance of '5th_International_Emmy_Awards'?
|
| 289 |
+
Who played Frances in season 6?
|
| 290 |
+
Where did the line 'we'll get there before the dead.' appear?
|
| 291 |
+
What is Jon Pox? (Part 1)
|
| 292 |
+
What is the relationship between House Martell and Princess Elia?
|
| 293 |
+
What are the seats of House Stark of Winterfell?
|
| 294 |
+
What is the time usage for the 'Family_tree_of_Tytos_Lannister' template?
|
| 295 |
+
What is the "House of Black and White"?
|
| 296 |
+
Which actor won Outstanding Lead Actor in a Comedy Series?
|
| 297 |
+
What is the gender of Hallyne?
|
| 298 |
+
What items did Tyrion regain possession of thanks to Catelyn Stark's intervention?
|
| 299 |
+
What is stated in the section Birth about Years after Aegon's Conquest/Calculations Ages? (Part 349)
|
| 300 |
+
What is Harbert Paege? (Part 4)
|
| 301 |
+
What is the relationship between ALESANDER and SYMOND?
|
| 302 |
+
What is the purpose of the flaps on a dust jacket?
|
| 303 |
+
What is Fantasmas (TV series)?
|
| 304 |
+
What is the "Iron Throne"?
|
| 305 |
+
Which song was performed by Flight of the Conchords from "Unnatural Love"?
|
| 306 |
+
In which TV series seasons does Nail appear?
|
| 307 |
+
I see no lord. Only a dog dressed in chickenboneswho rattles when he rides.
|
| 308 |
+
What is described in the House Jast during the Books[] section in House_Jast?
|
| 309 |
+
What is Lysa Arryn? (Part 14)
|
| 310 |
+
What is stated in the section References and Notes about A Storm of Swords-Chapter 73? (Part 1)
|
| 311 |
+
Who is DELENA FLORENT?
|
| 312 |
+
How did Ned Stark's execution affect the Stark children?
|
| 313 |
+
What was the reason for splitting A Feast for Crows and A Dance with Dragons into two volumes?
|
| 314 |
+
What is the 'Choice Awards 2018'?
|
| 315 |
+
What is the "63rd Primetime Emmy Awards"?
|
| 316 |
+
What are the titles held by Sylas?
|
| 317 |
+
What did Jaime remind Ser Boros Blount of regarding Tommen's safety?
|
| 318 |
+
Where did the line 'that even dragons burned in flight.' appear?
|
| 319 |
+
What is Peach? (Part 5)
|
| 320 |
+
What is the Conflict of First Battle of Tumbleton?
|
| 321 |
+
What is stated in the section Chapter 3: Mors II about List of characters created for the Cyanide game? (Part 7)
|
| 322 |
+
Who is SER DAVEN?
|
| 323 |
+
When is "The Winds of Winter" expected to be released?
|
| 324 |
+
What is the title of the first book in the A Song of Ice and Fire series?
|
| 325 |
+
What happened to Storm's End during the War of the Usurper?
|
| 326 |
+
What happened to Wyman Manderly's heir, Ser Wylis?
|
| 327 |
+
What is the purpose of the 'Navbox' template?
|
| 328 |
+
Who is Cragorn and where is he at the beginning of the text?
|
| 329 |
+
What was the overall approval rating for Game of Thrones season 5 on Rotten Tomatoes?
|
| 330 |
+
What is the Lannister sigil and words?
|
| 331 |
+
Where did the line 'in Maester Aemon's library.' appear?
|
| 332 |
+
What is Years after Aegon's Conquest/Calculations Ages (Continued)? (Part 169)
|
| 333 |
+
What is mentioned in the history of Rosamund Ball?
|
| 334 |
+
What is stated in the section The Queen's protectors about House Targaryen? (Part 7)
|
| 335 |
+
What is Doreah? (Part 2)
|
| 336 |
+
What is stated in the section Episode 6: A Golden Crown about List of characters created forGame of Thrones? (Part 1133)
|
| 337 |
+
What is the relationship between CASS and TANSY?
|
| 338 |
+
Who is MAESTER OMER?
|
| 339 |
+
Which actresses have 4 nominations?
|
| 340 |
+
How are the Shadow Men described?
|
| 341 |
+
What is Oldtown associated with?
|
| 342 |
+
What is Slaver's Bay?
|
| 343 |
+
What is 'Merman'?
|
| 344 |
+
Who are some notable servants and vassals of House Targaryen?
|
| 345 |
+
What is 'Anthrax_(American_band)'?
|
| 346 |
+
What is the significance of the 'Triple Crown of Acting'?
|
| 347 |
+
Who is Jay Sandrich?
|
| 348 |
+
Who captures Brienne, Podrick, and Hyle, and why are they threatened?
|
| 349 |
+
What is the gender of Palla?
|
| 350 |
+
What is the significance of the 'jhat'?
|
| 351 |
+
What was Euron Crows Eye doing across the world?
|
| 352 |
+
What is the final verse of 'The Dornishman's Wife' as sung in the tent?
|
| 353 |
+
Where did the line 'I defended the city' appear?
|
| 354 |
+
Where did the line 'They'd pass wildling villages.' appear?
|
| 355 |
+
Where did the line 'I like her pretty.' appear?
|
| 356 |
+
What happened to the æJaqen = Syrio ForelÆ mask theory?
|
| 357 |
+
What is stated in the section Character about Willam Dustin? (Part 1)
|
| 358 |
+
What is Sphinx? (Part 14)
|
| 359 |
+
What is the Notable places of New Castle?
|
| 360 |
+
What is Landing of the Golden Company? (Part 3)
|
| 361 |
+
What is stated in the section House Keath at the end of the third century about House Keath? (Part 1)
|
| 362 |
+
What is stated in the section A Clash of Kings about Greywater Watch? (Part 2)
|
| 363 |
+
What is stated in the section A Game of Thrones about Doreah? (Part 6)
|
| 364 |
+
What is Category:Images by Zach Graves? (Part 1)
|
| 365 |
+
What is A Game of Thrones-Chapter 21? (Part 5)
|
| 366 |
+
What is the Location of Ashford?
|
| 367 |
+
What is Category:Dromonds?
|
| 368 |
+
What is the Page of A Clash of Kings-Chapter 35?
|
| 369 |
+
What is mentioned in the history of Allard Royce? (Part 2)
|
| 370 |
+
What is the relationship between MELLARIO and PRINCESS ARIANNE?
|
| 371 |
+
What is the relationship between MORYA and Lord Walder Frey?
|
| 372 |
+
What is the relationship between HARWIN and Hullen?
|
| 373 |
+
What is the relationship between SER DAMION LANNISTER and TYWIN LANNISTER?
|
| 374 |
+
What is the relationship between TYWIN LANNISTER and SER DAMION LANNISTER?
|
| 375 |
+
What is the relationship between Steffon Seaworth and Davos Seaworth?
|
| 376 |
+
What is the relationship between Unspecified Patriarch and SER EMMON?
|
| 377 |
+
What is the relationship between JON SNOW and GHOST?
|
| 378 |
+
What is the relationship between Lord and ùMaceÆs household at Highgarden?
|
| 379 |
+
What is the relationship between EDRIC STORM and GERALD GOWER?
|
| 380 |
+
What is the relationship between King Balon Greyjoy and MAESTER WENDAMYR?
|
| 381 |
+
What is the relationship between LADY MARGOT and Lord Titus Peake?
|
| 382 |
+
What is the relationship between Grey King and House Greyjoy?
|
| 383 |
+
What is the relationship between LORD TITUS PEAKE and Lady Margot?
|
| 384 |
+
What is the relationship between King Balon Greyjoy and DAGMER called CLEFTJAW?
|
| 385 |
+
What is the relationship between Aegon the Conquerer and Lord Edmyn Tully?
|
| 386 |
+
What is the relationship between THEON GREYJOY and WEX?
|
| 387 |
+
What is stated in the section Appearance and Character about Aerea Targaryen? (Part 4)
|
| 388 |
+
What is stated in the section Synopsis about A Clash of Kings-Chapter 11? (Part 2)
|
| 389 |
+
What is the Place of A Storm of Swords-Chapter 17?
|
| 390 |
+
What is stated in the section The Princess and the Queen about Errata of history novellas? (Part 4)
|
| 391 |
+
What is stated in the section A Dance with DragonsAppendix about Errata of main series? (Part 8)
|
| 392 |
+
What is stated in the section A Dance with Dragons about Holy Refuge?
|
| 393 |
+
What is Hugh Hammer? (Part 6)
|
| 394 |
+
What is stated in the section Rivers in Essos about List of rivers? (Part 6)
|
| 395 |
+
What is stated in the section A Clash of Kings about Marriage? (Part 2)
|
| 396 |
+
What is stated in the section A Dance with Dragons about Nymella Toland?
|
| 397 |
+
What is stated in the section A Dance with Dragons about Tattered Prince? (Part 2)
|
| 398 |
+
What are references in First_Men?
|
| 399 |
+
Where did the line 'What are our words?' appear?
|
| 400 |
+
Where did the line 'but I don't want to see' appear?
|
| 401 |
+
Where did the line 'I'm not kissing your fucking hand.' appear?
|
| 402 |
+
Where did the line 'I killed my lover' appear?
|
| 403 |
+
Where did the line 'But you have many miles to go.' appear?
|
| 404 |
+
Where did the line 'Who was the first?' appear?
|
| 405 |
+
How did Sansa explain her father's statement that Joffrey was not the king?
|
| 406 |
+
"You would execute your own son?"
|
| 407 |
+
What question did Xaro Xhoan Daxos ask after Daenerys freed him?
|
| 408 |
+
What are the aliases of Dudley?
|
| 409 |
+
How did Garth VII deal with the alliance between the Storm King and the King of the Rock?
|
| 410 |
+
What was the 'Best Variety Show' winner?
|
| 411 |
+
When did Game of Thrones Season 7 get its premiere date on HBO?
|
| 412 |
+
What is the significance of "Howland Sharp"?
|
| 413 |
+
What does 'Expensive parser function count: 33/500' indicate about the page's processing?
|
| 414 |
+
What jape led to the undoing of Saera and her companions?
|
| 415 |
+
Who is Samwell Tarly?
|
| 416 |
+
What is the genre of 'The Saint of Bright Doors' by Vajra Chandrasekera?
|
| 417 |
+
Which market is currently the only one where the HBO Go brand is still active?
|
| 418 |
+
What is the relationship between IGON VYRWEL and MACE TYRELL?
|
| 419 |
+
What is A Game of Thrones-Chapter 23? (Part 2)
|
| 420 |
+
What is Helman Tallhart? (Part 10)
|
| 421 |
+
What is Marselen? (Part 3)
|
| 422 |
+
What is stated in the section The Triarchy and the Daughters' War about Tyrosh? (Part 1)
|
| 423 |
+
What is described in the References and Notes[] section in Meleys?
|
| 424 |
+
Where did the line 'You look pale, child.' appear?
|
| 425 |
+
Where did the line 'I know that I can't.' appear?
|
| 426 |
+
What was Tyrion Lannister's internal thought about Prince Oberyn Martell's wit?
|
| 427 |
+
Who is Aeron Greyjoy?
|
| 428 |
+
What is Catelyn Stark's primary motivation?
|
| 429 |
+
What are the allegiances of Gerion Lannister?
|
| 430 |
+
What did Lysa eventually admit?
|
| 431 |
+
Which programs tied for Outstanding Art Direction for Variety or Nonfiction Programming?
|
| 432 |
+
Who rules Westeros at the beginning of the story?
|
| 433 |
+
Who wrote the third episode of Season 2, "The Burning Mill"?
|
| 434 |
+
What is the significance of "Archived from the original on 21 August 2007"?
|
| 435 |
+
What is Bernie Sanders' self-description mentioned in The Guardian article from April 30, 2015?
|
| 436 |
+
What does Jon's mission beyond the Wall signify?
|
| 437 |
+
What is the relationship between HALLIS MOLLEN and his uncles and aunts?
|
| 438 |
+
What is the Issue of Armond Connington?
|
| 439 |
+
What is stated in the section Initial invasion about First Dornish War? (Part 5)
|
| 440 |
+
What is Lanna?
|
| 441 |
+
What is stated in the section Known tattooed characters about Tattoo? (Part 14)
|
| 442 |
+
Where did the line 'for such a pretext?' appear?
|
| 443 |
+
Where did the line 'just to gut these three.' appear?
|
| 444 |
+
Who was the man that took it upon himself to be a hero?
|
| 445 |
+
What happened to Sandor (The Hound) Clegane's face?
|
| 446 |
+
Myranda shares gossip with Sansa, reminding her of Jeyne.
|
| 447 |
+
What is "The Daily Show with Jon Stewart"?
|
| 448 |
+
What was the condition of Khal Drogo after the injury that developed into sepsis?
|
| 449 |
+
What happened between Arrax and Vhagar?
|
| 450 |
+
What is King's Landing (A Song of Ice and Fire)?
|
| 451 |
+
What is the primary source material for the "Game of Thrones" television series?
|
| 452 |
+
Who is SER BRYNDEN TULLY?
|
| 453 |
+
What is Canker Jeyne? (Part 1)
|
| 454 |
+
What is stated in the section Historical Members about House Westerling? (Part 2)
|
| 455 |
+
What is Rhaegar Targaryen? (Part 10)
|
| 456 |
+
What is described in the History[] section in Hallis_Hornwood?
|
| 457 |
+
Where did the line 'Wearing the crown for so many years' appear?
|
| 458 |
+
What did Arianne ask to see instead of her father the next morning?
|
| 459 |
+
When did "A Golden Crown" first air?
|
| 460 |
+
What does 'the hundred gods of the Kingdom of Sarnor still worshipped' signify?
|
| 461 |
+
Which program won the award for Outstanding Limited Series?
|
| 462 |
+
What is the significance of the 'golden stag' as a symbol?
|
| 463 |
+
What does "Is Nobody Going to San Antone?" by Walton Simons in 'Texas Hold 'Em' imply?
|
| 464 |
+
What is the meter of the poem "Fire and Ice"?
|
| 465 |
+
What is the relationship between Aegon the Dragon and Torrhen Stark?
|
| 466 |
+
What is stated in the section Goals about Great ranging? (Part 1)
|
| 467 |
+
What is stated in the section Grasses about Plants? (Part 5)
|
| 468 |
+
What are references in Hallyne?
|
| 469 |
+
Where did the line 'A girl has no desires.' appear?
|
| 470 |
+
Where does Jeor Mormont send Jon Snow and Qhorin Halfhand?
|
| 471 |
+
When was Harlan Hunter born?
|
| 472 |
+
What is "PBS"?
|
| 473 |
+
What is the significance of 'the Lightning Lord'?
|
| 474 |
+
What types of decks do players control in A Game of Thrones: The Card Game?
|
| 475 |
+
"The consequences are grave when you discharge a cardiac patient without further assessment."
|
| 476 |
+
What is Aegon Targaryen (son of Rhaegar)/Theories? (Part 15)
|
| 477 |
+
What is Horas Harroway? (Part 2)
|
| 478 |
+
What is stated in the section A Storm of Swords about Robin Ryger?
|
| 479 |
+
Where did the line 'and put leeches on me.' appear?
|
| 480 |
+
What kind of person was Qotho, one of Khal Drogo's bloodriders?
|
| 481 |
+
Who played Wun Wun in season 6?
|
| 482 |
+
Where did Arianne Martell and her companions await the arrival of Myrcella Baratheon?
|
| 483 |
+
What is "Red Prophet by Orson Scott Card (1989)"?
|
| 484 |
+
Who was the squire captured and brought to the Red Keep?
|
| 485 |
+
What historical parallels are noted regarding Cersei's introduction and her loyalty to House Lannister over her husband, the king?
|
| 486 |
+
What resemblance do scholars note between House Stark/House of York and House Lannister/House of Lancaster?
|
| 487 |
+
What motif does Larrington describe regarding the presumed deaths of two young Targaryen heirs in the novel's pre-history?
|
| 488 |
+
To whom is Petyr Baelish compared by scholars, and why?
|
| 489 |
+
To whom is Khal Drogo compared, and why?
|
| 490 |
+
How does Westeros' primary religious institution compare to the medieval Catholic Church?
|
| 491 |
+
What similarities have critics noted between the Wall in the novel and historical structures?
|
| 492 |
+
What cultures are cited as influences for the Dothraki culture?
|
| 493 |
+
In what ways are female characters entered into marriage in the novel?
|
| 494 |
+
How does Borowska-Szerszun interpret Daenerys' narrative regarding traditional fairy tales?
|
| 495 |
+
What consequence does Larrington attribute to Daenerys' growing influence over Drogo?
|
| 496 |
+
What political alliances are established through the marriages of Cersei and Catelyn?
|
| 497 |
+
How is the betrothal of Cersei and Catelyn's children used for political purposes?
|
| 498 |
+
What is the described nature of the betrothal between Joffrey and Sansa?
|
| 499 |
+
What is a contested topic regarding the series' female characters?
|
| 500 |
+
How is the series' depiction of rape described by scholars and fans?
|
| 501 |
+
What does Mariah Larsson state about Drogo's knowledge of Daenerys' language and its use?
|
| 502 |
+
According to Carroll, what "problematizes" Daenerys' consent, and what is his description of Drogo's actions?
|
| 503 |
+
How does Daenerys attempt to prevent or mitigate sexual violence by her husband's warriors?
|
| 504 |
+
What is the consequence of Daenerys intervening to prevent the rape of another woman?
|
| 505 |
+
How is Cersei depicted as being subjected to sexual violence?
|
| 506 |
+
How does Marta Eidsvσg contrast Cersei's role as a mother?
|
| 507 |
+
How is Catelyn Stark depicted in relation to her children, including Ned's illegitimate son?
|
| 508 |
+
Why is Catelyn's role as a viewpoint character considered unusual?
|
| 509 |
+
What is Robert's reaction to the news of Daenerys' marriage and potential offspring?
|
| 510 |
+
What symbolism does Carroll note regarding Daenerys and the dragons?
|
| 511 |
+
How does Sheilagh O'Brien describe the maegi Mirri Maz Duur and her symbolism?
|
| 512 |
+
What does Anne Gjelsvik suggest Mirri Maz Duur represents, and what is the consequence of her actions?
|
| 513 |
+
What symbolic action does Daenerys take against Mirri Maz Duur?
|
| 514 |
+
What does Blaszkiewicz say about Aerys' reign and its impact?
|
| 515 |
+
How is Robert described in comparison to Aerys, and what is his perceived failing as king?
|
| 516 |
+
How does Hudson describe Cersei's actions regarding Robert's authority?
|
| 517 |
+
How does Walton describe Ned Stark's role as a feudal lord?
|
| 518 |
+
What does Pavlac say the "game of thrones" refers to?
|
| 519 |
+
What does Cersei Lannister tell Ned about participation in the game of thrones?
|
| 520 |
+
What event drives the disputed succession and the "game of thrones"?
|
| 521 |
+
What is the basis for the HBO television series Game of Thrones?
|
| 522 |
+
How did the television series Game of Thrones diverge from the novel A Game of Thrones?
|
| 523 |
+
What major change did the television series make to the novel's timeline?
|
| 524 |
+
Which characters' ages were increased in the television series compared to the novel?
|
| 525 |
+
Who adapted A Game of Thrones as a graphic novel, anwho provided the art?
|
| 526 |
+
What were some of the problems Daniel Abraham faced in adapting A Game of Thrones as a graphic novel?
|
| 527 |
+
What is A Game of Thrones: Genesis?
|
| 528 |
+
What classification does Martin use for writers' approaches to storytelling?
|
| 529 |
+
How has Martin's work impacted discussions about the series' authentic representation, according to Helen Young?
|
| 530 |
+
What is Helen Young's description of Tolkien's background versus Martin's?
|
| 531 |
+
What does Young note about the dramatic effect of Eddard Stark's death?
|
| 532 |
+
What characterizes 'portal-quest fantasy'?
|
| 533 |
+
How is the Three-Eyed Crow's dialogue presented in portal-quest fantasy, using Bran as an example?
|
| 534 |
+
What observation does Gary Westfahl highlight regarding Lord Eddard Stark and dire-wolf pups?
|
| 535 |
+
What does David Symons note about Martin's work in university classes?
|
| 536 |
+
What belief do some fans hold about the series' medieval portrayal, and what is Carroll's counter-argument?
|
| 537 |
+
What is Ned's remark to Catelyn about religion, and what difficulty does Larrington note?
|
| 538 |
+
When did Martin have the idea for the Wall, and where did it originate?
|
| 539 |
+
How does Carroll describe Cersei as a narrative foil to Sansa?
|
| 540 |
+
What difficulty do commentators have with analyzing rape in A Song of Ice and Fire, according to Carroll?
|
| 541 |
+
|
| 542 |
+
"""
|
| 543 |
+
|
| 544 |
+
print("\n Running inference on Game of Thrones QA model\n")
|
| 545 |
+
|
| 546 |
+
for q in questions.split('\n'):
|
| 547 |
+
try:
|
| 548 |
+
answer = decode_sequence(q)
|
| 549 |
+
print(f"Q: {q}")
|
| 550 |
+
print(f"A: {answer} \n")
|
| 551 |
+
except Exception as e:
|
| 552 |
+
print(f"Error for question [{q}]: {e}\n")
|
| 553 |
+
|
ques.txt
ADDED
|
Binary file (87.2 kB). View file
|
|
|
tokenizer_info.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"spm_model": "icefire_spm.model", "start_id": 2, "end_id": 3, "seq_len_en": 30, "seq_len_te": 64}
|