Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] RWKV LM #207

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Additional notebook tests
  • Loading branch information
Kyle1668 committed Apr 22, 2023
commit d61375c76586d946fb5b986f5ce212d6fe40ec99
31 changes: 21 additions & 10 deletions elk/rwkv_lm/test_rwkv.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": 58,
"metadata": {},
"outputs": [
{
Expand All @@ -531,42 +531,53 @@
{
"data": {
"text/plain": [
"2048"
"torch.Size([243, 2048])"
]
},
"execution_count": 57,
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tokens = tokenizer.encode(bad_review_text, return_tensors=\"pt\")\n",
"print(f\"Input IDs shape = {tokens.shape}\")\n",
"\n",
"states = model(tokens)\n",
"tensor_final_state = states[-1]\n",
"tensor_final_state.shape\n",
"len(states[0][0])"
"tensor_final_state.shape"
]
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": 59,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Input IDs shape = torch.Size([1, 243])\n"
]
},
{
"data": {
"text/plain": [
"tensor([ 0.3164, -0.3691, 0.0165, ..., -0.0081, 0.0175, -0.0771],\n",
" device='cuda:0', dtype=torch.bfloat16)"
"torch.Size([2048])"
]
},
"execution_count": 53,
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tensor_final_state[-1]"
"tokens = tokenizer.encode(bad_review_text, return_tensors=\"pt\")\n",
"print(f\"Input IDs shape = {tokens.shape}\")\n",
"\n",
"states = model(tokens[0])\n",
"tensor_final_state = states[-1]\n",
"tensor_final_state.shape"
]
}
],
Expand Down