Is there any mention as to how long Ratnakar who was a hunter and thief did penance to wash off his sins and become a sage called Valmiki ??
20,000 years according to Kṛttivāsa Rāmāyaṇa.
The name of Rāma was given by Brahmā to Ratnākara (for recitation) at a place, where he recited the said name for sixty thousand years§, seated at a place in an āsana. All his limbs were eaten away by white-ants and he became a skeleton, because all the flesh was consumed by the white-ants. Thus the bones remained without the flesh, on which the dust accumulated over which the grass bushes and kuśā were grown. Under that mound of earth Ratnākara was lodged reciting the name of Rāma.
After the lapse of twenty thousand years, Brahmā again visited that place. There was no trace of the human body, but from the mouth the sound of Rāma was emerging. (By this), Brahmā could know of the presence of Ratnākara.
For seven days there was continuous rain showered by Indra at the instance of Brahmā. With the continuous rain, the entire earth was washed away and there appeared the skeleton of Ratnākara who regained consciousness at the command of Brahmā. The sage then bowed in reverence to Brahmā and gratefully acknowledged that he had bestowed on him the boon of Rāma's name.
Brahmā spoke to the sage, "Upto now, you were known as Ratnākara, but henceforth you shall be known as Vālmīki. The name of Rāma has purified you, therefore, you will create his Rāmāyaṇa in seven kāṇḍas. Vālmīki, then spoke with humility, 'I am quite an illiterate person having no knowledge of Kāvyas and Chandas: how can I create literature?"
Brahmā, on hearing the words of Vālmīki spoke to him, "Sarasvatī resides in your tongue and as such you will be able to create the Kāvya quite easily, whatever verses you will create, will be devoted to Rāma in the universe." Awarding the boon to Vālmīki, Brahmā went to his abode; Vālmīki was immensely pleased (by his achievement) and Kṛttivāsa recited this (part of) Divya Ādikāṇḍa. (3)
§ The reference to 60,000 years in the first paragraph is probably about Brahmā's own penance.