Learning Generalizable Models for Compliant Robots