Anthony Weiner, the Democratic former U.S. representative from New York who typed away his career one sext at a time, is scheduled to be released three months early next year from a special medical prison, according to prison records.

Weiner, 54, began serving a 21-month sentence at Federal Medical Center Devens in Ayer, Massachusetts, in November 2017 for transferring obscene material to a minor, in this case a 15-year-old girl. Devens is one of two federal prisons that house sex offenders who volunteer for what the Federal Bureau of Prisons calls "high-intensity programming" to prevent re-offending.

If he were to serve his full sentence, Weiner would be released next August, but his release date has been moved up to May, according to his inmate record on the Bureau of Prisons website.

No reason for the advancement is listed, and the Bureau of Prisons couldn't be reached for comment after hours on Tuesday. Under bureau guidelines, inmates can shave up to 54 days off their sentences for every year they serve for good conduct.

Weiner's attorney, Arlo Devlin-Brown, was out of town on Tuesday and didn't immediately respond to a request for comment.

U.S. District Judge Denise Cote sentenced Weiner, once a rising star in the Democratic Party, in September 2017, saying Weiner's crime resulted from a "very strong compulsion."

Weiner said at his sentencing that "I was a very sick man for a long time," adding: "I have a disease, but I have no excuse."

Weiner's travails got caught up in the presidential campaign of former Secretary of State Hillary Clinton, whose former top aide, Huma Abedin, married Weiner in 2010.

James Comey, then the director of the FBI, announced in October 2016 that he was reopening an investigation of Clinton's use of a private computer server after emails between Clinton and Abedin were found on Weiner's laptop computer.

It wasn't the first time Weiner had been laid low by sending racy texts — he resigned from Congress in 2011 after it emerged that he had sent lewd photos of himself to women online and then lied about it.

Huma Abedin and Anthony Weiner appeared in court in a divorce proceeding in September 2017. Jefferson Siegel / The Daily News via AP

Then, in July 2013, as Weiner was pursuing a comeback by running for mayor of New York, his campaign manager quit after Weiner acknowledged having continued to send raunchy photos and messages to women after he resigned from Congress.

It was his guilty plea last year that was the last straw for Abedin, who had gamely stuck by Weiner through the years of scandal.

Abedin filed for divorce the same day Weiner pleaded guilty last year. In January, the couple withdrew the divorce action and said they would settle the divorce "swiftly and privately" to protect their child.