-
Notifications
You must be signed in to change notification settings - Fork 339
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
7-6_Transformer.ipynb #36
Comments
@HisakaKoji さま ありがとうございます。 colaboratoryで実行されているとのことなので、
などの可能性があるかもしれません どうぞよろしくお願い致します。 現在の最新のAWS環境にて試し、確認
|
ご回答ありがとうございます。 また、素晴らしい著書ありがとうございます。 |
@HisakaKoji さま ありがとうございます。 リンク先のコードを見ましたが、私が分割しているファイルをきれいに一つにまとめていて、 書籍にお褒めの言葉もいただき、著者冥利につきます。 |
以下のところを実行するとエラーになります。
環境は、colaboratory
動作確認
前節のDataLoaderなどを取得
from utils.dataloader import get_IMDb_DataLoaders_and_TEXT
train_dl, val_dl, test_dl, TEXT = get_IMDb_DataLoaders_and_TEXT(
max_length=256, batch_size=24)
ミニバッチの用意
batch = next(iter(train_dl))
モデル構築
net1 = Embedder(TEXT.vocab.vectors)
入出力
x = batch.Text[0]
x1 = net1(x) # 単語をベクトルに
print("入力のテンソルサイズ:", x.shape)
print("出力のテンソルサイズ:", x1.shape)
ValueError Traceback (most recent call last)
in ()
1 from utils.dataloader import get_IMDb_DataLoaders_and_TEXT
2 train_dl, val_dl, test_dl, TEXT = get_IMDb_DataLoaders_and_TEXT(
----> 3 max_length=256, batch_size=24)
4
5 # ミニバッチの用意
/content/pytorch_advanced/7_nlp_sentiment_transformer/utils/dataloader.py in get_IMDb_DataLoaders_and_TEXT(max_length, batch_size)
111 # torchtext.data.Datasetのsplit関数で訓練データとvalidationデータを分ける
112 train_ds, val_ds = train_val_ds.split(
--> 113 split_ratio=0.8, random_state=random.seed(1234))
114
115 # torchtextで単語ベクトルとして英語学習済みモデルを読み込みます
ValueError: not enough values to unpack (expected 2, got 0)
The text was updated successfully, but these errors were encountered: