kcxain / dlsys

My solutions to the assignments of CMU 10-714 Deep Learning Systems 2022
https://kkee.top/docs/project/dlsys
34 stars 2 forks source link

hw4 Penn Treebank dataset `batchify` #3

Open yofufufufu opened 4 months ago

yofufufufu commented 4 months ago

https://github.com/kcxain/dlsys/blob/0ce32e1322a268ab0d6b64156dd1e62b0bb834c3/hw4/python/needle/data/datasets/ptb_dataset.py#L91-L110 您好,想请教一下batchify的实现是否有误?按照您的实现,返回的结果为: a b c d e f g h ... 此外,我对最后的language_model_training 官方提供的test有些疑惑: https://github.com/kcxain/dlsys/blob/0ce32e1322a268ab0d6b64156dd1e62b0bb834c3/hw4/tests/hw4/test_sequence_models.py#L238-L243 str(device)的值为cpu()cuda(),因此无论结果如何都能通过这个test. 我采用您的训练函数,把判断改为if str(device) == "cpu()": 后,会发现loss很大,无法通过测试。