<jupyter_start><jupyter_text>New Section<jupyter_code>%cd /content/drive/My Drive/cs224n/assignment4
!python sanity_check.py 1d
%cd /content/drive/My Drive/cs224n/assignment4
!python sanity_check.py 1e
%cd /content/drive/My Drive/cs224n/assignment4
!python sanity_check.py 1f
tt1 = torch.tensor(([[1,2,3],
                     [2,3,4]]))  #(b, h) = (2, 3)
print('tt1 shape ', tt1.shape , '\n', tt1)


#(b, src_len, h) = (2, 4, 3)
tt2 = torch.tensor(([[[1,2,3],
                      [2,5,1],
                      [1,3,4],
                      [3,6,8]],
                     
                     [[2,3,4],
                      [5,1,8],
                      [3,4,6],
                      [6,8,4]]]))
print('tt2 shape ', tt2.shape, '\n', tt2)

print('tt1 unsqueeze at dim=2\n', tt1.unsqueeze(2))

# tt1_dot_tt2 = torch.bmm(tt1.unsqueeze(2), tt2)
# error: RuntimeError: Expected tensor to have size 1 at dimension 1, 
# but got size 4 for argument #2 'batch2' (while checking arguments for bmm)

tt1_dot_tt2 = torch.bmm(tt2, tt1.unsqueeze(2))
print("tt1 dott tt2\n", tt1_dot_tt2)

tt1_dot_tt2.squeeze()
%cd /content/drive/My Drive/cs224n/assignment4
!sh run.sh vocab
%cd /content/drive/My Drive/cs224n/assignment4
!sh run.sh train_local
%pip install -r gpu_requirements.txt
%cd /content/drive/My Drive/cs224n/assignment4
!sh run.sh train
%cd /content/drive/My Drive/cs224n/assignment4
!sh run.sh test
# b= 1, h = 256, h*2 = 512, src_len = 31

# Ybar_t [1, 512], expect (b, e+h)
# dec_state [1, 256], expect (b, h)
# dec_cell [1, 256], expect (b, h)
# exp_src_encodings [1, 31, 512], expect (b, src_len_h*2)
# exp_src_encodings_att_linear [1, 31, 512], expect (b, src_len)<jupyter_output>/content/drive/My Drive/cs224n/assignment4
[nltk_data] Downloading package punkt to /root/nltk_data...
[nltk_data]   Package punkt is already up-to-date!
load test source sentences from [./en_es_data/test.es]
load test target sentences from [./en_es_data/test.en]
load model from model.bin
Decoding:   0% 0/8064 [00:00<?, ?it/s]/pytorch/aten/src/ATen/native/BinaryOps.cpp:81: UserWarning: Integer division of tensors using div or / is deprecated, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.
Decoding: 100% 8064/8064 [06:33<00:00, 20.51it/s]
Corpus BLEU: 35.60026767967568
{'fraction_non_alphanumeric': 0.14767392232180965, 'fraction_numerical': 0.08109261630388391, 'mean_word_length': 3.17825311942959, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '311271', 'license': 'Apache-2.0', 'n_tokens_mistral': 1022, 'n_tokens_neox': 922, 'n_words': 232, 'path': 'Assignments/assignment4/Herais/hw4.ipynb', 'repo_name': 'stxxllbu/CS224n-winter-together', 'size': '2343'}