swift-models
swift-models copied to clipboard
Translation example
It'd be great to have a neural machine translation model incorporated into our models repository.
I have started an implementation of Seq2Seq with LSTMs and Attention here. It currently crashes the compiler though (something in the callAsFunction method in the Seq2Seq struct) and I can't find a way around that crash.
@palle-k could you comment in the error in your file? Would be easier to understand if it's API issue or some trivial error
Apparently, there are multiple crashes involved. I have updated the code in my fork and marked the pieces of code that crash the compiler with // MARK: Crash 1 and // MARK: Crash 2 in Seq2Seq/Models.swift starting at line 237.
The relevant pieces are commented out and can be uncommented individually.
Crash 1 seems to occur when an empty if-statement or a empty for-loop is present:
Assertion failed: (pullbackStructElements.count(field) && "Pullback struct element for this field does not exist!"), function getPullbackStructElement, file /Users/swiftninjas/s4tf/swift/lib/SILOptimizer/Mandatory/Differentiation.cpp, line 5127.
Crash 2 seems to occur when a for-loop with a non-empty body is present:
Assertion failed: (lhs->getType() == rhs->getType() && "Adjoints must have equal types!"), function accumulateDirect, file /Users/swiftninjas/s4tf/swift/lib/SILOptimizer/Mandatory/Differentiation.cpp, line 6923.
Also, I'm using the 0.5 release of S4TF.
$ swift --version
Swift version 5.1-dev (LLVM 200186e28b, Swift 1238976565)
Target: x86_64-apple-darwin19.0.0
Apparently, there are multiple crashes involved. I have updated the code in my fork and marked the pieces of code that crash the compiler with
// MARK: Crash 1and// MARK: Crash 2in Seq2Seq/Models.swift starting at line 237.
Thanks for reporting! Both crashers you reported are known issues:
- TF-922:
Assertion failed: (lhs->getType() == rhs->getType() && "Adjoints must have equal types!") - TF-924:
Assertion failed: (pullbackStructElements.count(field) && "Pullback struct element for this field does not exist!")
We'll visit these issues soon, thanks for your patience!