Within the talmud, is the Torah as an entity referred to with with a particular gender and if so are there exceptions?
The noun has to be gendered, as Semitic languages like the Talmuds' Aramaic and Hebrew have no neuter nouns.
"Torah" is a feminine noun. But "Sefer" (book -- whether bound pages or a scroll) is a masculine one. So that "Sefer Torah", is a masculine idiom, since the noun is "sefer" and "Torah" just modifying it.
Which leads to this interesting contrast between verses.
גַּ֤ם כׇּל־חֳלִי֙ וְכׇל־מַכָּ֔ה אֲשֶׁר֙ לֹ֣א כָת֔וּב בְּסֵ֖פֶר הַתּוֹרָ֣ה הַזֹּ֑את יַעְלֵ֤ם יְהֹוָה֙ עָלֶ֔יךָ עַ֖ד הִשָּׁמְדָֽךְ׃
Also every sickness and every plague which is not written in this (הזאת, feminine) Seifer Torah, Hashem will raised against you until you are destroyed.
וְהִבְדִּיל֤וֹ ה֙' לְרָעָ֔ה מִכֹּ֖ל שִׁבְטֵ֣י יִשְׂרָאֵ֑ל כְּכֹל֙ אָל֣וֹת הַבְּרִ֔ית הַכְּתוּבָ֕ה בְּסֵ֥פֶר הַתּוֹרָ֖ה הַזֶּֽה׃
Hashem will single them out from all the tribes of Israel for misfortune, in accordance with all the sanctions of the covenant recorded in this (הזה, masculine) book of Torah.
Rashi on the latter verse notes the difference in gender, and explains that the difference is in the trop. In the first case, there is a tipecha on the word "בְּסֵ֖פֶר - basefer / in the book" (look under the ס), distancing it a bit from the word "Torah". This "this" is the Torah, so it is "zos", in the feminine. In the second case, the בְּסֵ֥פֶר הַתּוֹרָ֖ה are joined -- basefer getting a mercha and only "Torah" getting the tipecha. The "this" is "Sefer Torah", not just "Torah".
I don't know any exception to the above in the Talmuds. (Although I don't think the text that we have of the Talmud Yerushalmi is stable or original enough that we could analyze a detail like the gender used in a quote.)
The word "Torah" is a feminine noun in Hebrew, indeed it follows the classic feminine Hebrew pattern of ending in the letter "ה ". As proof, please see the linked article which cites a popular phrase "v'zot HaTorah" ("and this is the Torah") using zot, the feminine form for the word for this rather than ze, the masculine form: https://torah.org/torah-portion/mikra-5771-vaeschanan/