This commit is contained in:
wassname
2023-11-12 17:27:17 +08:00
parent 1454e5c053
commit a3ded691e1
3 changed files with 8 additions and 13 deletions
+2
View File
@@ -20,6 +20,8 @@
"training.world_model.start_after_epochs=1",
"training.actor_critic.start_after_epochs=1",
"training.tokenizer.steps_per_epoch=20",
"training.world_model.steps_per_epoch=10",
"training.actor_critic.steps_per_epoch=20",
]
}
]
+6
View File
@@ -96,3 +96,9 @@ Debugging:
transfrmer
x.shape
torch.Size([16, 340, 256])
# 2023-11-12 16:58:37
So I got it training, but during imagination it passes in a single token with no past steps. But the slicer seems to need at least on block? And so I get none?
hmm it's because num_kept_tokens is 16 not 1. So there should be a whole block passed in ?
-13
View File
@@ -109,11 +109,7 @@ class Transformer(nn.Module):
super().__init__()
self.config = config
self.model = load_pretrained_model(config)
# self.ln_f = nn.LayerNorm(self.model.config.vocab_size, config.embed_dim)
self.ln_f = nn.Linear(self.model.config.vocab_size, config.embed_dim)
# self.drop = nn.Dropout(config.embed_pdrop)
# self.blocks = nn.ModuleList([Block(config) for _ in range(config.num_layers)])
# self.ln_f = nn.LayerNorm(config.embed_dim)
def generate_empty_keys_values(self, n: int, max_tokens: int) -> KeysValues:
device = self.ln_f.weight.device # Assumption that all submodules are on the same device
@@ -129,15 +125,6 @@ class Transformer(nn.Module):
output_hidden_states=True,
)
x = outputs.logits.to(torch.float32)
# TODO: we output with last dim 50304 but want 2560 (embed dim)
x = self.ln_f(x)
return x
inputs_embeds
x = self.drop(sequences)
for i, block in enumerate(self.blocks):
x = block(x, None if past_keys_values is None else past_keys_values[i])
x = self.ln_f(x)
return x