Transformer models are powerful sequence-to-sequence architectures that are\ncapable of directly mapping speech inputs to transcriptions or translations.\nHowever, the mechanism for modeling positions in this model was tailored for\ntext modeling, and thus is less ideal for acoustic inputs. In this work, we\nadapt the relative position encoding scheme to the Speech Transformer, where\nthe key addition is relative distance between input states in the\nself-attention network. As a result, the network can better adapt to the\nvariable distributions present in speech data. Our experiments show that our\nresulting model achieves the best recognition result on the Switchboard\nbenchmark in the non-augmentation condition, and the best published result in\nthe MuST-C speech translation benchmark. We also show that this model is able\nto better utilize synthetic data than the Transformer, and adapts better to\nvariable sentence segmentation quality for speech translation.\n