First, connect your LineEdit signal, you can choose text_changed if you want to validate everytime user types something on it or text_entered if you want to validate it when user has finished typing.
On your signal function put this:
$LineEdit.text = str(float($LineEdit.text)
This will convert your text to float then reconvert it back to string again. However, it won't tell user "Sorry, number only", if you want to do that then you will have check every character and check their ord.
The ord of 0 is 48 and the ord of 9 is 57. So it will be like this
var text = $LineEdit.text
var i = 0
while text[i] != "":
if ord(text[i]) >= 48 and ord(text[i]) <= 57:
# Do something if current char is a number
print("Sorry, number only")
# Do something if current char is not a number
i += 1