Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- 1_Pooling/config.json +10 -0
- README.md +834 -0
- config.json +49 -0
- config_sentence_transformers.json +14 -0
- configuration.py +145 -0
- model.safetensors +3 -0
- modeling.py +1418 -0
- modules.json +20 -0
- optimizer.pt +3 -0
- rng_state.pth +3 -0
- scheduler.pt +3 -0
- sentence_bert_config.json +4 -0
- special_tokens_map.json +51 -0
- tokenizer.json +3 -0
- tokenizer_config.json +55 -0
- trainer_state.json +327 -0
- training_args.bin +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
1_Pooling/config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"word_embedding_dimension": 768,
|
| 3 |
+
"pooling_mode_cls_token": true,
|
| 4 |
+
"pooling_mode_mean_tokens": false,
|
| 5 |
+
"pooling_mode_max_tokens": false,
|
| 6 |
+
"pooling_mode_mean_sqrt_len_tokens": false,
|
| 7 |
+
"pooling_mode_weightedmean_tokens": false,
|
| 8 |
+
"pooling_mode_lasttoken": false,
|
| 9 |
+
"include_prompt": true
|
| 10 |
+
}
|
README.md
ADDED
|
@@ -0,0 +1,834 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ibaba-NLP/gte-multilingual-base
|
| 11 |
+
widget:
|
| 12 |
+
- source_sentence: "TRIBUNAL DE JUSTIÇA DO ESTADO DO RIO DE JANEIRO\neJUD TJRJ\n15/01/2024\
|
| 13 |
+
\ 14:44\nEmitido em:\nSECRETARIA DA 7ª CÂMARA DE DIREITO PÚBLICO\nProcesso: 0100621-07.2017.8.19.0001\
|
| 14 |
+
\ - APELAÇÃO\nINTIMAÇÃO ELETRÔNICA\nRio de Janeiro, 15 de janeiro de 2024\nFica\
|
| 15 |
+
\ V. Sª / V. Exª intimado da determinação abaixo:\nApelante: Centro de Estudos\
|
| 16 |
+
\ Jurídicos da Defensoria Pública Geral do Estado do Rio de Janeiro \nApelado\
|
| 17 |
+
\ 1: Estado do Rio de Janeiro \nApelado 2: Município do Rio de Janeiro\nRelator:\
|
| 18 |
+
\ Des. Maria Christina Berardo Rücker\nDECISÃO MONOCRÁTICA\nAPELAÇÃO CÍVEL. DIREITO\
|
| 19 |
+
\ CONSTITUCIONAL. MEDICAMENTOS. MORTE DO AUTOR. EXTINÇÃO\nSEM APRECIAÇÃO DO MÉRITO.\
|
| 20 |
+
\ SUCUMBÊNCIA. FALHA DO PODER PÚBLICO NA GARANTIA DO\nDIREITO FUNDAMENTAL À SAÚDE.\
|
| 21 |
+
\ PRINCÍPIO DA CAUSALIDADE. PEQUENO REPARO NO\nPRONUNCIAMENTO, PARA CONDENAR AMBOS\
|
| 22 |
+
\ OS RÉUS AO PAGAMENTO DE HONORÁRIOS\nSUCUMBENCIAIS. \n1. Sentença que julgou\
|
| 23 |
+
\ extinta a ação em que se buscava tratamento médico e exames, diante da morte\
|
| 24 |
+
\ do autor e\nda ausência de habilitação de herdeiros, condenado o demandante\
|
| 25 |
+
\ ao pagamento do ônus sucumbencial, observada\na gratuidade de justiça. \n2.\
|
| 26 |
+
\ O Superior Tribunal de Justiça entende que, nas hipóteses de extinção do processo\
|
| 27 |
+
\ sem resolução do mérito,\ndecorrente de perda de objeto superveniente ao ajuizamento\
|
| 28 |
+
\ da ação, a parte que deu causa à instauração do\nprocesso deverá suportar o\
|
| 29 |
+
\ pagamento dos honorários advocatícios. \n3. Evidente falha do Poder Público\
|
| 30 |
+
\ no cumprimento de seu dever solidário na garantia do direito fundamental à\n\
|
| 31 |
+
saúde, expresso no Enunciado nº 65 deste Tribunal de Justiça, o que ensejou a\
|
| 32 |
+
\ propositura da presente demanda."
|
| 33 |
+
sentences:
|
| 34 |
+
- "Poder Judiciário do Estado do Rio de Janeiro \nDécima Primeira Câmara Cível \n\
|
| 35 |
+
\ \n \n \n \n \n \n \nSecretaria da Décima Primeira Câmara Cível \nRua Dom Manuel\
|
| 36 |
+
\ nº 37 \nCentro – Rio de Janeiro/RJ \nJr \n \n \nRELATÓRIO \n \n \nTrata-se\
|
| 37 |
+
\ de Embargos de Declarações opostos por\n Geysa Conceição \nNascimento Laurino\
|
| 38 |
+
\ e Outros\n , às fls.290/292, e, pelo \nMunicípio do Rio de Janeiro\n \ncontra\
|
| 39 |
+
\ o v. acórdão de fls. 257/266. \n \nAduzem as primeiras Embargantes que houve\
|
| 40 |
+
\ omissão no julgado, uma vez \nque não foi apreciado o requerimento de deferimento\
|
| 41 |
+
\ da gratuidade de Justiça \nformulada no apelo. \n \nRequerem, por final, seja\
|
| 42 |
+
\ conhecido e provido o recurso para que seja \nsanada a omissão apontada, dando-se\
|
| 43 |
+
\ efeitos infringentes ao julgado, a fim de que \nseja deferido o requerimento\
|
| 44 |
+
\ da gratuidade de justiça formulado. \n \nAlega o segundo Embargante que houve\
|
| 45 |
+
\ omissão e contradição no v. \nacórdão, tendo o julgado contrariado o art. 169,\
|
| 46 |
+
\ § 1º, I e II da Carta Magna. Que, \ninexiste previsão legal que ampare o pleito\
|
| 47 |
+
\ autoral. Que o v. acórdão violou texto \nconstitucional, e, por analogia a Súmula\
|
| 48 |
+
\ 37 do Pretório Excelso. \n \nRequer, por final, seja conhecido e provido os\
|
| 49 |
+
\ embargos declaratórios, para \nque sejam sanadas as contradições e omissões\
|
| 50 |
+
\ apontadas, com os efeitos daí \ndecorrentes, notadamente a contrariedade\
|
| 51 |
+
\ ao art. 169, § 1º, I e II do texto \nconstitucional, além dos arts.1º; 2º;\
|
| 52 |
+
\ 5º, II; 18 e 37 do Texto Constitucional e por"
|
| 53 |
+
- "26/05/1994. \nIII. O Tribunal de origem, com base no exame dos \nelementos fáticos\
|
| 54 |
+
\ dos autos e das cláusulas do \ncontrato \nfirmado \nentre \nas \npartes, \n\
|
| 55 |
+
concluiu que, \"considerando também a inexistência \nde aditivo contratual posterior\
|
| 56 |
+
\ que estabeleça a \npossibilidade de atualização monetária -, é de se \nconcluir\
|
| 57 |
+
\ que a avença deve ser cumprida nos \ntermos pactuados e anuídos pelas partes\
|
| 58 |
+
\ (neles \nincluídos os valores constantes nas tabelas da \nOrdem \nde \nServiço\
|
| 59 |
+
\ \nINSS/PG \nn° \n17/1994, \nestipulados de acordo com o novo ambiente de \n\
|
| 60 |
+
estabilização \neconômica)\". \nIV. Assim, nos termos em que a causa fora decidida,\
|
| 61 |
+
\ \ninfirmaras conclusões do julgado ? de que inexistiria \nprevisão \ncontratual\
|
| 62 |
+
\ \nde \nreajuste dos serviços advocatícios ? demandaria, \nnecessariamente, \n\
|
| 63 |
+
a análise das cláusulas do \nreferido contrato, bem como a incursão no \nconteúdo\
|
| 64 |
+
\ fático-probatório dos autos, o que é \nvedado, em sede de Recurso Especial,\
|
| 65 |
+
\ em razão \ndos óbices das Súmulas 5 e 7 do STJ\n, \n328"
|
| 66 |
+
- "TRIBUNAL DE JUSTIÇA DO ESTADO DO RIO DE JANEIRO\neJUD TJRJ\n15/01/2024 14:44\n\
|
| 67 |
+
Emitido em:\n \n(...) Assim, tendo em vista o falecimento do Autor\
|
| 68 |
+
\ (certidão de óbito de fl.273), bem como a certidão de inércia de\nmanifestação\
|
| 69 |
+
\ de possíveis sucessores a se habilitarem no feito às f. 295 e da diligência\
|
| 70 |
+
\ negativa às f, 281/282, já\ntendo transcorrido anos do óbito sem qualquer habilitação\
|
| 71 |
+
\ de herdeiros, forçoso reconhecer a falta de pressuposto\nprocessual (existência\
|
| 72 |
+
\ de parte), de forma que JULGO EXTINTO O PROCESSO, SEM APRECIAÇÃO DO\nMÉRITO,\
|
| 73 |
+
\ na forma do Art. 485, IV, do CPC. \n \nCustas e honorários de 10% sobre o valor\
|
| 74 |
+
\ da causa pela autora, com exigibilidade suspensa face a gratuidade de\njustiça\
|
| 75 |
+
\ deferida. Certificado o trânsito em julgado, diligencie-se como de praxe para\
|
| 76 |
+
\ fins de baixa e arquivamento.\nP.I. \n Em suas razões, a DEFENSORIA\
|
| 77 |
+
\ PÚBLICA reitera que os réus deram causa à demanda, de forma que\ndevem ser condenados\
|
| 78 |
+
\ ao pagamento dos honorários sucumbenciais (índex 326).\n \n \
|
| 79 |
+
\ Contrarrazões pelo Estado (índex 341).\n \n Sem contrarrazões\
|
| 80 |
+
\ pelo Município (índex 349). \n \n Parecer da d. Procuradoria\
|
| 81 |
+
\ de Justiça pelo provimento do recurso (índex 360).\n \n \
|
| 82 |
+
\ Decisão proferida pela i. relatora originária, em que declinada a competência\
|
| 83 |
+
\ em favor de uma das Câmaras\nde Direito Público deste Tribunal de Justiça (índex\
|
| 84 |
+
\ 365).\n \n \n É o relatório. Decido. \n \
|
| 85 |
+
\ \n Presentes os requisitos intrínsecos e extrínsecos de admissibilidade,\
|
| 86 |
+
\ conheço da apelação. \n \n As partes controvertem neste\
|
| 87 |
+
\ recurso tão somente quanto aos honorários sucumbenciais devidos em virtude\n\
|
| 88 |
+
da extinção do feito, em que se buscava tratamento médico e exames, diante da\
|
| 89 |
+
\ morte do autor e da ausência de"
|
| 90 |
+
- source_sentence: "Poder Judiciário do Estado do Rio de Janeiro \nGabinete da Terceira\
|
| 91 |
+
\ Vice-Presidência \n \n_______________________________________________________________________________\
|
| 92 |
+
\ \n \n__________________________________________________________________________________________________\
|
| 93 |
+
\ \n \nAv. Erasmo Braga, 115 –11º andar – Lâmina II - Centro – Rio de Janeiro/RJ\
|
| 94 |
+
\ \n \nCEP 20020-903 - Tel.: + 55 21 3133-4103 - e-mail: [email protected]\
|
| 95 |
+
\ \n \nRecurso Especial Cível nº 0106806-90.2019.8.19.0001 \nRecorrente: \nMUNICÍPIO\
|
| 96 |
+
\ DO RIO DE JANEIRO \nRecorrido: \nESPÓLIO \nDE \nFLÁVIO \nAUGUSTO \nSALLES \n\
|
| 97 |
+
NOBRE \nREP/P/S/INVENTARIANTE EDUARDO FARIAS VASQUEZ \n \n \nDECISÃO \n \n \n\
|
| 98 |
+
Trata-se de recurso especial tempestivo, fls. 300/310, com fundamento \nno artigo\
|
| 99 |
+
\ 105, inciso III, alínea “a”, da Constituição Federal, interposto em face dos\
|
| 100 |
+
\ \nacórdãos da Quinta Câmara de Direito Privado (antiga Vigésima Quarta Câmara\
|
| 101 |
+
\ \nCível), fls. 244/253 e 287/296, assim ementados: \n \n“APELAÇÃO \n \nCÍVEL.\
|
| 102 |
+
\ \n \nDIREITO \nADMINISTRATIVO. AÇÃO DE ANULAÇÃO DE \nDÉBITO FISCAL. RETIFICAÇÃO\
|
| 103 |
+
\ DA TIPOLOGIA \nDO IMÓVEL NO CADASTRO DE IPTU. \nREVISÃO DO LANÇAMENTO\
|
| 104 |
+
\ DE IPTU DOS \nEXERCÍCIOS \nDE \n2013 \nA \n2018, \nGERANDO \nCOBRANÇA COMPLEMENTAR.\
|
| 105 |
+
\ SENTENÇA DE \nPROCEDENCIA. IRRESIGNAÇÃO DO MUNICIPIO \nREU. RETROATIVIDADE\
|
| 106 |
+
\ DA EXAÇÃO AO \nARGUMENTO DE QUE HOUVE ERRO DE \nFATO."
|
| 107 |
+
sentences:
|
| 108 |
+
- "5 \nobrigações do beneficiário. Impossibilidade de reserva de \nhonorários em\
|
| 109 |
+
\ razão das Agravadas serem beneficiárias \nde gratuidade de justiça. RECURSO\
|
| 110 |
+
\ DESPROVIDO. \n(0051040-89.2018.8.19.0000 \n- \nAGRAVO \nDE \nINSTRUMENTO -\
|
| 111 |
+
\ Des(a). DENISE NICOLL SIMÕES - \nJulgamento: 30/10/2018 - QUINTA CÂMARA CÍVEL)\
|
| 112 |
+
\ \n \nAGRAVO DE INSTRUMENTO. REVOGAÇÃO DO \nBENEFÍCIO DE GRATUIDADE DE JUSTIÇA\
|
| 113 |
+
\ NO \nCURSO \nDA \nFASE \nDE \nCUMPRIMENTO \nDE \nSENTENÇA. 1.O fato de a agravante\
|
| 114 |
+
\ ter se tornado \ncredora de quantia objeto de execução, por si só, não é \n\
|
| 115 |
+
suficiente para se concluir como desatendidos os \npressupostos para a fruição\
|
| 116 |
+
\ do benefício em questão. 2.A \nrevogação do benefício da gratuidade de justiça\
|
| 117 |
+
\ com base \nno recebimento da indenização resultaria em desatenção \nao princípio\
|
| 118 |
+
\ da restitutio in integrum. RECURSO \nPROVIDO, NA FORMA DO ART. 557, §1º-A, CPC.\
|
| 119 |
+
\ \n(0069223-16.2015.8.19.0000 \n- \nAGRAVO \nDE \nINSTRUMENTO - Des(a). FERNANDO\
|
| 120 |
+
\ CERQUEIRA \nCHAGAS - Julgamento: 10/03/2016 - DÉCIMA PRIMEIRA \nCÂMARA CÍVEL)\
|
| 121 |
+
\ \n \nAPELAÇÃO CÍVEL. IMPUGNAÇÃO À GRATUIDADE \nDE \nJUSTIÇA. \nVALORES \n\
|
| 122 |
+
RECEBIDOS \nPELA \nAPELADA \nDECORRENTES \nDE \nAÇÃO \nINDENIZATÓRIA \nPROPOSTA\
|
| 123 |
+
\ \nEM \nFACE \nDA \nAPELANTE \nQUE \nNÃO \nDESCARACTERIZA \nA \nHIPOSSUFICIÊNCIA\
|
| 124 |
+
\ ECONÔMICA. RECURSO A \nQUE SE NEGA PROVIMENTO, NA FORMA DO ART. \n1436"
|
| 125 |
+
- "Poder Judiciário do Estado do Rio de Janeiro\n \nGabinete da Terceira Vice-Presidência\n\
|
| 126 |
+
\ \n \n \nAv. Erasmo Braga, 115 –11º andar – Lâmina II\n \nCentro – Rio de Janeiro/RJ\
|
| 127 |
+
\ – CEP 20020-903\n \nTel.: + 55 21 3133-4103 e-mail: [email protected]\n\
|
| 128 |
+
\ \ntendo sequer apresentado contrarrazões ao presente \nrecurso. (...)”\n \n\
|
| 129 |
+
\ \n \nVerifica-se que o colegiado concluiu pela responsabilidade da recorrente\
|
| 130 |
+
\ \npelo exame dos fatos e provas dos autos bem como pela relação negocial entre\
|
| 131 |
+
\ as \npartes o que esbarra no óbice da \nSúmula n° 7 do STJ\n (“A pretensão de\
|
| 132 |
+
\ simples \nreexame de prova não enseja recurso especial”; Corte Especial; julgado\
|
| 133 |
+
\ em \n28/06/1990; DJ 03/07/1990) bem como da \nSúmula n° 5\n \ndo STJ\n (“A SIMPLES\
|
| 134 |
+
\ \nINTERPRETAÇÃO DE CLAUSULA CONTRATUAL NÃO ENSEJA RECURSO \nESPECIAL”; Corte\
|
| 135 |
+
\ Especial; julgado em 10/05/1990; DJ 21/05/1990, p. 4407). Neste \nsentido:\n\
|
| 136 |
+
\ \n \n \n \n \n“\nPROCESSUAL \nCIVIL. \nAGRAVO \nINTERNO \nNO \nAGRAVO EM RECURSO\
|
| 137 |
+
\ ESPECIAL. REEXAME DE \nFATOS E PROVAS. SÚMULA 7 DO SUPERIOR \nTRIBUNAL DE JUSTIÇA.\n\
|
| 138 |
+
\ \n1. \nNão cabe, em recurso especial, reexaminar \nmatéria de fato (Súmula 7/STJ).\n\
|
| 139 |
+
\ \n2. Agravo interno a que se nega provimento.\n \n(AgInt no AgRg no AREsp 830.868/RS,\
|
| 140 |
+
\ Rel. Ministra \nMARIA ISABEL GALLOTTI, QUARTA TURMA, julgado \nem 18/10/2016,\
|
| 141 |
+
\ DJe 21/10/2016)”"
|
| 142 |
+
- "Poder Judiciário do Estado do Rio de Janeiro \nGabinete da Terceira Vice-Presidência\
|
| 143 |
+
\ \n \n_______________________________________________________________________________\
|
| 144 |
+
\ \n \n__________________________________________________________________________________________________\
|
| 145 |
+
\ \n \nAv. Erasmo Braga, 115 –11º andar – Lâmina II - Centro – Rio de Janeiro/RJ\
|
| 146 |
+
\ \n \nCEP 20020-903 - Tel.: + 55 21 3133-4103 - e-mail: [email protected]\
|
| 147 |
+
\ \n \nMATÉRIAS \nSUSCITADAS \nQUE \nFORAM \nOSTENSIVAMENTE \nDEBATIDAS \nNO \
|
| 148 |
+
\ \nJULGAMENTO DA APELAÇÃO – VEICULAÇÃO \nDE MERA IRRESIGNAÇÃO – BUSCA DE\
|
| 149 |
+
\ NOVO \nJULGAMENTO COM REAPRECIAÇÃO DO \nMÉRITO – IMPOSSIBILIDADE POR VIA\
|
| 150 |
+
\ DE \nEMBARGOS DE DECLARAÇÃO – PRÉ-\nQUESTIONAMENTO FICTO (ART. 1.025,\
|
| 151 |
+
\ CPC) - \nRECURSO REJEITADO. 1. Os embargos de declaração \nsão recurso de\
|
| 152 |
+
\ fundamentação vinculada, sendo cabíveis \ntão somente para esclarecer\
|
| 153 |
+
\ obscuridade, eliminar \ncontradição, suprir omissão ou corrigir erro material\
|
| 154 |
+
\ na \ndecisão embargada (art. 1.022, inc. I a III, do CPC). 2. In \ncasu, \
|
| 155 |
+
\ inexistem os vícios alegados pela embargante na \npetição de interposição\
|
| 156 |
+
\ dos aclaratórios, revelando-se o \nclaro intento de reexame da controvérsia\
|
| 157 |
+
\ diante de \nsimples irresignação quanto à solução jurídica oferecida, à \n\
|
| 158 |
+
unanimidade, pelo órgão colegiado. 3. Desamparados por \nomissão, contradição,\
|
| 159 |
+
\ obscuridade ou erro material na \ndecisão recorrida, os embargos de declaração\
|
| 160 |
+
\ não são via \nprópria ao novo julgamento da causa. Precedentes do"
|
| 161 |
+
- source_sentence: "SEABRA, BALTZ & PEREIRA – ADVOGADOS ASSOCIADOS \nRua Senador Dantas\
|
| 162 |
+
\ n. 117 – sala 2140, Centro, Rio de Janeiro – RJ. \nCel. e WhatsApp: (21) 9.9583-0991\
|
| 163 |
+
\ \n \nEXMO. SR. DR. DESEMBARGADOR 3º VICE-PRESIDENTE DO EGRÉGIO \nTRIBUNAL DE\
|
| 164 |
+
\ JUSTIÇA DO ESTADO DO RIO DE JANEIRO \n \n \nProcesso nº\n 0124238-45.2007.8.19.0001\
|
| 165 |
+
\ \nPrioridade: \nPessoa Idosa\n \nELIZABETH GUIMARÃES COSTA\n, \nbeneficiária\
|
| 166 |
+
\ da gratuidade de \njustiça\n, conforme fls. 62 (índex 64), já qualificada, nos\
|
| 167 |
+
\ autos do processo em epígrafe, \nAÇÃO DE CONSIGNAÇÃO EM PAGAMENTO, movida em\
|
| 168 |
+
\ face do \nINSTITUTO DE \nPREVIDÊNCIA DO MUNICÍPIO DO RIO DE JANEIRO – PREVRIO\n\
|
| 169 |
+
, igualmente \nqualificado, \nvem \npor \nseu \nadvogado \ninfra-assinado, \n\
|
| 170 |
+
tempestivamente, \napresentar: \nCONTRARRAZÕES AO RECURSO ESPECIAL \n \noposto\
|
| 171 |
+
\ contra o R. Acórdão de fls. 698/702, conforme fls. 704/716, nos \ntermos das\
|
| 172 |
+
\ razões em anexo. \nIsto \nposto, \nrequerer \nque \nsejam \nencaminhadas \n\
|
| 173 |
+
estas \ncontrarrazões ao Egrégio Superior Tribunal de Justiça, fazendo-as, segundo\
|
| 174 |
+
\ \na fundamentação anexada e requerendo, desde já, que seja o presente \npetitório\
|
| 175 |
+
\ recebido regularmente, processado e remetido àquela Corte \nSuperior do Poder\
|
| 176 |
+
\ Judiciário. \nTermos em que \nPede Deferimento. \nRio de Janeiro, 20 de março\
|
| 177 |
+
\ de 2024. \n \nPEDRO LUIZ B. S. F. S. PEREIRA \nOAB-RJ n.º 119.021 \nTJRJ 202400222539\
|
| 178 |
+
\ 20/03/2024 22:30:00 KRCI - PETIÇÃO ELETRÔNICA Assinada por PEDRO LUIZ BALTAZAR\
|
| 179 |
+
\ SA FREIRE SEABRA PEREIRA\n728"
|
| 180 |
+
sentences:
|
| 181 |
+
- "SEABRA, BALTZ & PEREIRA – ADVOGADOS ASSOCIADOS \nRua Senador Dantas n. 117 –\
|
| 182 |
+
\ sala 2140, Centro, Rio de Janeiro – RJ. \nCel. e WhatsApp: (21) 9.9583-0991\
|
| 183 |
+
\ \n \nAdemais, na aplicação da lei, o juiz atenderá aos fins sociais a \nque\
|
| 184 |
+
\ ela se dirige e também às exigências do bem comum, conforme dispõe o \nart.\
|
| 185 |
+
\ 5º da Lei de Introdução às Normas do Direito Brasileiro. \nDestarte, na aplicação\
|
| 186 |
+
\ da aludida norma, há que se a ter ao \nseu fim social almejado, qual seja, dar\
|
| 187 |
+
\ moradia digna, conforme deseja o \nintuito do legislador da CF/88. \nAssim,\
|
| 188 |
+
\ não só se atende ao disposto no art. 5º XXIII da CRFB, \ncomo o princípio da\
|
| 189 |
+
\ dignidade da pessoa, disposto no art. 1º, III da mesma \nCarta Magna. \nA recorrente\
|
| 190 |
+
\ não se ateve a finalidade da referida norma, pois, \nao não a observar, propiciou\
|
| 191 |
+
\ o desequilíbrio contratual, já que a dívida não \nfoi reduzida ao logo do seu\
|
| 192 |
+
\ pagamento. \nExtrai-se disso, que há uma onerosidade excessiva, que lesa \n\
|
| 193 |
+
não somente o patrimônio da recorrente, mas sua dignidade, frustrando o \ndesiderato\
|
| 194 |
+
\ constitucional, como já narrado. \nDessa onerosidade excessiva há um plus, o\
|
| 195 |
+
\ qual se traduz em \nenriquecimento sem causa, já que por mais que se pagasse\
|
| 196 |
+
\ as prestações, a \ndívida não se reduz. \nO ônus excessivo está em desacordo\
|
| 197 |
+
\ não só com o equilíbrio \ncontratual, como lesa a boa-fé objetiva que deveria\
|
| 198 |
+
\ margear o contrato. \nA parte hipossificiente, que é a recorrida, a qual não\
|
| 199 |
+
\ possui \nqualquer gerência para renegociação das cláusulas contratuais, quando\
|
| 200 |
+
\ \nestas deveriam, ser interpretadas de maneira mais favorável ao consumidor\
|
| 201 |
+
\ \nsegundo a luz do art. 47 do CDC. \nUm dos direitos básicos é a modificação\
|
| 202 |
+
\ das cláusulas \ncontratuais que estabeleçam prestações desproporcionais ou sua\
|
| 203 |
+
\ revisão em \nrazão de fatos supervenientes que as tornem excessivamente onerosas\
|
| 204 |
+
\ (art. \n6º, V, CDC). \n744"
|
| 205 |
+
- "TRIBUNAL DE JUSTIÇA DO RIO DE JANEIRO\neJUD TJRJ\n19/03/2021 13:05\nEmitido em:\n\
|
| 206 |
+
RECURSO ESPECIAL. EMBARGOS DE DECLARAÇÃO. ALEGADA VIOLAÇÃO DO ART. 535 DO CPC.\n\
|
| 207 |
+
INEXISTÊNCIA. AUSÊNCIA DAS HIPÓTESES DE CABIMENTO. CERTIDÃO DE DÍVIDA ATIVA.\n\
|
| 208 |
+
PRESUNÇÃO DE CERTEZA E LIQUIDEZ NÃO ELIDIDA NA INSTRUÇÃO PROBATÓRIA. DECISÃO\n\
|
| 209 |
+
FUNDAMENTADA NA PROVA DOS AUTOS. 1. A omissão que enseja o cabimento dos embargos\
|
| 210 |
+
\ de\ndeclaração é aquela existente em relação aos questionamentos aos quais o\
|
| 211 |
+
\ julgador deveria se pronunciar, e não em\nrelação àqueles que a parte quer ver\
|
| 212 |
+
\ julgados. 2. A contradição permissiva da oposição de embargos de declaração\n\
|
| 213 |
+
é a que se faz presente dentro da própria decisão, e não quanto aos argumentos\
|
| 214 |
+
\ ou provas apresentadas pelas partes.\n3. A obscuridade passível de correção\
|
| 215 |
+
\ é a que se detecta no texto da decisão, referente à falta de clareza, sem\n\
|
| 216 |
+
relação com a análise das provas dos autos. 4. Ausência de violação do art. 535\
|
| 217 |
+
\ do Código de Processo Civil.\nDecisões proferidas com base nas provas dos autos.\
|
| 218 |
+
\ 5. Recurso especial não provido. (REsp 928.075/PE, Rel.\nMinistro CASTRO MEIRA,\
|
| 219 |
+
\ SEGUNDA TURMA, julgado em 04/09/2007, DJ 18/09/2007, p. 290)\n No que\
|
| 220 |
+
\ tange à instauração do incidente de inconstitucionalidade, requerida pelo apelante,\
|
| 221 |
+
\ com referência ao\nartigo 6º, inciso I, da Lei Municipal nº 3.720/2004, trata-se\
|
| 222 |
+
\ de questão analisada no acórdão embargado, que se\napresentou adequadamente\
|
| 223 |
+
\ fundamentado ao rejeitá-la. \n Ademais, a rigor, apenas se imporia a\
|
| 224 |
+
\ instauração do referido incidente na hipótese em que o Órgão\nFracionário entendesse\
|
| 225 |
+
\ pela existência do vício suscitado pela parte, o que, neste caso, não ocorre,\
|
| 226 |
+
\ visto que o"
|
| 227 |
+
- "TRIBUNAL DE JUSTIÇA DO RIO DE JANEIRO\neJUD TJRJ\n28/04/2022 10:19\nEmitido em:\n\
|
| 228 |
+
extraordinário, quando não ventilada, na decisão recorrida, a questão federal\
|
| 229 |
+
\ suscitada\") e 356 (\"O ponto omisso da\ndecisão, sobre o qual não foram opostos\
|
| 230 |
+
\ embargos declaratórios, não pode ser objeto de recurso extraordinário, por\n\
|
| 231 |
+
faltar o requisito do prequestionamento\") da súmula da jurisprudência do STF.\
|
| 232 |
+
\ \n \n Ainda que assim não fosse, verifica-se que o v.\
|
| 233 |
+
\ Acórdão recorrido decidiu a lide valendo-se de\ninterpretação de legislação\
|
| 234 |
+
\ local: Decretos nº 32.115/2010 e nº 38.197/13, que dispõem sobre a demolição,\n\
|
| 235 |
+
realocação e o pagamento de tal benefício nos casos de desocupação de áreas de\
|
| 236 |
+
\ assentamentos populares,\nnecessárias à implantação de projetos de interesse\
|
| 237 |
+
\ público, ou em situações de risco e emergência.\n \n Tal\
|
| 238 |
+
\ circunstância distancia o caso concreto das competências definidas pela Constituição\
|
| 239 |
+
\ da República para\nas Cortes Superiores, configurando hipótese que atrai a incidência\
|
| 240 |
+
\ dos verbetes sumulares nº 279 e 280 do STF. \n \n Nesse\
|
| 241 |
+
\ sentido:\n \n\"RECURSO EXTRAORDINÁRIO - MATÉRIA FÁTICA - DIREITO\
|
| 242 |
+
\ LOCAL. O recurso extraordinário não se\npresta à reapreciação da controvérsia\
|
| 243 |
+
\ no que dirimida à luz dos elementos probatórios dos autos e considerado o\n\
|
| 244 |
+
direito local - verbetes de nºs 279 e 280 da Súmula do Supremo Tribunal Federal.\
|
| 245 |
+
\ Hipótese em que se concluiu\npelo direito à gratificação especial decorrente\
|
| 246 |
+
\ do desempenho em local insalubre e perigoso. (RE 119216 AgR,\nRelator(a): MARCO\
|
| 247 |
+
\ AURÉLIO, Segunda Turma, julgado em 04/03/1997, DJ 23-05-1997 PP-21735 EMENT\n\
|
| 248 |
+
VOL-01870-01 PP-00127)\"\n \n À vista do exposto, DEIXO\
|
| 249 |
+
\ DE ADMITIR o recurso extraordinário interposto.\n Publique-se.\n\
|
| 250 |
+
Rio de Janeiro, 26 de abril de 2022.\nDesembargador EDSON VASCONCELOS"
|
| 251 |
+
- source_sentence: "T\nodo conteúdo disponível nesta página é meramente informativo,\
|
| 252 |
+
\ não substitui em hipótese alguma, a publicação Oficial\n \n \nSUSPENSÃO DE\
|
| 253 |
+
\ PRAZOS E DE EXPEDIENTE FORENSE \n \nCALENDÁRIO DE FERIADOS \nData da atualização:\
|
| 254 |
+
\ 14.04.2023\n \n2023\n \n \n \nConsulta aos atos oficiais do PJERJ e à legislação\
|
| 255 |
+
\ que instituem feriados, pontos \nfacultativos e suspensão de atividades. \n\
|
| 256 |
+
\ \n \n \n \n \n \n\n \nConsulta por Assunto \n \n \n\n \nConsulta por Comarca\
|
| 257 |
+
\ \n \n \n \n\n \nConsulta de feriados, pontos facultativos e outras ocorrências\
|
| 258 |
+
\ com \nabrangência de todo o Estado ou toda Capital\n. \n \n \n \n \n \n \n\
|
| 259 |
+
\ \n \n \n \n \n \n \n \n \n \n \n \n \n \nTJRJ 202300285811 27/04/2023 18:12:00\
|
| 260 |
+
\ H=JI - PETIÇÃO ELETRÔNICA Assinada por RODRIGO SALGADO MARTINS\n889"
|
| 261 |
+
sentences:
|
| 262 |
+
- "PRAZO DE 90 (NOVENTA) DIAS, BEM COMO ARRESTANDO A\nVERBA NECESSÁRIA\
|
| 263 |
+
\ AO CUSTEIO DAS OBRAS E SERVIÇOS.\nINÉRCIA DO MUNICÍPIO. SENTENÇA DE\
|
| 264 |
+
\ PROVIMENTO,\nCONFIRMANDO A TUTELA DEFERIDA, E CONDENANDO O\nMUNICÍPIO\
|
| 265 |
+
\ A REALIZAR AS OBRAS E SERVIÇOS MENCIONADOS.\nAPELO DO MUNICÍPIO/RÉU. ALEGAÇÃO\
|
| 266 |
+
\ DE AUSÊNCIA DE\nRECURSOS, BEM COMO DE VIOLAÇÃO AO PRINCÍPIO DA\nSEPARAÇÃO\n\
|
| 267 |
+
\ \nDE\n \nPODERES,\n \nARGUINDO,\n \nAINDA,\n \nA\nIMPOSSIBILIDADE DE PROMOÇÃO\
|
| 268 |
+
\ DE ARRESTO DAS VERBAS\nPÚBLICAS. CONSELHO TUTELAR QUE CONSITUI ÓRGÃO\n\
|
| 269 |
+
PERMANENTE E AUTÔNOMO, A QUEM INCUMBE ZELAR PELO\n4\n833"
|
| 270 |
+
- "Classif. documental\n00.00.04.22\nPREFEITURA DA CIDADE DO RIO DE JANEIRO\nSECRETARIA\
|
| 271 |
+
\ MUNICIPAL DE FAZENDA E PLANEJAMENTO / SMFP\nDESPACHO Nº SMF-DES-2024/52208\n\
|
| 272 |
+
Assunto: INFORMAÇÃO PARA SUBSIDIAR AÇÕES JUDICIAIS\nA(o) FP/REC-RIO/CIP-1,\nPara\
|
| 273 |
+
\ análise.\nRio de Janeiro, 09 de abril de 2024.\nVINICIUS ALVES FERREIRA \nAGENTE\
|
| 274 |
+
\ DE FAZENDA \nMatrícula: 2951804 \nFP/REC-RIO/CIP\nSMFDES202452208A\nAssinado\
|
| 275 |
+
\ com senha por VINICIUS ALVES FERREIRA - 09/04/2024 às 19:11:20.\nDocumento Nº:\
|
| 276 |
+
\ 5659977-8892 - consulta à autenticidade em\nhttps://acesso.processo.rio/sigaex/public/app/autenticar?n=5659977-8892\n\
|
| 277 |
+
386"
|
| 278 |
+
- "Santo Antônio de Pádua \nPeríodo \n \nAto \n \nPublicação \nEmenta \n09/01/2023,\
|
| 279 |
+
\ \n11/01/2023 e \n12/01/2023 \nATO EXECUTIVO Nº \n2, DE 12/01/2023\n \nDJERJ,\
|
| 280 |
+
\ ADM, n. 85, p. 3. \n13/01/2023\n \nResolve suspender as atividades \npresenciais\
|
| 281 |
+
\ \ne \nos \nprazos \nprocessuais na Comarca de Santo \nAntônio \nde \nPádua,\
|
| 282 |
+
\ \nnos \ndias \n09/01/2023, \n11/01/2023 \ne \n12/01/2023.\n \nÍndice \nSão Gonçalo\
|
| 283 |
+
\ \nPeríodo \n \nAto \n \nPublicação \nEmenta \n14/02/2023 \nATO EXECUTIVO Nº\
|
| 284 |
+
\ \n41, DE 14/02/2023\n \nDJERJ, ADM, n. 110, p. 3. \n24/02/2023 \nResolve suspender\
|
| 285 |
+
\ \nos \nprazos \nprocessuais na Comarca de São \nGonçalo, no dia 14 de fevereiro\
|
| 286 |
+
\ de \n2023. \n07/02/2023 e \n08/02/2023 \nATO EXECUTIVO Nº \n36, DE 10/02/2023\n\
|
| 287 |
+
\ \nDJERJ, ADM, n. 106, p. 9. \n14/02/2023\n \nResolve suspender \nos \nprazos\
|
| 288 |
+
\ \nprocessuais na Comarca da Capital \ne nas Comarcas de Belford Roxo, \nDuque\
|
| 289 |
+
\ de Caxias, Guapimirim, \nItaboraí, Itaguaí, Japeri, Magé, \nNilópolis, Niterói,\
|
| 290 |
+
\ Nova Iguaçu/ \nMesquita, Paracambi, Queimados, \nSão Gonçalo, São João de Meriti,\
|
| 291 |
+
\ \nSeropédica e Maricá, nos dias 07 e \n08 de fevereiro de 2023.\n \n898"
|
| 292 |
+
- source_sentence: "PROCURADORIA GERAL DO ESTADO DO RIO DE JANEIRO \nPROCURADORIA\
|
| 293 |
+
\ DE SERVIÇOS DE SAÚDE (PG-16) \n \nEXMO. SR. DR. DES. 3º PRESIDENTE DO TRIBUNAL\
|
| 294 |
+
\ DE JUSTIÇA DO RIO DE \nJANEIRO \n \n \n \nProcesso 0076107-19.2019.8.19.0001\
|
| 295 |
+
\ \n \n \n \nO\n ESTADO DO RIO DE JANEIRO, \npela Procuradoria Geral do Estado,\
|
| 296 |
+
\ \nnos autos do recurso extraordinário interposto por \nPERCEDINA DOS SANTOS\
|
| 297 |
+
\ TORRES e \noutro\n,\n \nvem, tempestivamente, apresentar suas \n \n \nCONTRARRAZÕES\
|
| 298 |
+
\ DE RECURSO EXTRAORDINÁRIO \n \n \npelos fundamentos jurídicos expostos na peça\
|
| 299 |
+
\ em anexo, esperando, desde já, pelo não \nconhecimento ou pelo desprovimento\
|
| 300 |
+
\ do recurso, como de Direito. \n \nPede deferimento. \nRio de Janeiro, 26 de\
|
| 301 |
+
\ janeiro de 2021. \n \n \n \nLETICIA LACROIX DE OLIVEIRA \nP\nROCURADORA DO\
|
| 302 |
+
\ \nE\nSTADO\n \n \n \n \n \n \n \nTJRJ 202100041683 27/01/2021 00:06:00 GPLI\
|
| 303 |
+
\ - PETIÇÃO ELETRÔNICA Assinada por LETICIA LACROIX DE OLIVEIRA\n373\nDigitally\
|
| 304 |
+
\ signed by LETICIA LACROIX DE OLIVEIRA:04296848780\nDate: 2021.01.26 21:23:08\
|
| 305 |
+
\ BRST"
|
| 306 |
+
sentences:
|
| 307 |
+
- "PROCURADORIA GERAL DO ESTADO DO RIO DE JANEIRO \nPROCURADORIA DE SERVIÇOS DE\
|
| 308 |
+
\ SAÚDE (PG-16) \n \n \n3 \n \n Na prática, pode-se concluir que o acórdão\
|
| 309 |
+
\ recorrido revogou toda a \njurisprudência sumular dos Tribunais Superiores,\
|
| 310 |
+
\ entendendo ser aplicável um julgado do STF \nque, numa ação rescisória e em\
|
| 311 |
+
\ caráter incidental, acredita ser cabível o pagamento de \nhonorários advocatícios\
|
| 312 |
+
\ à Defensoria Pública pelo mesmo ente federado responsável por seu \nfuncionamento.\
|
| 313 |
+
\ Situação que, \npermissa venia\n, é inadmissível e viola frontalmente o \nordenamento\
|
| 314 |
+
\ jurídico vigente. \n \n Uma outra questão jurídica diz respeito à possibilidade\
|
| 315 |
+
\ de este acórdão do STF, \nque como já se disse, decidiu sobre o tema em caráter\
|
| 316 |
+
\ incidental e não tem caráter vinculante, \nrevogar a própria Súmula 421 do STJ.\
|
| 317 |
+
\ Um acórdão que decide um tema de modo incidental \nrevoga automaticamente as\
|
| 318 |
+
\ Súmulas dos outros Tribunais? \nData venia\n, parece-nos que não. \n \nII -\
|
| 319 |
+
\ ILEGALIDADE DO PAGAMENTO DE HONORÁRIOS PELO ESTADO EM \nFAVOR DA DEFENSORIA\
|
| 320 |
+
\ PÚBLICA – OCORRÊNCIA DA CONFUSÃO (ARTIGO \n381 DO CÓDIGO CIVIL) – TEMA PACIFICADO\
|
| 321 |
+
\ PELO E. STJ\n \n \nRememore-se, por oportuno, que já está pacificado na doutrina\
|
| 322 |
+
\ e na jurisprudência \no entendimento de que há confusão na condenação do Estado\
|
| 323 |
+
\ ao pagamento de honorários \nsucumbenciais à Defensoria Pública, nos termos\
|
| 324 |
+
\ do que estabelece o artigo 381 do Código Civil, \nverbis\n: \n \nArt. 381 –\
|
| 325 |
+
\ Extingue-se a obrigação desde que na mesma pessoa se \nconfundam as qualidades\
|
| 326 |
+
\ de credor e devedor. \n \nCom efeito, considerando que tanto a Defensoria Pública,\
|
| 327 |
+
\ quanto o seu Centro de \nEstudos Jurídicos são órgãos do próprio Estado, mostra-se\
|
| 328 |
+
\ flagrante que o caso é de confusão"
|
| 329 |
+
- "Poder Judiciário \nEstado do Rio de Janeiro \nDécima NonaCâmara Cível\n \n \n\
|
| 330 |
+
\ \n2 \nVOTO VENCIDO NA AC Nº APELAÇÃO Nº 0337234-47.2014.8.19.0001 (3)\n \n\
|
| 331 |
+
\ \nNo mérito, sustenta a não-caracterização da apelada como \nentidade de assistência\
|
| 332 |
+
\ social, devendo ser aplicada a Súmula 730 do STF. \n \n Assevera, ainda a inexistência\
|
| 333 |
+
\ de comprovação dos \nrequisitos para gozo da imunidade previstos no art. 14\
|
| 334 |
+
\ do CTN. \n \nAfirma que a decisão que revogou o reconhecimento da \nimunidade\
|
| 335 |
+
\ tributária da recorrida foi proferida em 1993 e os fatos geradores do \nISS\
|
| 336 |
+
\ que deram ensejo à ação de execução fiscal ocorreram entre maio de 1997 \naté\
|
| 337 |
+
\ abril de 2002, não havendo que se falar em retroatividade, pois o período \n\
|
| 338 |
+
cobrado na execução fiscal é bem posterior à decisão que revogou a concessão \n\
|
| 339 |
+
de imunidade tributária. \n \nDestaca que não há excesso de execução, pois o \n\
|
| 340 |
+
Município do Rio de Janeiro, ao reverso da União Federal, jamais vinculou seus\
|
| 341 |
+
\ \ncréditos tributários aos parâmetros da Taxa SELIC. \n \nPor fim, que inexiste\
|
| 342 |
+
\ ilegalidade na cobrança das multas: \na multa punitiva prevista no artigo 51,\
|
| 343 |
+
\ é sanção aplicada pelo Fisco para coibir \na burla à atuação da administração\
|
| 344 |
+
\ tributária, a sanção tem caráter pedagógico. \nJá a multa moratória prevista\
|
| 345 |
+
\ no artigo 181 é multa pelo atraso no \ncumprimento da obrigação, bem assim,\
|
| 346 |
+
\ que o artigo 1° da Lei Municipal \n5.546/2012 não pode ser aplicado, pois os\
|
| 347 |
+
\ fatos geradores da execução fiscal \nem apenso ocorreram no período de 1997\
|
| 348 |
+
\ até abril de 2002. \n \nPois bem. \n \nAfasto a \npreliminar de nulidade\n ausência\
|
| 349 |
+
\ de intimação \npessoal do município para falar sobre os esclarecimentos do Perito\
|
| 350 |
+
\ ao laudo \ncrítico. \n \nCom efeito, \no Município se manifestou acerca do"
|
| 351 |
+
- "Atribuição: Fazenda Pública \nCódigo/Nome Movimento: 1000173/Outras manifestações\
|
| 352 |
+
\ em 2º grau\n \nrestituição dos valores indevidamente descontados, com atualização\
|
| 353 |
+
\ e juros, e \napuração em fase de liquidação de sentença. \n \nInconformada,\
|
| 354 |
+
\ a parte ré interpôs o recurso de apelação do \nitem 000114. \n \nPetição juntada\
|
| 355 |
+
\ no item 000122 noticiando o falecimento do \nautor e requerendo sua substituição\
|
| 356 |
+
\ processual por sua filha, Luciana Maria da Silva \nMirandola. \n \nDespacho\
|
| 357 |
+
\ no item 000140 determinando a intimação da \nProcuradoria Geral do Município\
|
| 358 |
+
\ do Rio de Janeiro e do Ministério Público sobre o \npedido de habilitação. \n\
|
| 359 |
+
\ \nCiência do Parquet no item 000148. \n \nManifestação dos réus no item 000150\
|
| 360 |
+
\ requerendo a \ndeclaração de nulidade da sentença e dos atos praticados após\
|
| 361 |
+
\ o óbito do autor, bem \ncomo a rejeição do pedido de habilitação, uma vez que\
|
| 362 |
+
\ a sucessão processual deveria \nser pelo espólio, na forma do artigo 110 do\
|
| 363 |
+
\ CPC. \n \nDespacho no item 000155 para manifestação do Ministério \nPúblico.\
|
| 364 |
+
\ \n \nCiência do Parquet no item 000161. \n \nDespacho no item 000164 para manifestação\
|
| 365 |
+
\ da parte autora. \n \n221"
|
| 366 |
+
pipeline_tag: sentence-similarity
|
| 367 |
+
library_name: sentence-transformers
|
| 368 |
+
metrics:
|
| 369 |
+
- cosine_accuracy@1
|
| 370 |
+
- cosine_accuracy@3
|
| 371 |
+
- cosine_accuracy@5
|
| 372 |
+
- cosine_accuracy@10
|
| 373 |
+
- cosine_precision@1
|
| 374 |
+
- cosine_precision@3
|
| 375 |
+
- cosine_precision@5
|
| 376 |
+
- cosine_precision@10
|
| 377 |
+
- cosine_recall@1
|
| 378 |
+
- cosine_recall@3
|
| 379 |
+
- cosine_recall@5
|
| 380 |
+
- cosine_recall@10
|
| 381 |
+
- cosine_ndcg@10
|
| 382 |
+
- cosine_mrr@10
|
| 383 |
+
- cosine_map@100
|
| 384 |
+
model-index:
|
| 385 |
+
- name: SentenceTransformer based on Alibaba-NLP/gte-multilingual-base
|
| 386 |
+
results:
|
| 387 |
+
- task:
|
| 388 |
+
type: information-retrieval
|
| 389 |
+
name: Information Retrieval
|
| 390 |
+
dataset:
|
| 391 |
+
name: Unknown
|
| 392 |
+
type: unknown
|
| 393 |
+
metrics:
|
| 394 |
+
- type: cosine_accuracy@1
|
| 395 |
+
value: 0.6545
|
| 396 |
+
name: Cosine Accuracy@1
|
| 397 |
+
- type: cosine_accuracy@3
|
| 398 |
+
value: 0.7925
|
| 399 |
+
name: Cosine Accuracy@3
|
| 400 |
+
- type: cosine_accuracy@5
|
| 401 |
+
value: 0.841
|
| 402 |
+
name: Cosine Accuracy@5
|
| 403 |
+
- type: cosine_accuracy@10
|
| 404 |
+
value: 0.89
|
| 405 |
+
name: Cosine Accuracy@10
|
| 406 |
+
- type: cosine_precision@1
|
| 407 |
+
value: 0.6545
|
| 408 |
+
name: Cosine Precision@1
|
| 409 |
+
- type: cosine_precision@3
|
| 410 |
+
value: 0.5031666666666667
|
| 411 |
+
name: Cosine Precision@3
|
| 412 |
+
- type: cosine_precision@5
|
| 413 |
+
value: 0.4011
|
| 414 |
+
name: Cosine Precision@5
|
| 415 |
+
- type: cosine_precision@10
|
| 416 |
+
value: 0.27425
|
| 417 |
+
name: Cosine Precision@10
|
| 418 |
+
- type: cosine_recall@1
|
| 419 |
+
value: 0.23852962917260728
|
| 420 |
+
name: Cosine Recall@1
|
| 421 |
+
- type: cosine_recall@3
|
| 422 |
+
value: 0.4422107764041644
|
| 423 |
+
name: Cosine Recall@3
|
| 424 |
+
- type: cosine_recall@5
|
| 425 |
+
value: 0.5245186089315591
|
| 426 |
+
name: Cosine Recall@5
|
| 427 |
+
- type: cosine_recall@10
|
| 428 |
+
value: 0.6212349911293668
|
| 429 |
+
name: Cosine Recall@10
|
| 430 |
+
- type: cosine_ndcg@10
|
| 431 |
+
value: 0.6220169640997574
|
| 432 |
+
name: Cosine Ndcg@10
|
| 433 |
+
- type: cosine_mrr@10
|
| 434 |
+
value: 0.7325833333333327
|
| 435 |
+
name: Cosine Mrr@10
|
| 436 |
+
- type: cosine_map@100
|
| 437 |
+
value: 0.5411107394124216
|
| 438 |
+
name: Cosine Map@100
|
| 439 |
+
---
|
| 440 |
+
|
| 441 |
+
# SentenceTransformer based on Alibaba-NLP/gte-multilingual-base
|
| 442 |
+
|
| 443 |
+
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [Alibaba-NLP/gte-multilingual-base](https://huggingface.co/Alibaba-NLP/gte-multilingual-base) on the parquet dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
|
| 444 |
+
|
| 445 |
+
## Model Details
|
| 446 |
+
|
| 447 |
+
### Model Description
|
| 448 |
+
- **Model Type:** Sentence Transformer
|
| 449 |
+
- **Base model:** [Alibaba-NLP/gte-multilingual-base](https://huggingface.co/Alibaba-NLP/gte-multilingual-base) <!-- at revision 9bbca17d9273fd0d03d5725c7a4b0f6b45142062 -->
|
| 450 |
+
- **Maximum Sequence Length:** 8192 tokens
|
| 451 |
+
- **Output Dimensionality:** 768 dimensions
|
| 452 |
+
- **Similarity Function:** Cosine Similarity
|
| 453 |
+
- **Training Dataset:**
|
| 454 |
+
- parquet
|
| 455 |
+
<!-- - **Language:** Unknown -->
|
| 456 |
+
<!-- - **License:** Unknown -->
|
| 457 |
+
|
| 458 |
+
### Model Sources
|
| 459 |
+
|
| 460 |
+
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
| 461 |
+
- **Repository:** [Sentence Transformers on GitHub](https://github.com/huggingface/sentence-transformers)
|
| 462 |
+
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
|
| 463 |
+
|
| 464 |
+
### Full Model Architecture
|
| 465 |
+
|
| 466 |
+
```
|
| 467 |
+
SentenceTransformer(
|
| 468 |
+
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False, 'architecture': 'NewModel'})
|
| 469 |
+
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
|
| 470 |
+
(2): Normalize()
|
| 471 |
+
)
|
| 472 |
+
```
|
| 473 |
+
|
| 474 |
+
## Usage
|
| 475 |
+
|
| 476 |
+
### Direct Usage (Sentence Transformers)
|
| 477 |
+
|
| 478 |
+
First install the Sentence Transformers library:
|
| 479 |
+
|
| 480 |
+
```bash
|
| 481 |
+
pip install -U sentence-transformers
|
| 482 |
+
```
|
| 483 |
+
|
| 484 |
+
Then you can load this model and run inference.
|
| 485 |
+
```python
|
| 486 |
+
from sentence_transformers import SentenceTransformer
|
| 487 |
+
|
| 488 |
+
# Download from the 🤗 Hub
|
| 489 |
+
model = SentenceTransformer("sentence_transformers_model_id")
|
| 490 |
+
# Run inference
|
| 491 |
+
sentences = [
|
| 492 |
+
'PROCURADORIA GERAL DO ESTADO DO RIO DE JANEIRO \nPROCURADORIA DE SERVIÇOS DE SAÚDE (PG-16) \n \nEXMO. SR. DR. DES. 3º PRESIDENTE DO TRIBUNAL DE JUSTIÇA DO RIO DE \nJANEIRO \n \n \n \nProcesso 0076107-19.2019.8.19.0001 \n \n \n \nO\n ESTADO DO RIO DE JANEIRO, \npela Procuradoria Geral do Estado, \nnos autos do recurso extraordinário interposto por \nPERCEDINA DOS SANTOS TORRES e \noutro\n,\n \nvem, tempestivamente, apresentar suas \n \n \nCONTRARRAZÕES DE RECURSO EXTRAORDINÁRIO \n \n \npelos fundamentos jurídicos expostos na peça em anexo, esperando, desde já, pelo não \nconhecimento ou pelo desprovimento do recurso, como de Direito. \n \nPede deferimento. \nRio de Janeiro, 26 de janeiro de 2021. \n \n \n \nLETICIA LACROIX DE OLIVEIRA \nP\nROCURADORA DO \nE\nSTADO\n \n \n \n \n \n \n \nTJRJ 202100041683 27/01/2021 00:06:00 GPLI - PETIÇÃO ELETRÔNICA Assinada por LETICIA LACROIX DE OLIVEIRA\n373\nDigitally signed by LETICIA LACROIX DE OLIVEIRA:04296848780\nDate: 2021.01.26 21:23:08 BRST',
|
| 493 |
+
'PROCURADORIA GERAL DO ESTADO DO RIO DE JANEIRO \nPROCURADORIA DE SERVIÇOS DE SAÚDE (PG-16) \n \n \n3 \n \n Na prática, pode-se concluir que o acórdão recorrido revogou toda a \njurisprudência sumular dos Tribunais Superiores, entendendo ser aplicável um julgado do STF \nque, numa ação rescisória e em caráter incidental, acredita ser cabível o pagamento de \nhonorários advocatícios à Defensoria Pública pelo mesmo ente federado responsável por seu \nfuncionamento. Situação que, \npermissa venia\n, é inadmissível e viola frontalmente o \nordenamento jurídico vigente. \n \n Uma outra questão jurídica diz respeito à possibilidade de este acórdão do STF, \nque como já se disse, decidiu sobre o tema em caráter incidental e não tem caráter vinculante, \nrevogar a própria Súmula 421 do STJ. Um acórdão que decide um tema de modo incidental \nrevoga automaticamente as Súmulas dos outros Tribunais? \nData venia\n, parece-nos que não. \n \nII - ILEGALIDADE DO PAGAMENTO DE HONORÁRIOS PELO ESTADO EM \nFAVOR DA DEFENSORIA PÚBLICA – OCORRÊNCIA DA CONFUSÃO (ARTIGO \n381 DO CÓDIGO CIVIL) – TEMA PACIFICADO PELO E. STJ\n \n \nRememore-se, por oportuno, que já está pacificado na doutrina e na jurisprudência \no entendimento de que há confusão na condenação do Estado ao pagamento de honorários \nsucumbenciais à Defensoria Pública, nos termos do que estabelece o artigo 381 do Código Civil, \nverbis\n: \n \nArt. 381 – Extingue-se a obrigação desde que na mesma pessoa se \nconfundam as qualidades de credor e devedor. \n \nCom efeito, considerando que tanto a Defensoria Pública, quanto o seu Centro de \nEstudos Jurídicos são órgãos do próprio Estado, mostra-se flagrante que o caso é de confusão',
|
| 494 |
+
'Atribuição: Fazenda Pública \nCódigo/Nome Movimento: 1000173/Outras manifestações em 2º grau\n \nrestituição dos valores indevidamente descontados, com atualização e juros, e \napuração em fase de liquidação de sentença. \n \nInconformada, a parte ré interpôs o recurso de apelação do \nitem 000114. \n \nPetição juntada no item 000122 noticiando o falecimento do \nautor e requerendo sua substituição processual por sua filha, Luciana Maria da Silva \nMirandola. \n \nDespacho no item 000140 determinando a intimação da \nProcuradoria Geral do Município do Rio de Janeiro e do Ministério Público sobre o \npedido de habilitação. \n \nCiência do Parquet no item 000148. \n \nManifestação dos réus no item 000150 requerendo a \ndeclaração de nulidade da sentença e dos atos praticados após o óbito do autor, bem \ncomo a rejeição do pedido de habilitação, uma vez que a sucessão processual deveria \nser pelo espólio, na forma do artigo 110 do CPC. \n \nDespacho no item 000155 para manifestação do Ministério \nPúblico. \n \nCiência do Parquet no item 000161. \n \nDespacho no item 000164 para manifestação da parte autora. \n \n221',
|
| 495 |
+
]
|
| 496 |
+
embeddings = model.encode(sentences)
|
| 497 |
+
print(embeddings.shape)
|
| 498 |
+
# [3, 768]
|
| 499 |
+
|
| 500 |
+
# Get the similarity scores for the embeddings
|
| 501 |
+
similarities = model.similarity(embeddings, embeddings)
|
| 502 |
+
print(similarities)
|
| 503 |
+
# tensor([[ 1.0000, 0.6637, -0.0623],
|
| 504 |
+
# [ 0.6637, 1.0000, -0.0069],
|
| 505 |
+
# [-0.0623, -0.0069, 1.0000]])
|
| 506 |
+
```
|
| 507 |
+
|
| 508 |
+
<!--
|
| 509 |
+
### Direct Usage (Transformers)
|
| 510 |
+
|
| 511 |
+
<details><summary>Click to see the direct usage in Transformers</summary>
|
| 512 |
+
|
| 513 |
+
</details>
|
| 514 |
+
-->
|
| 515 |
+
|
| 516 |
+
<!--
|
| 517 |
+
### Downstream Usage (Sentence Transformers)
|
| 518 |
+
|
| 519 |
+
You can finetune this model on your own dataset.
|
| 520 |
+
|
| 521 |
+
<details><summary>Click to expand</summary>
|
| 522 |
+
|
| 523 |
+
</details>
|
| 524 |
+
-->
|
| 525 |
+
|
| 526 |
+
<!--
|
| 527 |
+
### Out-of-Scope Use
|
| 528 |
+
|
| 529 |
+
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
|
| 530 |
+
-->
|
| 531 |
+
|
| 532 |
+
## Evaluation
|
| 533 |
+
|
| 534 |
+
### Metrics
|
| 535 |
+
|
| 536 |
+
#### Information Retrieval
|
| 537 |
+
|
| 538 |
+
* Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
|
| 539 |
+
|
| 540 |
+
| Metric | Value |
|
| 541 |
+
|:--------------------|:----------|
|
| 542 |
+
| cosine_accuracy@1 | 0.6545 |
|
| 543 |
+
| cosine_accuracy@3 | 0.7925 |
|
| 544 |
+
| cosine_accuracy@5 | 0.841 |
|
| 545 |
+
| cosine_accuracy@10 | 0.89 |
|
| 546 |
+
| cosine_precision@1 | 0.6545 |
|
| 547 |
+
| cosine_precision@3 | 0.5032 |
|
| 548 |
+
| cosine_precision@5 | 0.4011 |
|
| 549 |
+
| cosine_precision@10 | 0.2742 |
|
| 550 |
+
| cosine_recall@1 | 0.2385 |
|
| 551 |
+
| cosine_recall@3 | 0.4422 |
|
| 552 |
+
| cosine_recall@5 | 0.5245 |
|
| 553 |
+
| cosine_recall@10 | 0.6212 |
|
| 554 |
+
| **cosine_ndcg@10** | **0.622** |
|
| 555 |
+
| cosine_mrr@10 | 0.7326 |
|
| 556 |
+
| cosine_map@100 | 0.5411 |
|
| 557 |
+
|
| 558 |
+
<!--
|
| 559 |
+
## Bias, Risks and Limitations
|
| 560 |
+
|
| 561 |
+
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
|
| 562 |
+
-->
|
| 563 |
+
|
| 564 |
+
<!--
|
| 565 |
+
### Recommendations
|
| 566 |
+
|
| 567 |
+
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
|
| 568 |
+
-->
|
| 569 |
+
|
| 570 |
+
## Training Details
|
| 571 |
+
|
| 572 |
+
### Training Dataset
|
| 573 |
+
|
| 574 |
+
#### parquet
|
| 575 |
+
|
| 576 |
+
* Dataset: parquet
|
| 577 |
+
* Size: 200,000 training samples
|
| 578 |
+
* Columns: <code>anchor</code> and <code>positive</code>
|
| 579 |
+
* Approximate statistics based on the first 1000 samples:
|
| 580 |
+
| | anchor | positive |
|
| 581 |
+
|:--------|:--------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|
|
| 582 |
+
| type | string | string |
|
| 583 |
+
| details | <ul><li>min: 129 tokens</li><li>mean: 395.23 tokens</li><li>max: 490 tokens</li></ul> | <ul><li>min: 99 tokens</li><li>mean: 356.9 tokens</li><li>max: 509 tokens</li></ul> |
|
| 584 |
+
* Samples:
|
| 585 |
+
| anchor | positive |
|
| 586 |
+
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 587 |
+
| <code>Doc. 1 <br>TJRJ CAP 12VFE 202401831853 17/04/24 12:55:57139829 PROGER-VIRTUAL<br>54<br><br><br>Petição Inicial Eletrônica 2ª instância/Conselho da Magistratura<br> <br>Srº Usuário, a petição foi encaminhada com sucesso.<br> <br>O protocolo gerado é a sua garantia do recebimento da petição pelo Tribunal de Justiça do<br>Rio de Janeiro, sendo desnecessário novo peticionamento eletrônico com as mesmas<br>informações.<br> <br>Dados do Processo<br>Processo: 0028612-06.2024.8.19.0000<br> <br>Protocolo: 3204/2024.00310040<br> <br>Segunda Instância<br> <br>Advogado(s)<br> <br>RJ144016<br> - DANIEL NEVES ROSA DURÃO DE ANDRADE<br>RJ152461<br> - CAROLINA TEIXEIRA DE SOUSA<br> <br>Parte(s)<br> <br>PASQUALE MAURO BENF<br> , Pessoa Física , CPF - 007.220.147-91 Endereço: Comercial - das Américas, 10333,<br>RJ, Rio de Janeiro, Barra da Tijuca, , CEP: 22793082<br> <br>Documento(s)<br>Data : 16/04/2024<br>Horário : 17:55<br>Número do Processo de Referência: <br>10041723<br>Orgão de Origem: <br>Capital: Cartório Eletrônico da 12ª Vara de Fazenda Publica<br>Natureza: <br>Civel<br>Tipo Protocolo: <br>AGRAVO DE INSTRUMENTO - CÍV...</code> | <code>3 <br>5.172/1966 – Código Tributário Nacional – “CTN”, com sua redação anterior à Lei Complementar <br>nº 118, de 9 de fevereiro de 2005. <br> <br>Em que pese a robusta argumentação contida da referida Exceção, esta foi rejeitada <br>por intermédio da r. decisão do indexador nº 28, ora agravada, abaixo transcrita: <br> <br>“Reconsidero a decisão retro equivocadamente proferida visto que o executado se encontra <br>representado nos autos por advogado. <br>Rejeito a arguição de prescrição visto que<br> <br>consta do Sistema de Dívida Ativa bem como <br>deste E. Tribunal de justiça que o AR para citação do executado retornou com <br>resultado positivo<br>. <br>Lavre-se termo de penhora e intime-se na forma do art. 12 da LEF”. (grifamos) <br> <br>Data maxima venia<br>, a conclusão exarada pelo MM. Juízo <br>a quo<br> não observa a legislação <br>e jurisprudência relativa ao reconhecimento da prescrição originária e intercorrente, se justificando a <br>interposição do presente Agravo de Instrumento com o intuito de obter a reforma da r. decisão <br>recorrida...</code> |
|
| 588 |
+
| <code>TRIBUNAL DE JUSTIÇA DO RIO DE JANEIRO<br>eJUD TJRJ<br>03/05/2021 06:52<br>Emitido em:<br>DGJUR - SECRETARIA DA 12ª CÂMARA CÍVEL<br>Processo: 0277899-58.2018.8.19.0001 - APELAÇÃO<br>INTIMAÇÃO ELETRÔNICA<br>Rio de Janeiro, 03 de maio de 2021<br>Fica V. Sª / V. Exª intimado da determinação abaixo:<br>DÉCIMA SEGUNDA CÂMARA CÍVEL<br>DÉCIMA SEGUNDA CÂMARA CÍVEL<br>EMBARGOS DE DECLARAÇÃO EM APELAÇÃO CÍVEL Nº 0277899-58.2018.8.19.0001<br>EMBARGOS DE<br>Embargantes 1: JANE PASQUINELLI E OUTROS.<br>Embargantes 1: JANE PASQUINELLI E OUTROS.<br>Embargantes 2: PREVI-RIO - INSTITUTO DE PREVIDÊNCIA E ASSISTÊNCIA.<br>Embargantes 2: PREVI-RIO<br>Embargados: OS MESMOS<br>Embargados: OS MESMOS<br>Relator: Desembargador JAIME DIAS PINHEIRO FILHO<br>Relator: Desembargador JAIME DIAS PINHEIRO <br>EMBARGOS DE DECLARAÇÃO OPOSTOS POR AMBAS AS PARTES. EMBARGOS OPOSTOS PELOS<br>EMBA<br>AUTORES/EMBARGANTES, QUE DEVE SER PROVIDO, COM EFEITOS INFRINGENTES, A FIM DE<br>AUTO<br>QUE O RÉU REEMBOLSE AOS AUTORES AS CUSTAS E A TAXA JUDICIÁRIA QUE FORAM<br>QUE O<br>ANTECIPADAS PELOS AUTORES, ANTE O...</code> | <code>não concorda e deve, por isso, manejar os recursos que entender cabíveis e não insistir na oposição de embargos<br>que, em regra, não servem para alterar o julgado, notadamente quando não há omissão, contradição, obscuridade<br>ou erro material.<br> In casu, o que se extrai dos autos é que os presentes embargos visam, primordialmente, a reforma, bem<br>como o prequestionamento da matéria objeto do julgado, conforme consignado em suas razões, ocasião em que a<br>recorrente pleiteia, inclusive, a concessão de efeitos infringentes.<br> Como é cediço, a modificação do julgado não se insere entre as funções dos embargos de declaração, o que<br>só se admite em casos excepcionais, não sendo, pois, esta a hipótese dos autos.<br> A propósito, transcrevo trecho do julgamento de Embargos de Declaração, da lavra do eminente Professor e<br>Desembargador Sergio Cavalieri Filho:<br>"Embargos de Declaração. Omissão Inexistente. Contestação do Julgado. Efeito Modificativo. Prequestionamento.<br>Descabimento....</code> |
|
| 589 |
+
| <code>TRIBUNAL DE JUSTIÇA DO ESTADO DO RIO DE JANEIRO<br>eJUD TJRJ<br>08/03/2024 12:11<br>Emitido em:<br>SECRETARIA DA 6ª CÂMARA DE DIREITO PÚBLICO (ANTIGA 21ª CÂMARA CÍVEL)<br>Processo: 0297157-30.2013.8.19.0001 - APELAÇÃO<br>INTIMAÇÃO ELETRÔNICA<br>Rio de Janeiro, 08 de março de 2024<br>Fica V. Sª / V. Exª intimado da determinação abaixo:<br>Apelação Cível nº 0297157-30.2013.8.19.0001<br>Apelante: INSTITUTO DE PREVIDÊNCIA E ASSISTÊNCIA DO MUNICÍPIO DO RIO DE JANEIRO -<br>PREVIRIO<br>Apelado: MIDAS ENGENHARIA LTDA<br>Juízo de Origem: Quinta Vara de Fazenda Pública da Comarca da Capital<br>Relatora: Desembargadora LIDIA MARIA SODRÉ DE MORAES<br>APELAÇÃO CÍVEL. DIREITO ADMINISTRATIVO. AÇÃO DE OBRIGAÇÃO DE FAZER. PRESTAÇÃO DE<br>SERVIÇO. ALEGAÇÃO AUTORAL DE INEXECUÇÃO PARCIAL DO CONTRATO DE PRESTAÇÃO DE<br>SERVIÇOS COM EXECUÇÃO DE OBRAS DO SISTEMA DE AR-CONDICIONADO NOS BLOCOS I E II<br>DO CENTRO ADMINISTRATIVO SÃO SEBASTIÃO. SENTENÇA QUE JULGOU IMPROCEDENTE O<br>PEDIDO. IRRESIGNAÇÃO DO INSTITUTO DE PREVIDÊNCIA REPRISANDO AS ARGUMENTAÇÕES<br>APRESENTA...</code> | <code>Requereu a procedência do pedido para a condenação da ré na obrigação de fazer consistente na adequada<br>instalação do sistema de automação e "telesupervisão" do ar condicionado, ou subsidiariamente, a conversão em<br>perdas e danos, desde, 26/06/2008, término do prazo para cumprimento do contrato, e ao pagamento <br>de danos materiais relativo aos juros compensatórios e de mora, com correção monetária, desde o <br>desembolso e de acordo com as taxas contratualmente previstas, em razão do inadimplemento parcial do<br>contrato.<br> Adoto, no mais, o relatório constante da sentença, na forma regimental.<br> Prestação jurisdicional através da prolação da sentença de índice 430, que julgou improcedente o pedido,<br>cuja parte dispositiva, reza o seguinte:<br>"...Isto posto, julgo improcedentes os pedidos, e, em consequência, extinto o processo com julgamento do mérito,<br>na forma do artigo 487, I, do Código de Processo Civil.<br>Condeno a parte autora ao ...</code> |
|
| 590 |
+
* Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
|
| 591 |
+
```json
|
| 592 |
+
{
|
| 593 |
+
"scale": 20.0,
|
| 594 |
+
"similarity_fct": "cos_sim",
|
| 595 |
+
"gather_across_devices": false
|
| 596 |
+
}
|
| 597 |
+
```
|
| 598 |
+
|
| 599 |
+
### Evaluation Dataset
|
| 600 |
+
|
| 601 |
+
#### parquet
|
| 602 |
+
|
| 603 |
+
* Dataset: parquet
|
| 604 |
+
* Size: 2,000 evaluation samples
|
| 605 |
+
* Columns: <code>anchor</code> and <code>positive</code>
|
| 606 |
+
* Approximate statistics based on the first 1000 samples:
|
| 607 |
+
| | anchor | positive |
|
| 608 |
+
|:--------|:--------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
|
| 609 |
+
| type | string | string |
|
| 610 |
+
| details | <ul><li>min: 112 tokens</li><li>mean: 392.22 tokens</li><li>max: 536 tokens</li></ul> | <ul><li>min: 98 tokens</li><li>mean: 354.08 tokens</li><li>max: 555 tokens</li></ul> |
|
| 611 |
+
* Samples:
|
| 612 |
+
| anchor | positive |
|
| 613 |
+
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 614 |
+
| <code>EXCELENTÍSSIMA. DRA. DESEMBARGADORA-RELATORA DA QUINTA <br>CÂMARA DE DIREITO PÚBLICO DO TRIBUNAL DE JUSTIÇA DO ESTADO DO <br>RIO DE JANEIRO. <br> <br>Apelação Cível nº 0145575-65.2022.8.19.0001<br> <br> <br> <br> <br>SUZANA DE FÁTIMA DE SOUZA SILVA,<br> embargante já <br>devidamente qualificada nos autos do processo acima epigrafado, <br>VEM<br> <br>tempestivamente no quinquídio legal, e respeitosamente à presença de Vossa <br>Excelência, nos termos do art. 1.022, 1023 e 1.025 do Novo CPC, opor <br> <br>EMBARGOS DE DECLARAÇÃO <br>COM EFEITOS DE PREQUESTIONAMENTO E SUPERAÇÃO DE OMISSÃO <br>(SÚMULAS 98 E 211 DO STJ) <br> <br> <br>em face da decisão do acórdão proferido nos presentes autos em <br>epígrafe, que improveu a apelação das embargantes, para suprir pontos <br>contraditórios, proferido nos presentes autos em epígrafe, e a inda clarear <br>obscuridade, e afastar omissões, que eventualmente se registrem no V. Acórdão, <br>com base nos seguintes fundamentos fáticos e jurídicos a serem expostos a seguir:<br> <br>Nesse passo, e por isso, no entender da embargante, há...</code> | <code>Escolar; Dar banho e trocar o vestuário das crianças da <br>creche; Auxiliar na orientação das crianças no recreio <br>e nos intervalos, objetivando manter a segurança e a <br>disciplina; Participar de todas as aulas prestando <br>todos os cuidados devido às crianças; Organizar o <br>ambiente e orientar as crianças para o repouso, <br>permanecendo com elas durante todo o tempo que <br>estiverem <br>dormindo; <br>Responsabilizar-se <br>pelas <br>crianças que aguardam os pais ou o transporte escolar <br>até a sua efetiva entrega, zelando pela segurança e <br>bem estar de todos; Responsabilizar-se pela limpeza e <br>desinfecção de brinquedos e equipamentos utilizados <br>pelas crianças; Participar de todas as atividades <br>576</code> |
|
| 615 |
+
| <code>TRIBUNAL DE JUSTIÇA DO RIO DE JANEIRO<br>eJUD TJRJ<br>03/08/2021 14:39<br>Emitido em:<br>DGJUR - SECRETARIA DA 22ª CÂMARA CÍVEL<br>Processo: 0232479-93.2019.8.19.0001 - APELAÇÃO<br>INTIMAÇÃO ELETRÔNICA<br>Rio de Janeiro, 03 de agosto de 2021<br>Fica V. Sª / V. Exª intimado da determinação abaixo:<br>VIGÉSIMA SEGUNDA CÂMARA CÍVEL<br>APELAÇÃO CÍVEL Nº 0232479-93.2019.8.19.0001<br>APELANTE 1: MUNICÍPIO DO RIO DE JANEIRO <br>PROC. MUNICIPAL: LEO BOSCO GRIGGI PEDROSA <br>APELANTE 2 : ESTADO DO RIO DE JANEIRO <br>PROC. DO ESTADO: ANA CRISTINA BACOS <br>APELADO : ASSOCIAÇÃO LAR SÃO FRANCISCO DE ASSIS NA PROVIDÊNCIA DE DEUS <br>ADVOGADO : PAMELA GUIMARÃES TEIXEIRA LIMA<br>RELATOR: DES. BENEDICTO ABICAIR<br>APELAÇÃO CÍVEL. ÇÃO DE COBRANÇA PROPOSTA POR HOSPITAL DA REDE PRIVADA EM FACE<br>DO ESTADO DO RIO DE JANEIRO E DO MUNICÍPIO DO RIO DE JANEIRO. DESPESAS DECORRENTES<br>DE INTERNAÇÃO E TRATAMENTO DE PACIENTE IMPOSTA POR DECISÃO JUDICIAL. OBRIGAÇÃO<br>SOLIDÁRIA DOS ENTES PÚBLICOS QUANTO À COBERTURA DOS CUSTOS DO TRATAMENTO.<br>ILEGITIMIDADE PASSIVA QUE SE AF...</code> | <code>VEREDA, A PRESTAÇÃO DO SERVIÇO MÉDICO-HOSPITALAR PELO AUTOR DECORREU DA<br>OMISSÃO DO PODER PÚBLICO EM CUMPRIR COM O SEU DEVER CONSTITUCIONAL,<br>CABENDO-LHE, POR CONSEGUINTE, RESSARCIR OS GASTOS SUPORTADOS PELO HOSPITAL<br>PARTICULAR. NO QUE SE REFERE À LIMITAÇÃO DO RESSARCIMENTO À TABELA DO SISTEMA<br>ÚNICO DE SAÚDE, O INTENTO RECURSAL NÃO MERECE PROSPERAR, NA MEDIDA EM QUE O<br>HOSPITAL AUTOR NÃO POSSUI CONVÊNIO COM O SUS. POR OUTRO LADO, NÃO SE MOSTRA<br>RAZOÁVEL EXIGIR QUE HOSPITAL PARTICULAR SUPORTE OS GASTOS, AINDA QUE<br>PARCIALMENTE, PARA INTERNAÇÃO E TRATAMENTO DE ADMINISTRADO EM RAZÃO DA<br>OMISSÃO DO ENTE PÚBLICO E EM DECORRÊNCIA DE DECISÃO JUDICIAL. DESPROVIMENTO DOS<br>RECURSOS. SENTENÇA MANTIDA<br>0140919-75.2016.8.19.0001 - Apelação - Relator: Des(a). MÔNICA DE FARIA SARDAS - Data de Julgamento:<br>06/08/2020, VIGÉSIMA CÂMARA CÍVEL <br>APELAÇÃO CÍVEL. AÇÃO DE COBRANÇA PROPOSTA POR HOSPITAL DA REDE PRIVADA EM FACE<br>DO ESTADO DO RIO DE JANEIRO E DO MUNICÍPIO DO RIO DE JANEIRO. DESPESAS DECORRENTES<br>274</code> |
|
| 616 |
+
| <code>Praça Floriano, n. 55, sala 409 – Cinelândia - Centro. Rio de Janeiro – RJ. Brasil. CEP: 20.031-050. <br>Tel: (21) 2533-6008 [email protected] www.simonatopessoa.adv.br <br> <br>EXCELENTÍSSIMO SENHOR DOUTOR DESEMBARGADOR TERCEIRO <br>VICE-PRESIDENTE EDSON VASCONCELOS DO TRIBUNAL DE JUSTIÇA <br>DO ESTADO DO RIO DE JANEIRO. <br> <br>RECURSO ESPECIAL Nº 0466091-77.2015.8.19.0001<br> <br>Relator: <br>DES. MARCOS ANDRÉ CHUT <br>Apelante: <br>INSTITUTO SAO JOAO BATISTA LTDA - ISJOB <br>Apelado: <br>MUNICÍPIO DO RIO DE JANEIRO <br> <br>GRATUIDADE DE JUSTIÇA <br> <br> <br> <br> <br> <br>INSTITUTO SÃO JOÃO BAPTISTA LTDA – ISJOB<br>, com sede na Rua <br>Medina, 246, Méier, Rio de Janeiro – RJ. CEP: 20.735-130, inscrito no CNPJ/MF <br>sob nº 33.666.306/0001-30, nos autos do recurso de <br>Apelação<br> em epigrafe que <br>move em face do<br> MUNICÍPIO DO RIO DE JANEIRO<br>, por seu advogado, vem <br>respeitosamente à presença de Vossa Excelência, inconformado com a decisão <br>que inadmitiu o <br>RECUSOS ESPECIAL<br>, da lavra do Ilustre Desembargador <br>Terceiro Vice-Presi...</code> | <code>Praça Floriano, n. 55, sala 409 – Cinelândia - Centro. Rio de Janeiro – RJ. Brasil. CEP: 20.031-050. <br>Tel: (21) 2533-6008 [email protected] www.simonatopessoa.adv.br <br> <br>69. Assim, a partir do confronto destas datas não restam dúvidas de que as <br>obrigações em questão já se encontravam extintas. <br> <br>70. Neste sentido, resta evidente que a cobrança dos créditos tributários ora <br>contestados, encontra-se prescrita nos termos do caput do artigo 174 do <br>Código Tributário Nacional – CTN conforme o entendimento já <br>consolidado pelo Superior Tribunal de Justiça, conforme ementa abaixo <br>transcrita: <br> <br>“0010513-72.2004.8.19.0037 - APELACAO <br> <br>1ª Ementa <br>DES. JACQUELINE MONTENEGRO - Julgamento: 15/10/2015 - DECIMA <br>QUINTA CAMARA CIVEL <br> <br>APELAÇÃO CÍVEL. PROCESSUAL CIVIL. EXECUÇÃO FISCAL. IMPOSTO <br>SOBRE PROPRIEDADE TERRITORIAL URBANA ¿ IPTU, TAXA DE <br>SERVIÇOS URBANOS ¿ TSU E TAXA DE COLETA DE LIXO DOMICILIAR ¿ <br>TCDL DOS EXERCÍCIOS DE 1999 A 2003. MANDADO DE CITAÇÃO EM <br>EXEC...</code> |
|
| 617 |
+
* Loss: [<code>MultipleNegativesRankingLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#multiplenegativesrankingloss) with these parameters:
|
| 618 |
+
```json
|
| 619 |
+
{
|
| 620 |
+
"scale": 20.0,
|
| 621 |
+
"similarity_fct": "cos_sim",
|
| 622 |
+
"gather_across_devices": false
|
| 623 |
+
}
|
| 624 |
+
```
|
| 625 |
+
|
| 626 |
+
### Training Hyperparameters
|
| 627 |
+
#### Non-Default Hyperparameters
|
| 628 |
+
|
| 629 |
+
- `eval_strategy`: steps
|
| 630 |
+
- `per_device_train_batch_size`: 64
|
| 631 |
+
- `per_device_eval_batch_size`: 64
|
| 632 |
+
- `gradient_accumulation_steps`: 4
|
| 633 |
+
- `num_train_epochs`: 1
|
| 634 |
+
- `warmup_ratio`: 0.1
|
| 635 |
+
- `bf16`: True
|
| 636 |
+
- `optim`: adamw_8bit
|
| 637 |
+
- `gradient_checkpointing`: True
|
| 638 |
+
- `eval_on_start`: True
|
| 639 |
+
- `batch_sampler`: no_duplicates
|
| 640 |
+
|
| 641 |
+
#### All Hyperparameters
|
| 642 |
+
<details><summary>Click to expand</summary>
|
| 643 |
+
|
| 644 |
+
- `overwrite_output_dir`: False
|
| 645 |
+
- `do_predict`: False
|
| 646 |
+
- `eval_strategy`: steps
|
| 647 |
+
- `prediction_loss_only`: True
|
| 648 |
+
- `per_device_train_batch_size`: 64
|
| 649 |
+
- `per_device_eval_batch_size`: 64
|
| 650 |
+
- `per_gpu_train_batch_size`: None
|
| 651 |
+
- `per_gpu_eval_batch_size`: None
|
| 652 |
+
- `gradient_accumulation_steps`: 4
|
| 653 |
+
- `eval_accumulation_steps`: None
|
| 654 |
+
- `torch_empty_cache_steps`: None
|
| 655 |
+
- `learning_rate`: 5e-05
|
| 656 |
+
- `weight_decay`: 0.0
|
| 657 |
+
- `adam_beta1`: 0.9
|
| 658 |
+
- `adam_beta2`: 0.999
|
| 659 |
+
- `adam_epsilon`: 1e-08
|
| 660 |
+
- `max_grad_norm`: 1.0
|
| 661 |
+
- `num_train_epochs`: 1
|
| 662 |
+
- `max_steps`: -1
|
| 663 |
+
- `lr_scheduler_type`: linear
|
| 664 |
+
- `lr_scheduler_kwargs`: {}
|
| 665 |
+
- `warmup_ratio`: 0.1
|
| 666 |
+
- `warmup_steps`: 0
|
| 667 |
+
- `log_level`: passive
|
| 668 |
+
- `log_level_replica`: warning
|
| 669 |
+
- `log_on_each_node`: True
|
| 670 |
+
- `logging_nan_inf_filter`: True
|
| 671 |
+
- `save_safetensors`: True
|
| 672 |
+
- `save_on_each_node`: False
|
| 673 |
+
- `save_only_model`: False
|
| 674 |
+
- `restore_callback_states_from_checkpoint`: False
|
| 675 |
+
- `no_cuda`: False
|
| 676 |
+
- `use_cpu`: False
|
| 677 |
+
- `use_mps_device`: False
|
| 678 |
+
- `seed`: 42
|
| 679 |
+
- `data_seed`: None
|
| 680 |
+
- `jit_mode_eval`: False
|
| 681 |
+
- `use_ipex`: False
|
| 682 |
+
- `bf16`: True
|
| 683 |
+
- `fp16`: False
|
| 684 |
+
- `fp16_opt_level`: O1
|
| 685 |
+
- `half_precision_backend`: auto
|
| 686 |
+
- `bf16_full_eval`: False
|
| 687 |
+
- `fp16_full_eval`: False
|
| 688 |
+
- `tf32`: None
|
| 689 |
+
- `local_rank`: 0
|
| 690 |
+
- `ddp_backend`: None
|
| 691 |
+
- `tpu_num_cores`: None
|
| 692 |
+
- `tpu_metrics_debug`: False
|
| 693 |
+
- `debug`: []
|
| 694 |
+
- `dataloader_drop_last`: False
|
| 695 |
+
- `dataloader_num_workers`: 0
|
| 696 |
+
- `dataloader_prefetch_factor`: None
|
| 697 |
+
- `past_index`: -1
|
| 698 |
+
- `disable_tqdm`: False
|
| 699 |
+
- `remove_unused_columns`: True
|
| 700 |
+
- `label_names`: None
|
| 701 |
+
- `load_best_model_at_end`: False
|
| 702 |
+
- `ignore_data_skip`: False
|
| 703 |
+
- `fsdp`: []
|
| 704 |
+
- `fsdp_min_num_params`: 0
|
| 705 |
+
- `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
|
| 706 |
+
- `fsdp_transformer_layer_cls_to_wrap`: None
|
| 707 |
+
- `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
|
| 708 |
+
- `parallelism_config`: None
|
| 709 |
+
- `deepspeed`: None
|
| 710 |
+
- `label_smoothing_factor`: 0.0
|
| 711 |
+
- `optim`: adamw_8bit
|
| 712 |
+
- `optim_args`: None
|
| 713 |
+
- `adafactor`: False
|
| 714 |
+
- `group_by_length`: False
|
| 715 |
+
- `length_column_name`: length
|
| 716 |
+
- `ddp_find_unused_parameters`: None
|
| 717 |
+
- `ddp_bucket_cap_mb`: None
|
| 718 |
+
- `ddp_broadcast_buffers`: False
|
| 719 |
+
- `dataloader_pin_memory`: True
|
| 720 |
+
- `dataloader_persistent_workers`: False
|
| 721 |
+
- `skip_memory_metrics`: True
|
| 722 |
+
- `use_legacy_prediction_loop`: False
|
| 723 |
+
- `push_to_hub`: False
|
| 724 |
+
- `resume_from_checkpoint`: None
|
| 725 |
+
- `hub_model_id`: None
|
| 726 |
+
- `hub_strategy`: every_save
|
| 727 |
+
- `hub_private_repo`: None
|
| 728 |
+
- `hub_always_push`: False
|
| 729 |
+
- `hub_revision`: None
|
| 730 |
+
- `gradient_checkpointing`: True
|
| 731 |
+
- `gradient_checkpointing_kwargs`: None
|
| 732 |
+
- `include_inputs_for_metrics`: False
|
| 733 |
+
- `include_for_metrics`: []
|
| 734 |
+
- `eval_do_concat_batches`: True
|
| 735 |
+
- `fp16_backend`: auto
|
| 736 |
+
- `push_to_hub_model_id`: None
|
| 737 |
+
- `push_to_hub_organization`: None
|
| 738 |
+
- `mp_parameters`:
|
| 739 |
+
- `auto_find_batch_size`: False
|
| 740 |
+
- `full_determinism`: False
|
| 741 |
+
- `torchdynamo`: None
|
| 742 |
+
- `ray_scope`: last
|
| 743 |
+
- `ddp_timeout`: 1800
|
| 744 |
+
- `torch_compile`: False
|
| 745 |
+
- `torch_compile_backend`: None
|
| 746 |
+
- `torch_compile_mode`: None
|
| 747 |
+
- `include_tokens_per_second`: False
|
| 748 |
+
- `include_num_input_tokens_seen`: False
|
| 749 |
+
- `neftune_noise_alpha`: None
|
| 750 |
+
- `optim_target_modules`: None
|
| 751 |
+
- `batch_eval_metrics`: False
|
| 752 |
+
- `eval_on_start`: True
|
| 753 |
+
- `use_liger_kernel`: False
|
| 754 |
+
- `liger_kernel_config`: None
|
| 755 |
+
- `eval_use_gather_object`: False
|
| 756 |
+
- `average_tokens_across_devices`: False
|
| 757 |
+
- `prompts`: None
|
| 758 |
+
- `batch_sampler`: no_duplicates
|
| 759 |
+
- `multi_dataset_batch_sampler`: proportional
|
| 760 |
+
- `router_mapping`: {}
|
| 761 |
+
- `learning_rate_mapping`: {}
|
| 762 |
+
|
| 763 |
+
</details>
|
| 764 |
+
|
| 765 |
+
### Training Logs
|
| 766 |
+
| Epoch | Step | Training Loss | Validation Loss | cosine_ndcg@10 |
|
| 767 |
+
|:------:|:----:|:-------------:|:---------------:|:--------------:|
|
| 768 |
+
| 0 | 0 | - | 2.9505 | 0.1959 |
|
| 769 |
+
| 0.1011 | 79 | 1.7256 | 0.8699 | 0.4472 |
|
| 770 |
+
| 0.2022 | 158 | 0.8044 | 0.6145 | 0.5072 |
|
| 771 |
+
| 0.3034 | 237 | 0.6254 | 0.5068 | 0.5353 |
|
| 772 |
+
| 0.4045 | 316 | 0.5215 | 0.4230 | 0.5725 |
|
| 773 |
+
| 0.5056 | 395 | 0.4507 | 0.3787 | 0.5906 |
|
| 774 |
+
| 0.6067 | 474 | 0.4014 | 0.3429 | 0.6014 |
|
| 775 |
+
| 0.7078 | 553 | 0.3779 | 0.3279 | 0.6129 |
|
| 776 |
+
| 0.8090 | 632 | 0.3463 | 0.3099 | 0.6223 |
|
| 777 |
+
| 0.9101 | 711 | 0.3202 | 0.2974 | 0.6220 |
|
| 778 |
+
|
| 779 |
+
|
| 780 |
+
### Framework Versions
|
| 781 |
+
- Python: 3.12.11
|
| 782 |
+
- Sentence Transformers: 5.1.2
|
| 783 |
+
- Transformers: 4.57.0.dev0
|
| 784 |
+
- PyTorch: 2.9.0+cu128
|
| 785 |
+
- Accelerate: 1.11.0
|
| 786 |
+
- Datasets: 4.3.0
|
| 787 |
+
- Tokenizers: 0.22.1
|
| 788 |
+
|
| 789 |
+
## Citation
|
| 790 |
+
|
| 791 |
+
### BibTeX
|
| 792 |
+
|
| 793 |
+
#### Sentence Transformers
|
| 794 |
+
```bibtex
|
| 795 |
+
@inproceedings{reimers-2019-sentence-bert,
|
| 796 |
+
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
|
| 797 |
+
author = "Reimers, Nils and Gurevych, Iryna",
|
| 798 |
+
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
|
| 799 |
+
month = "11",
|
| 800 |
+
year = "2019",
|
| 801 |
+
publisher = "Association for Computational Linguistics",
|
| 802 |
+
url = "https://arxiv.org/abs/1908.10084",
|
| 803 |
+
}
|
| 804 |
+
```
|
| 805 |
+
|
| 806 |
+
#### MultipleNegativesRankingLoss
|
| 807 |
+
```bibtex
|
| 808 |
+
@misc{henderson2017efficient,
|
| 809 |
+
title={Efficient Natural Language Response Suggestion for Smart Reply},
|
| 810 |
+
author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
|
| 811 |
+
year={2017},
|
| 812 |
+
eprint={1705.00652},
|
| 813 |
+
archivePrefix={arXiv},
|
| 814 |
+
primaryClass={cs.CL}
|
| 815 |
+
}
|
| 816 |
+
```
|
| 817 |
+
|
| 818 |
+
<!--
|
| 819 |
+
## Glossary
|
| 820 |
+
|
| 821 |
+
*Clearly define terms in order to be accessible across audiences.*
|
| 822 |
+
-->
|
| 823 |
+
|
| 824 |
+
<!--
|
| 825 |
+
## Model Card Authors
|
| 826 |
+
|
| 827 |
+
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
|
| 828 |
+
-->
|
| 829 |
+
|
| 830 |
+
<!--
|
| 831 |
+
## Model Card Contact
|
| 832 |
+
|
| 833 |
+
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
|
| 834 |
+
-->
|
config.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"NewModel"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.0,
|
| 6 |
+
"auto_map": {
|
| 7 |
+
"AutoConfig": "configuration.NewConfig",
|
| 8 |
+
"AutoModel": "modeling.NewModel",
|
| 9 |
+
"AutoModelForMaskedLM": "Alibaba-NLP/new-impl--modeling.NewForMaskedLM",
|
| 10 |
+
"AutoModelForMultipleChoice": "Alibaba-NLP/new-impl--modeling.NewForMultipleChoice",
|
| 11 |
+
"AutoModelForQuestionAnswering": "Alibaba-NLP/new-impl--modeling.NewForQuestionAnswering",
|
| 12 |
+
"AutoModelForSequenceClassification": "Alibaba-NLP/new-impl--modeling.NewForSequenceClassification",
|
| 13 |
+
"AutoModelForTokenClassification": "Alibaba-NLP/new-impl--modeling.NewForTokenClassification"
|
| 14 |
+
},
|
| 15 |
+
"classifier_dropout": 0.0,
|
| 16 |
+
"dtype": "float32",
|
| 17 |
+
"hidden_act": "gelu",
|
| 18 |
+
"hidden_dropout_prob": 0.1,
|
| 19 |
+
"hidden_size": 768,
|
| 20 |
+
"id2label": {
|
| 21 |
+
"0": "LABEL_0"
|
| 22 |
+
},
|
| 23 |
+
"initializer_range": 0.02,
|
| 24 |
+
"intermediate_size": 3072,
|
| 25 |
+
"label2id": {
|
| 26 |
+
"LABEL_0": 0
|
| 27 |
+
},
|
| 28 |
+
"layer_norm_eps": 1e-12,
|
| 29 |
+
"layer_norm_type": "layer_norm",
|
| 30 |
+
"logn_attention_clip1": false,
|
| 31 |
+
"logn_attention_scale": false,
|
| 32 |
+
"max_position_embeddings": 8192,
|
| 33 |
+
"model_type": "new",
|
| 34 |
+
"num_attention_heads": 12,
|
| 35 |
+
"num_hidden_layers": 12,
|
| 36 |
+
"pack_qkv": true,
|
| 37 |
+
"pad_token_id": 1,
|
| 38 |
+
"position_embedding_type": "rope",
|
| 39 |
+
"rope_scaling": {
|
| 40 |
+
"factor": 8.0,
|
| 41 |
+
"type": "ntk"
|
| 42 |
+
},
|
| 43 |
+
"rope_theta": 20000,
|
| 44 |
+
"transformers_version": "4.57.0.dev0",
|
| 45 |
+
"type_vocab_size": 1,
|
| 46 |
+
"unpad_inputs": false,
|
| 47 |
+
"use_memory_efficient_attention": false,
|
| 48 |
+
"vocab_size": 250048
|
| 49 |
+
}
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "SentenceTransformer",
|
| 3 |
+
"__version__": {
|
| 4 |
+
"sentence_transformers": "5.1.2",
|
| 5 |
+
"transformers": "4.57.0.dev0",
|
| 6 |
+
"pytorch": "2.9.0+cu128"
|
| 7 |
+
},
|
| 8 |
+
"prompts": {
|
| 9 |
+
"query": "",
|
| 10 |
+
"document": ""
|
| 11 |
+
},
|
| 12 |
+
"default_prompt_name": null,
|
| 13 |
+
"similarity_fn_name": "cosine"
|
| 14 |
+
}
|
configuration.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2024 The GTE Team Authors and Alibaba Group.
|
| 3 |
+
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
""" NEW model configuration"""
|
| 17 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 18 |
+
from transformers.utils import logging
|
| 19 |
+
|
| 20 |
+
logger = logging.get_logger(__name__)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class NewConfig(PretrainedConfig):
|
| 24 |
+
r"""
|
| 25 |
+
This is the configuration class to store the configuration of a [`NewModel`] or a [`TFNewModel`]. It is used to
|
| 26 |
+
instantiate a NEW model according to the specified arguments, defining the model architecture. Instantiating a
|
| 27 |
+
configuration with the defaults will yield a similar configuration to that of the NEW
|
| 28 |
+
[izhx/new-base-en](https://huggingface.co/izhx/new-base-en) architecture.
|
| 29 |
+
|
| 30 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 31 |
+
documentation from [`PretrainedConfig`] for more information.
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
Args:
|
| 35 |
+
vocab_size (`int`, *optional*, defaults to 30522):
|
| 36 |
+
Vocabulary size of the NEW model. Defines the number of different tokens that can be represented by the
|
| 37 |
+
`inputs_ids` passed when calling [`NewModel`] or [`TFNewModel`].
|
| 38 |
+
hidden_size (`int`, *optional*, defaults to 768):
|
| 39 |
+
Dimensionality of the encoder layers and the pooler layer.
|
| 40 |
+
num_hidden_layers (`int`, *optional*, defaults to 12):
|
| 41 |
+
Number of hidden layers in the Transformer encoder.
|
| 42 |
+
num_attention_heads (`int`, *optional*, defaults to 12):
|
| 43 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
| 44 |
+
intermediate_size (`int`, *optional*, defaults to 3072):
|
| 45 |
+
Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
|
| 46 |
+
hidden_act (`str` or `Callable`, *optional*, defaults to `"gelu"`):
|
| 47 |
+
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
|
| 48 |
+
`"relu"`, `"silu"` and `"gelu_new"` are supported.
|
| 49 |
+
hidden_dropout_prob (`float`, *optional*, defaults to 0.1):
|
| 50 |
+
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
|
| 51 |
+
attention_probs_dropout_prob (`float`, *optional*, defaults to 0.1):
|
| 52 |
+
The dropout ratio for the attention probabilities.
|
| 53 |
+
max_position_embeddings (`int`, *optional*, defaults to 512):
|
| 54 |
+
The maximum sequence length that this model might ever be used with. Typically set this to something large
|
| 55 |
+
just in case (e.g., 512 or 1024 or 2048).
|
| 56 |
+
type_vocab_size (`int`, *optional*, defaults to 2):
|
| 57 |
+
The vocabulary size of the `token_type_ids` passed when calling [`NewModel`] or [`TFNewModel`].
|
| 58 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
| 59 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
| 60 |
+
layer_norm_eps (`float`, *optional*, defaults to 1e-12):
|
| 61 |
+
The epsilon used by the layer normalization layers.
|
| 62 |
+
position_embedding_type (`str`, *optional*, defaults to `"rope"`):
|
| 63 |
+
Type of position embedding. Choose one of `"absolute"`, `"rope"`.
|
| 64 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
| 65 |
+
The base period of the RoPE embeddings.
|
| 66 |
+
rope_scaling (`Dict`, *optional*):
|
| 67 |
+
Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
|
| 68 |
+
strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
|
| 69 |
+
`{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update
|
| 70 |
+
`max_position_embeddings` to the expected new maximum. See the following thread for more information on how
|
| 71 |
+
these scaling strategies behave:
|
| 72 |
+
https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/. This is an
|
| 73 |
+
experimental feature, subject to breaking API changes in future versions.
|
| 74 |
+
classifier_dropout (`float`, *optional*):
|
| 75 |
+
The dropout ratio for the classification head.
|
| 76 |
+
|
| 77 |
+
Examples:
|
| 78 |
+
|
| 79 |
+
```python
|
| 80 |
+
>>> from transformers import NewConfig, NewModel
|
| 81 |
+
|
| 82 |
+
>>> # Initializing a NEW izhx/new-base-en style configuration
|
| 83 |
+
>>> configuration = NewConfig()
|
| 84 |
+
|
| 85 |
+
>>> # Initializing a model (with random weights) from the izhx/new-base-en style configuration
|
| 86 |
+
>>> model = NewModel(configuration)
|
| 87 |
+
|
| 88 |
+
>>> # Accessing the model configuration
|
| 89 |
+
>>> configuration = model.config
|
| 90 |
+
```"""
|
| 91 |
+
|
| 92 |
+
model_type = "new"
|
| 93 |
+
|
| 94 |
+
def __init__(
|
| 95 |
+
self,
|
| 96 |
+
vocab_size=30528,
|
| 97 |
+
hidden_size=768,
|
| 98 |
+
num_hidden_layers=12,
|
| 99 |
+
num_attention_heads=12,
|
| 100 |
+
intermediate_size=3072,
|
| 101 |
+
hidden_act="gelu",
|
| 102 |
+
hidden_dropout_prob=0.1,
|
| 103 |
+
attention_probs_dropout_prob=0.0,
|
| 104 |
+
max_position_embeddings=2048,
|
| 105 |
+
type_vocab_size=1,
|
| 106 |
+
initializer_range=0.02,
|
| 107 |
+
layer_norm_type='layer_norm',
|
| 108 |
+
layer_norm_eps=1e-12,
|
| 109 |
+
# pad_token_id=0,
|
| 110 |
+
position_embedding_type="rope",
|
| 111 |
+
rope_theta=10000.0,
|
| 112 |
+
rope_scaling=None,
|
| 113 |
+
classifier_dropout=None,
|
| 114 |
+
pack_qkv=True,
|
| 115 |
+
unpad_inputs=False,
|
| 116 |
+
use_memory_efficient_attention=False,
|
| 117 |
+
logn_attention_scale=False,
|
| 118 |
+
logn_attention_clip1=False,
|
| 119 |
+
**kwargs,
|
| 120 |
+
):
|
| 121 |
+
super().__init__(**kwargs)
|
| 122 |
+
|
| 123 |
+
self.vocab_size = vocab_size
|
| 124 |
+
self.hidden_size = hidden_size
|
| 125 |
+
self.num_hidden_layers = num_hidden_layers
|
| 126 |
+
self.num_attention_heads = num_attention_heads
|
| 127 |
+
self.hidden_act = hidden_act
|
| 128 |
+
self.intermediate_size = intermediate_size
|
| 129 |
+
self.hidden_dropout_prob = hidden_dropout_prob
|
| 130 |
+
self.attention_probs_dropout_prob = attention_probs_dropout_prob
|
| 131 |
+
self.max_position_embeddings = max_position_embeddings
|
| 132 |
+
self.type_vocab_size = type_vocab_size
|
| 133 |
+
self.initializer_range = initializer_range
|
| 134 |
+
self.layer_norm_type = layer_norm_type
|
| 135 |
+
self.layer_norm_eps = layer_norm_eps
|
| 136 |
+
self.position_embedding_type = position_embedding_type
|
| 137 |
+
self.rope_theta = rope_theta
|
| 138 |
+
self.rope_scaling = rope_scaling
|
| 139 |
+
self.classifier_dropout = classifier_dropout
|
| 140 |
+
|
| 141 |
+
self.pack_qkv = pack_qkv
|
| 142 |
+
self.unpad_inputs = unpad_inputs
|
| 143 |
+
self.use_memory_efficient_attention = use_memory_efficient_attention
|
| 144 |
+
self.logn_attention_scale = logn_attention_scale
|
| 145 |
+
self.logn_attention_clip1 = logn_attention_clip1
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aaecab17eb05daa8280ee92d78079f248305f3e3cecb6294a0ae5d448bb96259
|
| 3 |
+
size 1221487872
|
modeling.py
ADDED
|
@@ -0,0 +1,1418 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2024 The GTE Team Authors and Alibaba Group.
|
| 3 |
+
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
"""PyTorch NEW model."""
|
| 17 |
+
|
| 18 |
+
import math
|
| 19 |
+
from dataclasses import dataclass
|
| 20 |
+
from typing import List, Optional, Tuple, Union
|
| 21 |
+
|
| 22 |
+
import torch
|
| 23 |
+
import torch.utils.checkpoint
|
| 24 |
+
from torch import nn
|
| 25 |
+
|
| 26 |
+
from transformers.activations import ACT2FN
|
| 27 |
+
from transformers.modeling_outputs import (
|
| 28 |
+
BaseModelOutput,
|
| 29 |
+
BaseModelOutputWithPooling,
|
| 30 |
+
MaskedLMOutput,
|
| 31 |
+
MultipleChoiceModelOutput,
|
| 32 |
+
QuestionAnsweringModelOutput,
|
| 33 |
+
SequenceClassifierOutput,
|
| 34 |
+
ModelOutput,
|
| 35 |
+
)
|
| 36 |
+
from transformers.modeling_utils import PreTrainedModel
|
| 37 |
+
from transformers.utils import logging
|
| 38 |
+
|
| 39 |
+
try:
|
| 40 |
+
import xformers.ops as xops
|
| 41 |
+
except ImportError as e:
|
| 42 |
+
xops = None
|
| 43 |
+
|
| 44 |
+
from .configuration import NewConfig
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
logger = logging.get_logger(__name__)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
# Adapted from https://github.com/HazyResearch/flash-attention/blob/main/flash_attn/bert_padding.py
|
| 51 |
+
# Which was adapted from https://github.com/mlcommons/training_results_v1.1/blob/main/NVIDIA/benchmarks/bert/implementations/pytorch/padding.py
|
| 52 |
+
class IndexFirstAxis(torch.autograd.Function):
|
| 53 |
+
@staticmethod
|
| 54 |
+
def forward(ctx, input, indices):
|
| 55 |
+
ctx.save_for_backward(indices)
|
| 56 |
+
assert input.ndim >= 2
|
| 57 |
+
ctx.first_axis_dim, other_shape = input.shape[0], input.shape[1:]
|
| 58 |
+
second_dim = other_shape.numel()
|
| 59 |
+
# TD [2022-03-04] For some reason torch.gather is a bit faster than indexing.
|
| 60 |
+
# return input[indices]
|
| 61 |
+
# return torch.gather(
|
| 62 |
+
# rearrange(input, "b ... -> b (...)"), 0, repeat(indices, "z -> z d", d=second_dim)
|
| 63 |
+
# ).reshape(-1, *other_shape)
|
| 64 |
+
return torch.gather(
|
| 65 |
+
input.view(ctx.first_axis_dim, second_dim),
|
| 66 |
+
0,
|
| 67 |
+
indices.unsqueeze(-1).expand(indices.size(0), second_dim)
|
| 68 |
+
).reshape(-1, *other_shape)
|
| 69 |
+
|
| 70 |
+
@staticmethod
|
| 71 |
+
def backward(ctx, grad_output):
|
| 72 |
+
(indices,) = ctx.saved_tensors
|
| 73 |
+
assert grad_output.ndim >= 2
|
| 74 |
+
other_shape = grad_output.shape[1:]
|
| 75 |
+
# grad_output = rearrange(grad_output, "b ... -> b (...)")
|
| 76 |
+
grad_output = grad_output.view(grad_output.size(0), other_shape.numel())
|
| 77 |
+
grad_input = torch.zeros(
|
| 78 |
+
[ctx.first_axis_dim, grad_output.shape[1]],
|
| 79 |
+
device=grad_output.device,
|
| 80 |
+
dtype=grad_output.dtype,
|
| 81 |
+
)
|
| 82 |
+
# TD [2022-03-04] For some reason torch.scatter is a bit faster than indexing.
|
| 83 |
+
# grad_input[indices] = grad_output
|
| 84 |
+
# grad_input.scatter_(0, repeat(indices, "z -> z d", d=grad_output.shape[1]), grad_output)
|
| 85 |
+
grad_input.scatter_(
|
| 86 |
+
0, indices.unsqueeze(-1).expand(indices.size(0), grad_output.size(1)), grad_output
|
| 87 |
+
)
|
| 88 |
+
return grad_input.reshape(ctx.first_axis_dim, *other_shape), None
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
index_first_axis = IndexFirstAxis.apply
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def unpad_input(hidden_states, attention_mask=None, indices=None):
|
| 95 |
+
"""
|
| 96 |
+
Arguments:
|
| 97 |
+
hidden_states: (batch, seqlen, ...)
|
| 98 |
+
attention_mask: (batch, seqlen), bool / int, 1 means valid and 0 means not valid.
|
| 99 |
+
indices: (total_nnz), the indices of non-masked tokens from the flattened input sequence.
|
| 100 |
+
Return:
|
| 101 |
+
hidden_states: (total_nnz, ...), where total_nnz = number of tokens in selected in attention_mask.
|
| 102 |
+
"""
|
| 103 |
+
if indices is None:
|
| 104 |
+
assert attention_mask is not None
|
| 105 |
+
indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
|
| 106 |
+
|
| 107 |
+
# TD [2022-03-04] We don't want to index with a bool mask, because Pytorch will expand the
|
| 108 |
+
# bool mask, then call nonzero to get the indices, then index with those. The indices is @dim
|
| 109 |
+
# times larger than it needs to be, wasting memory. It's faster and more memory-efficient to
|
| 110 |
+
# index with integer indices. Moreover, torch's index is a bit slower than it needs to be,
|
| 111 |
+
# so we write custom forward and backward to make it a bit faster.
|
| 112 |
+
hidden_states = hidden_states.view(-1, *hidden_states.shape[2:])
|
| 113 |
+
return index_first_axis(hidden_states, indices)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
class IndexPutFirstAxis(torch.autograd.Function):
|
| 117 |
+
@staticmethod
|
| 118 |
+
def forward(
|
| 119 |
+
ctx,
|
| 120 |
+
values: torch.Tensor,
|
| 121 |
+
indices: torch.Tensor,
|
| 122 |
+
first_axis_dim
|
| 123 |
+
) -> torch.Tensor:
|
| 124 |
+
ctx.save_for_backward(indices)
|
| 125 |
+
assert indices.ndim == 1
|
| 126 |
+
assert values.ndim >= 2
|
| 127 |
+
output = torch.zeros(
|
| 128 |
+
first_axis_dim, *values.shape[1:], device=values.device, dtype=values.dtype
|
| 129 |
+
)
|
| 130 |
+
output[indices] = values
|
| 131 |
+
return output
|
| 132 |
+
|
| 133 |
+
@staticmethod
|
| 134 |
+
def backward(ctx, grad_output: torch.Tensor) -> Tuple[torch.Tensor, None, None]:
|
| 135 |
+
indices, = ctx.saved_tensors
|
| 136 |
+
grad_values = grad_output[indices]
|
| 137 |
+
return grad_values, None, None
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
index_put_first_axis = IndexPutFirstAxis.apply
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def pad_input(inputs: torch.Tensor, indices: torch.Tensor, batch: int, seqlen: int) -> torch.Tensor:
|
| 144 |
+
"""Add padding to sequences.
|
| 145 |
+
|
| 146 |
+
Arguments:
|
| 147 |
+
inputs: (total_nnz, ...), where total_nnz = number of tokens in selected in attention_mask.
|
| 148 |
+
indices: (total_nnz), `indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()`
|
| 149 |
+
batch: int batch_size
|
| 150 |
+
seqlen: int max sequence length
|
| 151 |
+
|
| 152 |
+
Returns:
|
| 153 |
+
inputs: (batch, seqlen, ...)
|
| 154 |
+
"""
|
| 155 |
+
output = index_put_first_axis(inputs, indices, batch * seqlen)
|
| 156 |
+
return output.view(batch, seqlen, *inputs.shape[1:])
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def rotate_half(x):
|
| 160 |
+
"""Rotates half the hidden dims of the input."""
|
| 161 |
+
x1 = x[..., : x.shape[-1] // 2]
|
| 162 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
| 163 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
def apply_rotary_pos_emb(q, k, cos, sin):
|
| 167 |
+
"""Applies Rotary Position Embedding to the query and key tensors.
|
| 168 |
+
|
| 169 |
+
Args:
|
| 170 |
+
q (`torch.Tensor`): The query tensor.
|
| 171 |
+
k (`torch.Tensor`): The key tensor.
|
| 172 |
+
cos (`torch.Tensor`): The cosine part of the rotary embedding.
|
| 173 |
+
sin (`torch.Tensor`): The sine part of the rotary embedding.
|
| 174 |
+
Returns:
|
| 175 |
+
`tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
|
| 176 |
+
"""
|
| 177 |
+
cos, sin = cos.to(q.dtype), sin.to(q.dtype)
|
| 178 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
| 179 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
| 180 |
+
return q_embed, k_embed
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
class RotaryEmbedding(torch.nn.Module):
|
| 184 |
+
def __init__(self, dim, max_position_embeddings=512, base=10000.0, device=None):
|
| 185 |
+
super().__init__()
|
| 186 |
+
|
| 187 |
+
self.dim = dim
|
| 188 |
+
self.max_position_embeddings = max_position_embeddings
|
| 189 |
+
self.base = base
|
| 190 |
+
inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
|
| 191 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
| 192 |
+
|
| 193 |
+
# Build here to make `torch.jit.trace` work.
|
| 194 |
+
self._set_cos_sin_cache(
|
| 195 |
+
seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()
|
| 196 |
+
)
|
| 197 |
+
|
| 198 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
| 199 |
+
self.max_seq_len_cached = seq_len
|
| 200 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.float32)
|
| 201 |
+
|
| 202 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
| 203 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
| 204 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 205 |
+
self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
|
| 206 |
+
self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
|
| 207 |
+
|
| 208 |
+
def forward(self, x, seq_len=None):
|
| 209 |
+
# x: [bs, num_attention_heads, seq_len, head_size]
|
| 210 |
+
if seq_len > self.max_seq_len_cached:
|
| 211 |
+
self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
|
| 212 |
+
|
| 213 |
+
return (
|
| 214 |
+
self.cos_cached[:seq_len, ...].to(dtype=x.dtype),
|
| 215 |
+
self.sin_cached[:seq_len, ...].to(dtype=x.dtype),
|
| 216 |
+
)
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
class NTKScalingRotaryEmbedding(RotaryEmbedding):
|
| 220 |
+
"""RotaryEmbedding extended with fixed and mixed NTK scaling. https://kexue.fm/archives/9706 """
|
| 221 |
+
|
| 222 |
+
def __init__(self, dim, max_position_embeddings=512, base=10000, device=None, scaling_factor=1.0, mixed_b=None):
|
| 223 |
+
self.scaling_factor = scaling_factor
|
| 224 |
+
self.mixed_b = mixed_b
|
| 225 |
+
super().__init__(dim, max_position_embeddings, base, device)
|
| 226 |
+
max_position_embeddings = max_position_embeddings * self.scaling_factor
|
| 227 |
+
self._set_cos_sin_cache(max_position_embeddings, self.inv_freq.device, torch.get_default_dtype())
|
| 228 |
+
|
| 229 |
+
def _set_cos_sin_cache(self, seq_len, device, dtype):
|
| 230 |
+
self.max_seq_len_cached = seq_len
|
| 231 |
+
|
| 232 |
+
if seq_len > self.max_position_embeddings:
|
| 233 |
+
base = self.base * (self.scaling_factor if self.mixed_b is None else 1)
|
| 234 |
+
inv_freq = 1.0 / (base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
|
| 235 |
+
|
| 236 |
+
if self.mixed_b is None:
|
| 237 |
+
inv_freq = inv_freq / self.scaling_factor ** (2 / self.dim) # (6)
|
| 238 |
+
else:
|
| 239 |
+
a = torch.tensor(self.scaling_factor).log() / (self.dim / 2) ** self.mixed_b # (13)
|
| 240 |
+
lambda_1_m = (a * torch.arange(1, self.dim // 2 + 1).float().to(device) ** self.mixed_b).exp() # (12)
|
| 241 |
+
inv_freq = inv_freq / lambda_1_m # (10)
|
| 242 |
+
|
| 243 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
| 244 |
+
|
| 245 |
+
t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.float32)
|
| 246 |
+
|
| 247 |
+
freqs = torch.einsum("i,j->ij", t, self.inv_freq)
|
| 248 |
+
# Different from paper, but it uses a different permutation in order to obtain the same calculation
|
| 249 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 250 |
+
self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
|
| 251 |
+
self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
class RMSNorm(nn.Module):
|
| 255 |
+
def __init__(self, hidden_size, eps=1e-6):
|
| 256 |
+
"""
|
| 257 |
+
RMSNorm is equivalent to T5LayerNorm
|
| 258 |
+
"""
|
| 259 |
+
super().__init__()
|
| 260 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
| 261 |
+
self.variance_epsilon = eps
|
| 262 |
+
|
| 263 |
+
def forward(self, hidden_states):
|
| 264 |
+
input_dtype = hidden_states.dtype
|
| 265 |
+
hidden_states = hidden_states.to(torch.float32)
|
| 266 |
+
variance = hidden_states.pow(2).mean(-1, keepdim=True)
|
| 267 |
+
hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
|
| 268 |
+
return self.weight * hidden_states.to(input_dtype)
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
LAYER_NORM = {
|
| 272 |
+
'layer_norm': nn.LayerNorm,
|
| 273 |
+
'rms_norm': RMSNorm
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
class NewEmbeddings(nn.Module):
|
| 278 |
+
"""
|
| 279 |
+
Embedding and Unpadding.
|
| 280 |
+
"""
|
| 281 |
+
|
| 282 |
+
def __init__(self, config: NewConfig):
|
| 283 |
+
super().__init__()
|
| 284 |
+
self.padding_idx = config.pad_token_id
|
| 285 |
+
self.word_embeddings = nn.Embedding(
|
| 286 |
+
config.vocab_size, config.hidden_size, padding_idx=self.padding_idx
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
self.position_embedding_type = config.position_embedding_type
|
| 290 |
+
if self.position_embedding_type == 'absolute':
|
| 291 |
+
self.position_embeddings = nn.Embedding(
|
| 292 |
+
config.max_position_embeddings, config.hidden_size, padding_idx=self.padding_idx
|
| 293 |
+
)
|
| 294 |
+
elif self.position_embedding_type == 'rope':
|
| 295 |
+
self._init_rope(config)
|
| 296 |
+
else:
|
| 297 |
+
raise ValueError
|
| 298 |
+
|
| 299 |
+
self.type_vocab_size = config.type_vocab_size
|
| 300 |
+
if self.type_vocab_size > 0:
|
| 301 |
+
self.token_type_embeddings = nn.Embedding(config.type_vocab_size, config.hidden_size)
|
| 302 |
+
|
| 303 |
+
# self.LayerNorm is not snake-cased to stick with TensorFlow model variable name and be able to load
|
| 304 |
+
# any TensorFlow checkpoint file
|
| 305 |
+
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
|
| 306 |
+
self.dropout = nn.Dropout(config.hidden_dropout_prob)
|
| 307 |
+
# position_ids is contiguous in memory and excluded when serialized
|
| 308 |
+
self.register_buffer(
|
| 309 |
+
"position_ids", torch.arange(config.max_position_embeddings), persistent=False
|
| 310 |
+
)
|
| 311 |
+
|
| 312 |
+
def _init_rope(self, config):
|
| 313 |
+
kwargs = dict(
|
| 314 |
+
dim=int(config.hidden_size / config.num_attention_heads),
|
| 315 |
+
max_position_embeddings=config.max_position_embeddings,
|
| 316 |
+
base=config.rope_theta
|
| 317 |
+
)
|
| 318 |
+
if config.rope_scaling is None:
|
| 319 |
+
self.rotary_emb = RotaryEmbedding(**kwargs)
|
| 320 |
+
else:
|
| 321 |
+
kwargs.update(scaling_factor=config.rope_scaling["factor"])
|
| 322 |
+
scaling_type = config.rope_scaling["type"]
|
| 323 |
+
if scaling_type == 'ntk':
|
| 324 |
+
kwargs.update(mixed_b=config.rope_scaling.get('mixed_b', None))
|
| 325 |
+
self.rotary_emb = NTKScalingRotaryEmbedding(**kwargs)
|
| 326 |
+
# elif scaling_type == "linear":
|
| 327 |
+
# self.rotary_emb = LinearScalingRotaryEmbedding(**kwargs)
|
| 328 |
+
# elif scaling_type == "dynamic":
|
| 329 |
+
# self.rotary_emb = DynamicNTKScalingRotaryEmbedding(**kwargs)
|
| 330 |
+
else:
|
| 331 |
+
raise ValueError(f"Unknown RoPE scaling type {scaling_type}")
|
| 332 |
+
|
| 333 |
+
def forward(
|
| 334 |
+
self,
|
| 335 |
+
unpad_inputs: bool,
|
| 336 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 337 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 338 |
+
length: Optional[List[int]] = None,
|
| 339 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 340 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 341 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 342 |
+
) -> Tuple[torch.Tensor, torch.Tensor, Optional[Tuple], Optional[List[int]]]:
|
| 343 |
+
"""
|
| 344 |
+
"""
|
| 345 |
+
if inputs_embeds is None:
|
| 346 |
+
device, input_shape = input_ids.device, input_ids.shape
|
| 347 |
+
else:
|
| 348 |
+
device, input_shape = inputs_embeds.device, inputs_embeds.shape[:2]
|
| 349 |
+
batch_size, seq_length = input_shape
|
| 350 |
+
|
| 351 |
+
# Set attention_mask if it's None
|
| 352 |
+
if attention_mask is None:
|
| 353 |
+
attention_mask = torch.ones(input_shape, device=device)
|
| 354 |
+
if length is not None:
|
| 355 |
+
for i, l in enumerate(length):
|
| 356 |
+
attention_mask[i, l:] = 0
|
| 357 |
+
|
| 358 |
+
# Set attention_mask_bool for unpadding
|
| 359 |
+
if unpad_inputs:
|
| 360 |
+
attention_mask_bool = attention_mask.bool()
|
| 361 |
+
if length is None:
|
| 362 |
+
length = attention_mask.sum(-1).tolist()
|
| 363 |
+
|
| 364 |
+
# Get word embeddings
|
| 365 |
+
if inputs_embeds is None:
|
| 366 |
+
if unpad_inputs:
|
| 367 |
+
input_ids = input_ids[attention_mask_bool].unsqueeze(0)
|
| 368 |
+
inputs_embeds = self.word_embeddings(input_ids)
|
| 369 |
+
else:
|
| 370 |
+
if unpad_inputs:
|
| 371 |
+
inputs_embeds = inputs_embeds[attention_mask_bool].unsqueeze(0)
|
| 372 |
+
embeddings = inputs_embeds
|
| 373 |
+
|
| 374 |
+
# Set and unpad position_ids
|
| 375 |
+
if position_ids is None:
|
| 376 |
+
if seq_length > self.position_ids.size(0):
|
| 377 |
+
self.register_buffer(
|
| 378 |
+
"position_ids", torch.arange(seq_length, device=embeddings.device), persistent=False
|
| 379 |
+
)
|
| 380 |
+
if unpad_inputs:
|
| 381 |
+
# [1, cumsum_seq_len]
|
| 382 |
+
position_ids = torch.cat([self.position_ids[:l] for l in length]).unsqueeze(0)
|
| 383 |
+
else:
|
| 384 |
+
# [bs, seq_len]
|
| 385 |
+
position_ids = self.position_ids[:seq_length].expand(batch_size, -1)
|
| 386 |
+
elif unpad_inputs:
|
| 387 |
+
position_ids = position_ids[attention_mask_bool].unsqueeze(0) # [1, cumsum_seq_len]
|
| 388 |
+
|
| 389 |
+
# Compute rotary embedding
|
| 390 |
+
if self.position_embedding_type == 'rope':
|
| 391 |
+
rope_cos, rope_sin = self.rotary_emb(inputs_embeds, seq_len=seq_length)
|
| 392 |
+
rope_cos = rope_cos[position_ids].unsqueeze(2) # [bs, seq_len, 1, dim]
|
| 393 |
+
rope_sin = rope_sin[position_ids].unsqueeze(2) # [bs, seq_len, 1, dim]
|
| 394 |
+
rope_embeds = rope_cos, rope_sin
|
| 395 |
+
else:
|
| 396 |
+
rope_embeds = None
|
| 397 |
+
|
| 398 |
+
if self.type_vocab_size > 0:
|
| 399 |
+
if token_type_ids is None:
|
| 400 |
+
token_type_ids = position_ids.mul(0)
|
| 401 |
+
else:
|
| 402 |
+
if self.type_vocab_size < 2:
|
| 403 |
+
token_type_ids.mul_(0)
|
| 404 |
+
if unpad_inputs:
|
| 405 |
+
token_type_ids = token_type_ids[attention_mask_bool].unsqueeze(0)
|
| 406 |
+
|
| 407 |
+
token_type_embeddings = self.token_type_embeddings(token_type_ids)
|
| 408 |
+
embeddings = embeddings + token_type_embeddings
|
| 409 |
+
|
| 410 |
+
# BERT position
|
| 411 |
+
if self.position_embedding_type == "absolute":
|
| 412 |
+
position_embeddings = self.position_embeddings(position_ids)
|
| 413 |
+
embeddings = embeddings + position_embeddings
|
| 414 |
+
|
| 415 |
+
embeddings = self.LayerNorm(embeddings)
|
| 416 |
+
embeddings = self.dropout(embeddings)
|
| 417 |
+
|
| 418 |
+
return embeddings, attention_mask, rope_embeds, length
|
| 419 |
+
|
| 420 |
+
|
| 421 |
+
class NewAttention(nn.Module):
|
| 422 |
+
def __init__(self, config: NewConfig, pack_qkv=None, use_memory_efficient_attention=None):
|
| 423 |
+
super().__init__()
|
| 424 |
+
self.config = config
|
| 425 |
+
if config.hidden_size % config.num_attention_heads != 0 and not hasattr(config, "embedding_size"):
|
| 426 |
+
raise ValueError(
|
| 427 |
+
f"The hidden size ({config.hidden_size}) is not a multiple of the number of attention "
|
| 428 |
+
f"heads ({config.num_attention_heads})"
|
| 429 |
+
)
|
| 430 |
+
|
| 431 |
+
self.hidden_size = config.hidden_size
|
| 432 |
+
self.num_attention_heads = config.num_attention_heads
|
| 433 |
+
self.attention_head_size = int(config.hidden_size / config.num_attention_heads)
|
| 434 |
+
self.all_head_size = self.num_attention_heads * self.attention_head_size
|
| 435 |
+
|
| 436 |
+
if pack_qkv is None:
|
| 437 |
+
pack_qkv = config.pack_qkv
|
| 438 |
+
self.pack_qkv = pack_qkv
|
| 439 |
+
|
| 440 |
+
if self.pack_qkv:
|
| 441 |
+
self.qkv_proj = nn.Linear(config.hidden_size, self.all_head_size * 3, bias=True)
|
| 442 |
+
else:
|
| 443 |
+
self.q_proj = nn.Linear(config.hidden_size, self.all_head_size, bias=True)
|
| 444 |
+
self.k_proj = nn.Linear(config.hidden_size, self.all_head_size, bias=True)
|
| 445 |
+
self.v_proj = nn.Linear(config.hidden_size, self.all_head_size, bias=True)
|
| 446 |
+
|
| 447 |
+
self.dropout = nn.Dropout(config.attention_probs_dropout_prob)
|
| 448 |
+
self.o_proj = nn.Linear(config.hidden_size, config.hidden_size, bias=True)
|
| 449 |
+
|
| 450 |
+
if use_memory_efficient_attention is None:
|
| 451 |
+
use_memory_efficient_attention = self.config.use_memory_efficient_attention
|
| 452 |
+
self.use_memory_efficient_attention = use_memory_efficient_attention
|
| 453 |
+
self.memory_efficient_attention = None if xops is None else xops.memory_efficient_attention
|
| 454 |
+
if self.use_memory_efficient_attention:
|
| 455 |
+
assert self.memory_efficient_attention is not None, 'please install xformers'
|
| 456 |
+
|
| 457 |
+
def forward(
|
| 458 |
+
self,
|
| 459 |
+
hidden_states: torch.Tensor,
|
| 460 |
+
attention_bias: torch.FloatTensor,
|
| 461 |
+
rope_embeds: Optional[Tuple[torch.FloatTensor, torch.FloatTensor]] = None,
|
| 462 |
+
padding_inputs: Optional[Tuple] = None, # indices, batch, seqlen
|
| 463 |
+
attention_scale: Optional[torch.FloatTensor] = None,
|
| 464 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
| 465 |
+
output_attentions: Optional[bool] = False,
|
| 466 |
+
qkv_inputs: Optional[Tuple] = None, # For RetroMAE
|
| 467 |
+
) -> Tuple[torch.Tensor, ...]:
|
| 468 |
+
shape_hd = (self.num_attention_heads, self.attention_head_size)
|
| 469 |
+
# qkv
|
| 470 |
+
if self.pack_qkv and qkv_inputs is None:
|
| 471 |
+
qkv_pack = self.qkv_proj(hidden_states).split(self.all_head_size, dim=-1)
|
| 472 |
+
else:
|
| 473 |
+
if qkv_inputs is None:
|
| 474 |
+
qkv_inputs = (hidden_states, hidden_states, hidden_states)
|
| 475 |
+
qkv_pack = [
|
| 476 |
+
getattr(self, n + '_proj')(s) for s, n in zip(qkv_inputs, 'qkv')
|
| 477 |
+
]
|
| 478 |
+
query_states, key_states, value_states = [t.view(t.shape[:-1] + shape_hd) for t in qkv_pack]
|
| 479 |
+
|
| 480 |
+
if self.config.position_embedding_type == 'rope':
|
| 481 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, *rope_embeds)
|
| 482 |
+
|
| 483 |
+
dtype = query_states.dtype
|
| 484 |
+
|
| 485 |
+
if self.config.logn_attention_scale and attention_scale is not None:
|
| 486 |
+
# https://kexue.fm/archives/8823
|
| 487 |
+
query_states = query_states * attention_scale.to(dtype)
|
| 488 |
+
|
| 489 |
+
if padding_inputs is not None:
|
| 490 |
+
query_states = pad_input(query_states.squeeze(), *padding_inputs)
|
| 491 |
+
key_states = pad_input(key_states.squeeze(), *padding_inputs)
|
| 492 |
+
value_states = pad_input(value_states.squeeze(), *padding_inputs)
|
| 493 |
+
|
| 494 |
+
if self.use_memory_efficient_attention:
|
| 495 |
+
assert self.memory_efficient_attention is not None, "xformers is not loaded"
|
| 496 |
+
assert output_attentions is False, "memory_efficient_attention do not output attentions"
|
| 497 |
+
assert head_mask is None, "Not support yet"
|
| 498 |
+
attention_probs = None
|
| 499 |
+
if torch.is_tensor(attention_bias):
|
| 500 |
+
attention_bias = attention_bias.to(dtype)
|
| 501 |
+
context_layer = self.memory_efficient_attention(
|
| 502 |
+
query_states,
|
| 503 |
+
key_states,
|
| 504 |
+
value_states,
|
| 505 |
+
attn_bias=attention_bias,
|
| 506 |
+
p=self.dropout.p
|
| 507 |
+
)
|
| 508 |
+
else:
|
| 509 |
+
if output_attentions and isinstance(self, NewSdpaAttention):
|
| 510 |
+
raise RuntimeError("SDPA do not output attentions")
|
| 511 |
+
context_layer, attention_probs = self._attention(
|
| 512 |
+
query_states, key_states, value_states, attention_bias, head_mask
|
| 513 |
+
)
|
| 514 |
+
|
| 515 |
+
if padding_inputs is not None:
|
| 516 |
+
context_layer = unpad_input(context_layer, indices=padding_inputs[0])
|
| 517 |
+
|
| 518 |
+
new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,)
|
| 519 |
+
context_layer = context_layer.view(new_context_layer_shape)
|
| 520 |
+
|
| 521 |
+
# output proj
|
| 522 |
+
attn_output = self.o_proj(context_layer)
|
| 523 |
+
|
| 524 |
+
# add attentions if we output them
|
| 525 |
+
outputs = (attn_output, attention_probs) if output_attentions else (attn_output,)
|
| 526 |
+
return outputs
|
| 527 |
+
|
| 528 |
+
def _attention(self, query_states, key_states, value_states, attention_bias, head_mask):
|
| 529 |
+
"""
|
| 530 |
+
Args:
|
| 531 |
+
q/k/v: (B, L, n_head, head_dim),
|
| 532 |
+
Returns:
|
| 533 |
+
attn_output: (B L, n_head, head_dim)
|
| 534 |
+
"""
|
| 535 |
+
query_states = query_states.transpose(1, 2)
|
| 536 |
+
key_states = key_states.transpose(1, 2)
|
| 537 |
+
value_states = value_states.transpose(1, 2)
|
| 538 |
+
# Take the dot product between "query" and "key" to get the raw attention scores.
|
| 539 |
+
attention_scores = torch.matmul(query_states, key_states.transpose(-1, -2))
|
| 540 |
+
|
| 541 |
+
attention_scores = attention_scores / math.sqrt(self.attention_head_size)
|
| 542 |
+
if attention_bias is not None:
|
| 543 |
+
# Apply the attention mask is (precomputed for all layers in BertModel forward() function)
|
| 544 |
+
attention_scores = attention_scores + attention_bias
|
| 545 |
+
|
| 546 |
+
# Normalize the attention scores to probabilities.
|
| 547 |
+
attention_probs = nn.functional.softmax(attention_scores, dim=-1)
|
| 548 |
+
|
| 549 |
+
# This is actually dropping out entire tokens to attend to, which might
|
| 550 |
+
# seem a bit unusual, but is taken from the original Transformer paper.
|
| 551 |
+
if self.dropout.p > 0:
|
| 552 |
+
attention_probs = self.dropout(attention_probs)
|
| 553 |
+
|
| 554 |
+
# Mask heads if we want to
|
| 555 |
+
if head_mask is not None:
|
| 556 |
+
attention_probs = attention_probs * head_mask
|
| 557 |
+
|
| 558 |
+
context_layer = torch.matmul(attention_probs, value_states)
|
| 559 |
+
|
| 560 |
+
context_layer = context_layer.permute(0, 2, 1, 3).contiguous()
|
| 561 |
+
return context_layer, attention_probs
|
| 562 |
+
|
| 563 |
+
|
| 564 |
+
class NewSdpaAttention(NewAttention):
|
| 565 |
+
"""
|
| 566 |
+
New attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
|
| 567 |
+
`NewAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
|
| 568 |
+
SDPA API.
|
| 569 |
+
"""
|
| 570 |
+
def __init__(self, config: NewConfig, **kwargs):
|
| 571 |
+
super().__init__(config, **kwargs)
|
| 572 |
+
# torch.backends.cuda.enable_mem_efficient_sdp(False)
|
| 573 |
+
# logger.warning(
|
| 574 |
+
# "Disable memory efficient attention kernel for `NewSdpaAttention`, you can set "
|
| 575 |
+
# "`use_memory_efficient_attention=True` if it expected to use."
|
| 576 |
+
# )
|
| 577 |
+
|
| 578 |
+
def _attention(self, query_states, key_states, value_states, attention_bias, head_mask):
|
| 579 |
+
attn_output = torch.nn.functional.scaled_dot_product_attention(
|
| 580 |
+
query_states.transpose(1, 2),
|
| 581 |
+
key_states.transpose(1, 2),
|
| 582 |
+
value_states.transpose(1, 2),
|
| 583 |
+
attn_mask=attention_bias,
|
| 584 |
+
dropout_p=self.dropout.p if self.training else 0.0,
|
| 585 |
+
)
|
| 586 |
+
attn_output = attn_output.permute(0, 2, 1, 3).contiguous()
|
| 587 |
+
return attn_output, None
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
NEW_ATTENTION_CLASSES = {
|
| 591 |
+
"eager": NewAttention,
|
| 592 |
+
# "flash_attention_2": , # TODO
|
| 593 |
+
"sdpa": NewSdpaAttention,
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
|
| 597 |
+
class NewGatedMLP(nn.Module):
|
| 598 |
+
"""
|
| 599 |
+
GLU Variants Improve Transformer.
|
| 600 |
+
"""
|
| 601 |
+
|
| 602 |
+
def __init__(self, config: NewConfig):
|
| 603 |
+
super().__init__()
|
| 604 |
+
self.intermediate_size = config.intermediate_size
|
| 605 |
+
self.up_gate_proj = nn.Linear(config.hidden_size, self.intermediate_size * 2, bias=False)
|
| 606 |
+
self.down_proj = nn.Linear(self.intermediate_size, config.hidden_size, bias=True)
|
| 607 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
| 608 |
+
if config.hidden_dropout_prob > 0:
|
| 609 |
+
self.hidden_dropout = nn.Dropout(config.hidden_dropout_prob)
|
| 610 |
+
else:
|
| 611 |
+
self.hidden_dropout = None
|
| 612 |
+
|
| 613 |
+
def forward(self, hidden_states):
|
| 614 |
+
up_gate = self.up_gate_proj(hidden_states)
|
| 615 |
+
up_states, gate = torch.split(up_gate, self.intermediate_size, dim=-1)
|
| 616 |
+
gate = self.act_fn(gate)
|
| 617 |
+
gated_states = gate * up_states
|
| 618 |
+
if self.hidden_dropout is not None:
|
| 619 |
+
gated_states = self.hidden_dropout(gated_states)
|
| 620 |
+
down_states = self.down_proj(gated_states)
|
| 621 |
+
return down_states
|
| 622 |
+
|
| 623 |
+
|
| 624 |
+
class NewLayer(nn.Module):
|
| 625 |
+
def __init__(
|
| 626 |
+
self,
|
| 627 |
+
config: NewConfig,
|
| 628 |
+
pack_qkv=None,
|
| 629 |
+
use_memory_efficient_attention=None,
|
| 630 |
+
attn_implementation=None
|
| 631 |
+
):
|
| 632 |
+
super().__init__()
|
| 633 |
+
if attn_implementation is None:
|
| 634 |
+
attn_implementation = config._attn_implementation
|
| 635 |
+
if use_memory_efficient_attention is None:
|
| 636 |
+
use_memory_efficient_attention = config.use_memory_efficient_attention
|
| 637 |
+
if use_memory_efficient_attention:
|
| 638 |
+
if attn_implementation != 'eager':
|
| 639 |
+
logger.warning_once(f"Override {attn_implementation=} to 'eager' as {use_memory_efficient_attention=}")
|
| 640 |
+
attn_implementation = 'eager' # Since it will be SDPA by default for torch>=2.1.1
|
| 641 |
+
self.attention = NEW_ATTENTION_CLASSES[attn_implementation](
|
| 642 |
+
config, pack_qkv=pack_qkv, use_memory_efficient_attention=use_memory_efficient_attention
|
| 643 |
+
)
|
| 644 |
+
self.mlp = NewGatedMLP(config)
|
| 645 |
+
|
| 646 |
+
ln_class = LAYER_NORM[config.layer_norm_type]
|
| 647 |
+
self.attn_ln = ln_class(config.hidden_size, eps=config.layer_norm_eps)
|
| 648 |
+
self.mlp_ln = ln_class(config.hidden_size, eps=config.layer_norm_eps)
|
| 649 |
+
|
| 650 |
+
if config.hidden_dropout_prob > 0:
|
| 651 |
+
self.hidden_dropout = nn.Dropout(config.hidden_dropout_prob)
|
| 652 |
+
else:
|
| 653 |
+
self.hidden_dropout = None
|
| 654 |
+
|
| 655 |
+
def forward(
|
| 656 |
+
self,
|
| 657 |
+
hidden_states: torch.Tensor,
|
| 658 |
+
attention_bias: torch.FloatTensor,
|
| 659 |
+
rope_embeds: Optional[Tuple[torch.FloatTensor, torch.FloatTensor]] = None,
|
| 660 |
+
padding_inputs: Optional[Tuple] = None, # indices, batch, seqlen
|
| 661 |
+
attention_scale: Optional[torch.FloatTensor] = None,
|
| 662 |
+
subset_indices: Optional[torch.LongTensor] = None,
|
| 663 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
| 664 |
+
output_attentions: Optional[bool] = False,
|
| 665 |
+
qkv_inputs: Optional[Tuple] = None, # For RetroMAE
|
| 666 |
+
) -> Tuple[torch.Tensor, ...]:
|
| 667 |
+
# Multi head self attention
|
| 668 |
+
residual = hidden_states if qkv_inputs is None else qkv_inputs[0]
|
| 669 |
+
attention_outputs = self.attention(
|
| 670 |
+
hidden_states,
|
| 671 |
+
attention_bias,
|
| 672 |
+
rope_embeds,
|
| 673 |
+
padding_inputs,
|
| 674 |
+
attention_scale,
|
| 675 |
+
head_mask,
|
| 676 |
+
output_attentions=output_attentions,
|
| 677 |
+
qkv_inputs=qkv_inputs,
|
| 678 |
+
)
|
| 679 |
+
hidden_states = attention_outputs[0]
|
| 680 |
+
if self.hidden_dropout is not None:
|
| 681 |
+
hidden_states = self.hidden_dropout(hidden_states)
|
| 682 |
+
hidden_states = residual + hidden_states
|
| 683 |
+
|
| 684 |
+
# In pretraining, after the attention of last layer, we only need the masked tokens.
|
| 685 |
+
if subset_indices is not None:
|
| 686 |
+
hidden_states = hidden_states[subset_indices]
|
| 687 |
+
|
| 688 |
+
hidden_states = self.attn_ln(hidden_states)
|
| 689 |
+
|
| 690 |
+
# Fully Connected
|
| 691 |
+
residual = hidden_states
|
| 692 |
+
hidden_states = self.mlp(hidden_states)
|
| 693 |
+
if self.hidden_dropout is not None:
|
| 694 |
+
hidden_states = self.hidden_dropout(hidden_states)
|
| 695 |
+
hidden_states = residual + hidden_states
|
| 696 |
+
hidden_states = self.mlp_ln(hidden_states)
|
| 697 |
+
|
| 698 |
+
# add self attentions if we output attention weights
|
| 699 |
+
outputs = (hidden_states,) + attention_outputs[1:]
|
| 700 |
+
return outputs
|
| 701 |
+
|
| 702 |
+
|
| 703 |
+
class NewEncoder(nn.Module):
|
| 704 |
+
def __init__(self, config):
|
| 705 |
+
super().__init__()
|
| 706 |
+
self.config = config
|
| 707 |
+
self.layer = nn.ModuleList([NewLayer(config) for _ in range(config.num_hidden_layers)])
|
| 708 |
+
self.gradient_checkpointing = False
|
| 709 |
+
|
| 710 |
+
def forward(
|
| 711 |
+
self,
|
| 712 |
+
hidden_states: torch.Tensor,
|
| 713 |
+
attention_bias: Optional[torch.FloatTensor] = None,
|
| 714 |
+
rope_embeds: Optional[Tuple[torch.FloatTensor, torch.FloatTensor]] = None,
|
| 715 |
+
padding_inputs: Optional[Tuple] = None, # indices, batch, seqlen
|
| 716 |
+
attention_scale: Optional[torch.FloatTensor] = None,
|
| 717 |
+
subset_indices: Optional[torch.LongTensor] = None,
|
| 718 |
+
head_mask: Optional[torch.FloatTensor] = None,
|
| 719 |
+
output_attentions: Optional[bool] = False,
|
| 720 |
+
output_hidden_states: Optional[bool] = False,
|
| 721 |
+
return_dict: Optional[bool] = True,
|
| 722 |
+
) -> Union[Tuple[torch.Tensor], BaseModelOutput]:
|
| 723 |
+
all_hidden_states = () if output_hidden_states else None
|
| 724 |
+
all_self_attentions = () if output_attentions else None
|
| 725 |
+
|
| 726 |
+
for i, layer_module in enumerate(self.layer):
|
| 727 |
+
if output_hidden_states:
|
| 728 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
| 729 |
+
|
| 730 |
+
if i >= len(self.layer) - 1:
|
| 731 |
+
layer_subset_indices = subset_indices
|
| 732 |
+
else:
|
| 733 |
+
layer_subset_indices = None
|
| 734 |
+
|
| 735 |
+
layer_head_mask = head_mask[i] if head_mask is not None else None
|
| 736 |
+
|
| 737 |
+
if self.gradient_checkpointing and self.training:
|
| 738 |
+
layer_outputs = self._gradient_checkpointing_func(
|
| 739 |
+
layer_module.__call__,
|
| 740 |
+
hidden_states,
|
| 741 |
+
attention_bias,
|
| 742 |
+
rope_embeds,
|
| 743 |
+
padding_inputs,
|
| 744 |
+
attention_scale,
|
| 745 |
+
layer_subset_indices,
|
| 746 |
+
layer_head_mask,
|
| 747 |
+
)
|
| 748 |
+
else:
|
| 749 |
+
layer_outputs = layer_module(
|
| 750 |
+
hidden_states,
|
| 751 |
+
attention_bias,
|
| 752 |
+
rope_embeds,
|
| 753 |
+
padding_inputs,
|
| 754 |
+
attention_scale,
|
| 755 |
+
layer_subset_indices,
|
| 756 |
+
layer_head_mask,
|
| 757 |
+
output_attentions,
|
| 758 |
+
)
|
| 759 |
+
|
| 760 |
+
hidden_states = layer_outputs[0]
|
| 761 |
+
if output_attentions:
|
| 762 |
+
all_self_attentions = all_self_attentions + (layer_outputs[1],)
|
| 763 |
+
|
| 764 |
+
if output_hidden_states:
|
| 765 |
+
all_hidden_states = all_hidden_states + (hidden_states,)
|
| 766 |
+
|
| 767 |
+
if not return_dict:
|
| 768 |
+
return tuple(
|
| 769 |
+
v
|
| 770 |
+
for v in [
|
| 771 |
+
hidden_states,
|
| 772 |
+
all_hidden_states,
|
| 773 |
+
all_self_attentions,
|
| 774 |
+
]
|
| 775 |
+
if v is not None
|
| 776 |
+
)
|
| 777 |
+
return BaseModelOutput(
|
| 778 |
+
last_hidden_state=hidden_states,
|
| 779 |
+
hidden_states=all_hidden_states,
|
| 780 |
+
attentions=all_self_attentions,
|
| 781 |
+
)
|
| 782 |
+
|
| 783 |
+
|
| 784 |
+
# Copied from transformers.models.bert.modeling_bert.BertPooler with Bert->New
|
| 785 |
+
class NewPooler(nn.Module):
|
| 786 |
+
def __init__(self, config):
|
| 787 |
+
super().__init__()
|
| 788 |
+
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
|
| 789 |
+
self.activation = nn.Tanh()
|
| 790 |
+
|
| 791 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
| 792 |
+
# We "pool" the model by simply taking the hidden state corresponding
|
| 793 |
+
# to the first token.
|
| 794 |
+
first_token_tensor = hidden_states[:, 0]
|
| 795 |
+
pooled_output = self.dense(first_token_tensor)
|
| 796 |
+
pooled_output = self.activation(pooled_output)
|
| 797 |
+
return pooled_output
|
| 798 |
+
|
| 799 |
+
|
| 800 |
+
class NewPreTrainedModel(PreTrainedModel):
|
| 801 |
+
"""
|
| 802 |
+
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
|
| 803 |
+
models.
|
| 804 |
+
"""
|
| 805 |
+
|
| 806 |
+
config_class = NewConfig
|
| 807 |
+
base_model_prefix = "new"
|
| 808 |
+
supports_gradient_checkpointing = True
|
| 809 |
+
_supports_sdpa = True
|
| 810 |
+
|
| 811 |
+
def _init_weights(self, module):
|
| 812 |
+
"""Initialize the weights"""
|
| 813 |
+
if isinstance(module, nn.Linear):
|
| 814 |
+
# Slightly different from the TF version which uses truncated_normal for initialization
|
| 815 |
+
# cf https://github.com/pytorch/pytorch/pull/5617
|
| 816 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
| 817 |
+
if module.bias is not None:
|
| 818 |
+
module.bias.data.zero_()
|
| 819 |
+
elif isinstance(module, nn.Embedding):
|
| 820 |
+
module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
|
| 821 |
+
if module.padding_idx is not None:
|
| 822 |
+
module.weight.data[module.padding_idx].zero_()
|
| 823 |
+
elif isinstance(module, nn.LayerNorm):
|
| 824 |
+
module.bias.data.zero_()
|
| 825 |
+
module.weight.data.fill_(1.0)
|
| 826 |
+
|
| 827 |
+
|
| 828 |
+
class NewModel(NewPreTrainedModel):
|
| 829 |
+
"""
|
| 830 |
+
The bare New Model transformer outputting raw hidden-states without any specific head on top.
|
| 831 |
+
"""
|
| 832 |
+
|
| 833 |
+
def __init__(self, config: NewConfig, add_pooling_layer=False):
|
| 834 |
+
super().__init__(config)
|
| 835 |
+
self.config = config
|
| 836 |
+
|
| 837 |
+
self.embeddings = NewEmbeddings(config)
|
| 838 |
+
self.encoder = NewEncoder(config)
|
| 839 |
+
|
| 840 |
+
self.pooler = NewPooler(config) if add_pooling_layer else None
|
| 841 |
+
|
| 842 |
+
# Initialize weights and apply final processing
|
| 843 |
+
self.post_init()
|
| 844 |
+
|
| 845 |
+
def get_input_embeddings(self):
|
| 846 |
+
return self.embeddings.word_embeddings
|
| 847 |
+
|
| 848 |
+
def set_input_embeddings(self, value):
|
| 849 |
+
self.embeddings.word_embeddings = value
|
| 850 |
+
|
| 851 |
+
def forward(
|
| 852 |
+
self,
|
| 853 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 854 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 855 |
+
length: Optional[List[int]] = None,
|
| 856 |
+
subset_indices: Optional[torch.LongTensor] = None,
|
| 857 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 858 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 859 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 860 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 861 |
+
output_attentions: Optional[bool] = None,
|
| 862 |
+
output_hidden_states: Optional[bool] = None,
|
| 863 |
+
return_dict: Optional[bool] = None,
|
| 864 |
+
unpad_inputs: Optional[bool] = None,
|
| 865 |
+
) -> Union[Tuple[torch.Tensor], BaseModelOutputWithPooling]:
|
| 866 |
+
r"""
|
| 867 |
+
length (`list` of length `batch_size`, *optional*):
|
| 868 |
+
If is `None`, return padded `last_hidden_state`.
|
| 869 |
+
subset_indices ():
|
| 870 |
+
pass
|
| 871 |
+
unpad_inputs (`bool`, *optional*):
|
| 872 |
+
pass
|
| 873 |
+
"""
|
| 874 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
| 875 |
+
output_hidden_states = (
|
| 876 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 877 |
+
)
|
| 878 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 879 |
+
unpad_inputs = unpad_inputs if unpad_inputs is not None else self.config.unpad_inputs
|
| 880 |
+
output_padded = length is None
|
| 881 |
+
|
| 882 |
+
if input_ids is not None and inputs_embeds is not None:
|
| 883 |
+
raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
|
| 884 |
+
elif input_ids is not None:
|
| 885 |
+
self.warn_if_padding_and_no_attention_mask(input_ids, attention_mask)
|
| 886 |
+
input_shape = input_ids.size()
|
| 887 |
+
elif inputs_embeds is not None:
|
| 888 |
+
input_shape = inputs_embeds.size()[:-1]
|
| 889 |
+
else:
|
| 890 |
+
raise ValueError("You have to specify either input_ids or inputs_embeds")
|
| 891 |
+
|
| 892 |
+
# TODO: not used
|
| 893 |
+
# # Prepare head mask if needed
|
| 894 |
+
# # 1.0 in head_mask indicate we keep the head
|
| 895 |
+
# # attention_probs has shape bsz x n_heads x N x N
|
| 896 |
+
# # input head_mask has shape [num_heads] or [num_hidden_layers x num_heads]
|
| 897 |
+
# # and head_mask is converted to shape [num_hidden_layers x batch x num_heads x seq_length x seq_length]
|
| 898 |
+
# head_mask = self.get_head_mask(head_mask, self.config.num_hidden_layers)
|
| 899 |
+
|
| 900 |
+
# Get embeddings, may unpad them
|
| 901 |
+
(embedding_output, attention_mask, rope_embeds, length) = self.embeddings(
|
| 902 |
+
unpad_inputs,
|
| 903 |
+
input_ids=input_ids,
|
| 904 |
+
attention_mask=attention_mask,
|
| 905 |
+
length=length,
|
| 906 |
+
token_type_ids=token_type_ids,
|
| 907 |
+
position_ids=position_ids,
|
| 908 |
+
inputs_embeds=inputs_embeds
|
| 909 |
+
)
|
| 910 |
+
|
| 911 |
+
batch_size, seq_length = input_shape
|
| 912 |
+
if unpad_inputs and self.config.use_memory_efficient_attention:
|
| 913 |
+
attention_bias = xops.fmha.attn_bias.BlockDiagonalMask.from_seqlens(length)
|
| 914 |
+
else:
|
| 915 |
+
# We can provide a self-attention mask of dimensions [batch_size, from_seq_length, to_seq_length]
|
| 916 |
+
# ourselves in which case we just need to make it broadcastable to all heads.
|
| 917 |
+
attention_bias = self.get_extended_attention_mask(attention_mask, input_shape)
|
| 918 |
+
if self.config.use_memory_efficient_attention:
|
| 919 |
+
# Invalid shape for attention bias: torch.Size([48, 1, 1, 512]) (expected (48, 12, 512, 512))
|
| 920 |
+
attention_bias = attention_bias.expand(-1, self.config.num_attention_heads, seq_length, -1)
|
| 921 |
+
|
| 922 |
+
padding_inputs = None
|
| 923 |
+
if unpad_inputs and (output_padded or not self.config.use_memory_efficient_attention):
|
| 924 |
+
indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
|
| 925 |
+
if not self.config.use_memory_efficient_attention:
|
| 926 |
+
padding_inputs = (indices, *input_shape)
|
| 927 |
+
|
| 928 |
+
attention_scale = None
|
| 929 |
+
if self.config.logn_attention_scale:
|
| 930 |
+
logger.warning_once("TODO: logn_attention_scale")
|
| 931 |
+
# # attention scale log_512(input_len)
|
| 932 |
+
# attention_scale = attention_mask.sum(1).log() / torch.tensor(self.config.max_position_embeddings).log()
|
| 933 |
+
# # inference-time logn scale need clip 1
|
| 934 |
+
# if self.config.logn_attention_clip1:
|
| 935 |
+
# attention_scale.clip_(1)
|
| 936 |
+
# attention_scale = attention_scale[:, None, None, None]
|
| 937 |
+
# else:
|
| 938 |
+
# attention_scale = None
|
| 939 |
+
|
| 940 |
+
encoder_outputs = self.encoder(
|
| 941 |
+
embedding_output,
|
| 942 |
+
attention_bias=attention_bias,
|
| 943 |
+
rope_embeds=rope_embeds,
|
| 944 |
+
padding_inputs=padding_inputs,
|
| 945 |
+
attention_scale=attention_scale,
|
| 946 |
+
subset_indices=subset_indices,
|
| 947 |
+
head_mask=head_mask,
|
| 948 |
+
output_attentions=output_attentions,
|
| 949 |
+
output_hidden_states=output_hidden_states,
|
| 950 |
+
return_dict=return_dict,
|
| 951 |
+
)
|
| 952 |
+
sequence_output = encoder_outputs[0]
|
| 953 |
+
if unpad_inputs and output_padded:
|
| 954 |
+
sequence_output = pad_input(
|
| 955 |
+
sequence_output.squeeze(), indices, batch_size, seq_length
|
| 956 |
+
)
|
| 957 |
+
|
| 958 |
+
pooled_output = self.pooler(sequence_output) if self.pooler is not None else None
|
| 959 |
+
|
| 960 |
+
if not return_dict:
|
| 961 |
+
return (sequence_output, pooled_output) + encoder_outputs[1:]
|
| 962 |
+
|
| 963 |
+
return BaseModelOutputWithPooling(
|
| 964 |
+
last_hidden_state=sequence_output,
|
| 965 |
+
pooler_output=pooled_output,
|
| 966 |
+
hidden_states=encoder_outputs.hidden_states,
|
| 967 |
+
attentions=encoder_outputs.attentions,
|
| 968 |
+
)
|
| 969 |
+
|
| 970 |
+
|
| 971 |
+
class NewLMPredictionHead(nn.Module):
|
| 972 |
+
def __init__(self, config):
|
| 973 |
+
super().__init__()
|
| 974 |
+
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
|
| 975 |
+
self.transform_act_fn = ACT2FN[config.hidden_act]
|
| 976 |
+
self.norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
|
| 977 |
+
|
| 978 |
+
# The output weights are the same as the input embeddings, but there is
|
| 979 |
+
# an output-only bias for each token.
|
| 980 |
+
self.decoder = nn.Linear(config.hidden_size, config.vocab_size)
|
| 981 |
+
|
| 982 |
+
def forward(self, hidden_states):
|
| 983 |
+
hidden_states = self.dense(hidden_states)
|
| 984 |
+
hidden_states = self.transform_act_fn(hidden_states)
|
| 985 |
+
hidden_states = self.norm(hidden_states)
|
| 986 |
+
hidden_states = self.decoder(hidden_states)
|
| 987 |
+
return hidden_states
|
| 988 |
+
|
| 989 |
+
|
| 990 |
+
class NewForMaskedLM(NewPreTrainedModel):
|
| 991 |
+
_tied_weights_keys = ["lm_head.decoder.bias", "lm_head.decoder.weight"]
|
| 992 |
+
|
| 993 |
+
def __init__(self, config: NewConfig):
|
| 994 |
+
super().__init__(config)
|
| 995 |
+
self.new = NewModel(config, add_pooling_layer=False)
|
| 996 |
+
self.lm_head = NewLMPredictionHead(config)
|
| 997 |
+
self.loss_fct = nn.CrossEntropyLoss()
|
| 998 |
+
|
| 999 |
+
# Initialize weights and apply final processing
|
| 1000 |
+
self.post_init()
|
| 1001 |
+
|
| 1002 |
+
def get_output_embeddings(self):
|
| 1003 |
+
return self.lm_head.decoder
|
| 1004 |
+
|
| 1005 |
+
def set_output_embeddings(self, new_embeddings):
|
| 1006 |
+
self.lm_head.decoder = new_embeddings
|
| 1007 |
+
|
| 1008 |
+
def forward(
|
| 1009 |
+
self,
|
| 1010 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 1011 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 1012 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 1013 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 1014 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 1015 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 1016 |
+
labels: Optional[torch.Tensor] = None,
|
| 1017 |
+
output_attentions: Optional[bool] = None,
|
| 1018 |
+
output_hidden_states: Optional[bool] = None,
|
| 1019 |
+
return_dict: Optional[bool] = None,
|
| 1020 |
+
unpad_inputs: Optional[bool] = None,
|
| 1021 |
+
) -> Union[Tuple[torch.Tensor], MaskedLMOutput]:
|
| 1022 |
+
r"""
|
| 1023 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 1024 |
+
Labels for computing the masked language modeling loss. Indices should be in `[-100, 0, ...,
|
| 1025 |
+
config.vocab_size]` (see `input_ids` docstring) Tokens with indices set to `-100` are ignored (masked), the
|
| 1026 |
+
loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`
|
| 1027 |
+
"""
|
| 1028 |
+
|
| 1029 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 1030 |
+
|
| 1031 |
+
if labels is None or not self.new.config.unpad_inputs:
|
| 1032 |
+
length = None
|
| 1033 |
+
subset_indices = None
|
| 1034 |
+
else:
|
| 1035 |
+
length = attention_mask.sum(-1).tolist()
|
| 1036 |
+
labels = labels[attention_mask.bool()].unsqueeze(0)
|
| 1037 |
+
subset_indices = labels > -100
|
| 1038 |
+
|
| 1039 |
+
outputs = self.new(
|
| 1040 |
+
input_ids,
|
| 1041 |
+
attention_mask=attention_mask,
|
| 1042 |
+
length=length,
|
| 1043 |
+
subset_indices=subset_indices,
|
| 1044 |
+
token_type_ids=token_type_ids,
|
| 1045 |
+
position_ids=position_ids,
|
| 1046 |
+
head_mask=head_mask,
|
| 1047 |
+
inputs_embeds=inputs_embeds,
|
| 1048 |
+
output_attentions=output_attentions,
|
| 1049 |
+
output_hidden_states=output_hidden_states,
|
| 1050 |
+
return_dict=return_dict,
|
| 1051 |
+
unpad_inputs=unpad_inputs,
|
| 1052 |
+
)
|
| 1053 |
+
|
| 1054 |
+
sequence_output = outputs[0]
|
| 1055 |
+
prediction_scores = self.lm_head(sequence_output)
|
| 1056 |
+
|
| 1057 |
+
masked_lm_loss = None
|
| 1058 |
+
if labels is not None:
|
| 1059 |
+
if subset_indices is None:
|
| 1060 |
+
mask = attention_mask.bool()
|
| 1061 |
+
prediction_scores = prediction_scores[mask]
|
| 1062 |
+
labels = labels[mask]
|
| 1063 |
+
else:
|
| 1064 |
+
labels = labels[subset_indices]
|
| 1065 |
+
masked_lm_loss = self.loss_fct(prediction_scores, labels)
|
| 1066 |
+
|
| 1067 |
+
if not return_dict:
|
| 1068 |
+
output = (prediction_scores,) + outputs[2:]
|
| 1069 |
+
return ((masked_lm_loss,) + output) if masked_lm_loss is not None else output
|
| 1070 |
+
|
| 1071 |
+
return MaskedLMOutput(
|
| 1072 |
+
loss=masked_lm_loss,
|
| 1073 |
+
logits=prediction_scores,
|
| 1074 |
+
hidden_states=outputs.hidden_states,
|
| 1075 |
+
attentions=outputs.attentions,
|
| 1076 |
+
)
|
| 1077 |
+
|
| 1078 |
+
|
| 1079 |
+
class NewForSequenceClassification(NewPreTrainedModel):
|
| 1080 |
+
def __init__(self, config):
|
| 1081 |
+
super().__init__(config)
|
| 1082 |
+
self.num_labels = config.num_labels
|
| 1083 |
+
self.config = config
|
| 1084 |
+
|
| 1085 |
+
self.new = NewModel(config, add_pooling_layer=True)
|
| 1086 |
+
classifier_dropout = (
|
| 1087 |
+
config.classifier_dropout if config.classifier_dropout is not None else config.hidden_dropout_prob
|
| 1088 |
+
)
|
| 1089 |
+
self.dropout = nn.Dropout(classifier_dropout)
|
| 1090 |
+
self.classifier = nn.Linear(config.hidden_size, config.num_labels)
|
| 1091 |
+
|
| 1092 |
+
# Initialize weights and apply final processing
|
| 1093 |
+
self.post_init()
|
| 1094 |
+
|
| 1095 |
+
def forward(
|
| 1096 |
+
self,
|
| 1097 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 1098 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 1099 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 1100 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 1101 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 1102 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 1103 |
+
labels: Optional[torch.Tensor] = None,
|
| 1104 |
+
output_attentions: Optional[bool] = None,
|
| 1105 |
+
output_hidden_states: Optional[bool] = None,
|
| 1106 |
+
return_dict: Optional[bool] = None,
|
| 1107 |
+
unpad_inputs: Optional[bool] = None,
|
| 1108 |
+
) -> Union[Tuple[torch.Tensor], SequenceClassifierOutput]:
|
| 1109 |
+
r"""
|
| 1110 |
+
labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
|
| 1111 |
+
Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
|
| 1112 |
+
config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
|
| 1113 |
+
`config.num_labels > 1` a classification loss is computed (Cross-Entropy).
|
| 1114 |
+
"""
|
| 1115 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 1116 |
+
|
| 1117 |
+
outputs = self.new(
|
| 1118 |
+
input_ids,
|
| 1119 |
+
attention_mask=attention_mask,
|
| 1120 |
+
token_type_ids=token_type_ids,
|
| 1121 |
+
position_ids=position_ids,
|
| 1122 |
+
head_mask=head_mask,
|
| 1123 |
+
inputs_embeds=inputs_embeds,
|
| 1124 |
+
output_attentions=output_attentions,
|
| 1125 |
+
output_hidden_states=output_hidden_states,
|
| 1126 |
+
return_dict=return_dict,
|
| 1127 |
+
unpad_inputs=unpad_inputs,
|
| 1128 |
+
)
|
| 1129 |
+
|
| 1130 |
+
pooled_output = outputs[1]
|
| 1131 |
+
|
| 1132 |
+
pooled_output = self.dropout(pooled_output)
|
| 1133 |
+
logits = self.classifier(pooled_output)
|
| 1134 |
+
|
| 1135 |
+
loss = None
|
| 1136 |
+
if labels is not None:
|
| 1137 |
+
if self.config.problem_type is None:
|
| 1138 |
+
if self.num_labels == 1:
|
| 1139 |
+
self.config.problem_type = "regression"
|
| 1140 |
+
elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
|
| 1141 |
+
self.config.problem_type = "single_label_classification"
|
| 1142 |
+
else:
|
| 1143 |
+
self.config.problem_type = "multi_label_classification"
|
| 1144 |
+
|
| 1145 |
+
if self.config.problem_type == "regression":
|
| 1146 |
+
loss_fct = nn.MSELoss()
|
| 1147 |
+
if self.num_labels == 1:
|
| 1148 |
+
loss = loss_fct(logits.squeeze(), labels.squeeze())
|
| 1149 |
+
else:
|
| 1150 |
+
loss = loss_fct(logits, labels)
|
| 1151 |
+
elif self.config.problem_type == "single_label_classification":
|
| 1152 |
+
loss_fct = nn.CrossEntropyLoss()
|
| 1153 |
+
loss = loss_fct(logits.view(-1, self.num_labels), labels.view(-1))
|
| 1154 |
+
elif self.config.problem_type == "multi_label_classification":
|
| 1155 |
+
loss_fct = nn.BCEWithLogitsLoss()
|
| 1156 |
+
loss = loss_fct(logits, labels)
|
| 1157 |
+
|
| 1158 |
+
if not return_dict:
|
| 1159 |
+
output = (logits,) + outputs[2:]
|
| 1160 |
+
return ((loss,) + output) if loss is not None else output
|
| 1161 |
+
|
| 1162 |
+
return SequenceClassifierOutput(
|
| 1163 |
+
loss=loss,
|
| 1164 |
+
logits=logits,
|
| 1165 |
+
hidden_states=outputs.hidden_states,
|
| 1166 |
+
attentions=outputs.attentions,
|
| 1167 |
+
)
|
| 1168 |
+
|
| 1169 |
+
|
| 1170 |
+
class NewForMultipleChoice(NewPreTrainedModel):
|
| 1171 |
+
def __init__(self, config):
|
| 1172 |
+
super().__init__(config)
|
| 1173 |
+
|
| 1174 |
+
self.new = NewModel(config, add_pooling_layer=True)
|
| 1175 |
+
classifier_dropout = (
|
| 1176 |
+
config.classifier_dropout if config.classifier_dropout is not None else config.hidden_dropout_prob
|
| 1177 |
+
)
|
| 1178 |
+
self.dropout = nn.Dropout(classifier_dropout)
|
| 1179 |
+
self.classifier = nn.Linear(config.hidden_size, 1)
|
| 1180 |
+
|
| 1181 |
+
# Initialize weights and apply final processing
|
| 1182 |
+
self.post_init()
|
| 1183 |
+
|
| 1184 |
+
def forward(
|
| 1185 |
+
self,
|
| 1186 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 1187 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 1188 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 1189 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 1190 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 1191 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 1192 |
+
labels: Optional[torch.Tensor] = None,
|
| 1193 |
+
output_attentions: Optional[bool] = None,
|
| 1194 |
+
output_hidden_states: Optional[bool] = None,
|
| 1195 |
+
return_dict: Optional[bool] = None,
|
| 1196 |
+
unpad_inputs: Optional[bool] = None,
|
| 1197 |
+
) -> Union[Tuple[torch.Tensor], MultipleChoiceModelOutput]:
|
| 1198 |
+
r"""
|
| 1199 |
+
labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
|
| 1200 |
+
Labels for computing the multiple choice classification loss. Indices should be in `[0, ...,
|
| 1201 |
+
num_choices-1]` where `num_choices` is the size of the second dimension of the input tensors. (See
|
| 1202 |
+
`input_ids` above)
|
| 1203 |
+
"""
|
| 1204 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 1205 |
+
num_choices = input_ids.shape[1] if input_ids is not None else inputs_embeds.shape[1]
|
| 1206 |
+
|
| 1207 |
+
input_ids = input_ids.view(-1, input_ids.size(-1)) if input_ids is not None else None
|
| 1208 |
+
attention_mask = attention_mask.view(-1, attention_mask.size(-1)) if attention_mask is not None else None
|
| 1209 |
+
token_type_ids = token_type_ids.view(-1, token_type_ids.size(-1)) if token_type_ids is not None else None
|
| 1210 |
+
position_ids = position_ids.view(-1, position_ids.size(-1)) if position_ids is not None else None
|
| 1211 |
+
inputs_embeds = (
|
| 1212 |
+
inputs_embeds.view(-1, inputs_embeds.size(-2), inputs_embeds.size(-1))
|
| 1213 |
+
if inputs_embeds is not None
|
| 1214 |
+
else None
|
| 1215 |
+
)
|
| 1216 |
+
|
| 1217 |
+
outputs = self.new(
|
| 1218 |
+
input_ids,
|
| 1219 |
+
attention_mask=attention_mask,
|
| 1220 |
+
token_type_ids=token_type_ids,
|
| 1221 |
+
position_ids=position_ids,
|
| 1222 |
+
head_mask=head_mask,
|
| 1223 |
+
inputs_embeds=inputs_embeds,
|
| 1224 |
+
output_attentions=output_attentions,
|
| 1225 |
+
output_hidden_states=output_hidden_states,
|
| 1226 |
+
return_dict=return_dict,
|
| 1227 |
+
unpad_inputs=unpad_inputs,
|
| 1228 |
+
)
|
| 1229 |
+
|
| 1230 |
+
pooled_output = outputs[1]
|
| 1231 |
+
|
| 1232 |
+
pooled_output = self.dropout(pooled_output)
|
| 1233 |
+
logits = self.classifier(pooled_output)
|
| 1234 |
+
reshaped_logits = logits.view(-1, num_choices)
|
| 1235 |
+
|
| 1236 |
+
loss = None
|
| 1237 |
+
if labels is not None:
|
| 1238 |
+
loss_fct = nn.CrossEntropyLoss()
|
| 1239 |
+
loss = loss_fct(reshaped_logits, labels)
|
| 1240 |
+
|
| 1241 |
+
if not return_dict:
|
| 1242 |
+
output = (reshaped_logits,) + outputs[2:]
|
| 1243 |
+
return ((loss,) + output) if loss is not None else output
|
| 1244 |
+
|
| 1245 |
+
return MultipleChoiceModelOutput(
|
| 1246 |
+
loss=loss,
|
| 1247 |
+
logits=reshaped_logits,
|
| 1248 |
+
hidden_states=outputs.hidden_states,
|
| 1249 |
+
attentions=outputs.attentions,
|
| 1250 |
+
)
|
| 1251 |
+
|
| 1252 |
+
|
| 1253 |
+
@dataclass
|
| 1254 |
+
class NewTokenClassifierOutput(ModelOutput):
|
| 1255 |
+
loss: Optional[torch.FloatTensor] = None
|
| 1256 |
+
logits: torch.FloatTensor = None
|
| 1257 |
+
last_hidden_state: torch.FloatTensor = None
|
| 1258 |
+
hidden_states: Optional[Tuple[torch.FloatTensor, ...]] = None
|
| 1259 |
+
attentions: Optional[Tuple[torch.FloatTensor, ...]] = None
|
| 1260 |
+
|
| 1261 |
+
|
| 1262 |
+
class NewForTokenClassification(NewPreTrainedModel):
|
| 1263 |
+
def __init__(self, config):
|
| 1264 |
+
super().__init__(config)
|
| 1265 |
+
self.num_labels = config.num_labels
|
| 1266 |
+
|
| 1267 |
+
self.new = NewModel(config, add_pooling_layer=False)
|
| 1268 |
+
classifier_dropout = (
|
| 1269 |
+
config.classifier_dropout if config.classifier_dropout is not None else config.hidden_dropout_prob
|
| 1270 |
+
)
|
| 1271 |
+
self.dropout = nn.Dropout(classifier_dropout)
|
| 1272 |
+
self.classifier = nn.Linear(config.hidden_size, config.num_labels)
|
| 1273 |
+
|
| 1274 |
+
# Initialize weights and apply final processing
|
| 1275 |
+
self.post_init()
|
| 1276 |
+
|
| 1277 |
+
def forward(
|
| 1278 |
+
self,
|
| 1279 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 1280 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 1281 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 1282 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 1283 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 1284 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 1285 |
+
labels: Optional[torch.Tensor] = None,
|
| 1286 |
+
output_attentions: Optional[bool] = None,
|
| 1287 |
+
output_hidden_states: Optional[bool] = None,
|
| 1288 |
+
return_dict: Optional[bool] = None,
|
| 1289 |
+
unpad_inputs: Optional[bool] = None,
|
| 1290 |
+
) -> Union[Tuple[torch.Tensor], NewTokenClassifierOutput]:
|
| 1291 |
+
r"""
|
| 1292 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 1293 |
+
Labels for computing the token classification loss. Indices should be in `[0, ..., config.num_labels - 1]`.
|
| 1294 |
+
"""
|
| 1295 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 1296 |
+
|
| 1297 |
+
outputs = self.new(
|
| 1298 |
+
input_ids,
|
| 1299 |
+
attention_mask=attention_mask,
|
| 1300 |
+
token_type_ids=token_type_ids,
|
| 1301 |
+
position_ids=position_ids,
|
| 1302 |
+
head_mask=head_mask,
|
| 1303 |
+
inputs_embeds=inputs_embeds,
|
| 1304 |
+
output_attentions=output_attentions,
|
| 1305 |
+
output_hidden_states=output_hidden_states,
|
| 1306 |
+
return_dict=return_dict,
|
| 1307 |
+
unpad_inputs=unpad_inputs,
|
| 1308 |
+
)
|
| 1309 |
+
|
| 1310 |
+
sequence_output = outputs[0]
|
| 1311 |
+
|
| 1312 |
+
sequence_output = self.dropout(sequence_output)
|
| 1313 |
+
logits = self.classifier(sequence_output)
|
| 1314 |
+
|
| 1315 |
+
loss = None
|
| 1316 |
+
if labels is not None:
|
| 1317 |
+
loss_fct = nn.CrossEntropyLoss()
|
| 1318 |
+
loss = loss_fct(logits.view(-1, self.num_labels), labels.view(-1))
|
| 1319 |
+
|
| 1320 |
+
if not return_dict:
|
| 1321 |
+
output = (logits,) + outputs[2:]
|
| 1322 |
+
return ((loss,) + output) if loss is not None else output
|
| 1323 |
+
|
| 1324 |
+
return NewTokenClassifierOutput(
|
| 1325 |
+
loss=loss,
|
| 1326 |
+
logits=logits,
|
| 1327 |
+
last_hidden_state=sequence_output,
|
| 1328 |
+
hidden_states=outputs.hidden_states,
|
| 1329 |
+
attentions=outputs.attentions,
|
| 1330 |
+
)
|
| 1331 |
+
|
| 1332 |
+
|
| 1333 |
+
class NewForQuestionAnswering(NewPreTrainedModel):
|
| 1334 |
+
def __init__(self, config):
|
| 1335 |
+
super().__init__(config)
|
| 1336 |
+
self.num_labels = config.num_labels
|
| 1337 |
+
|
| 1338 |
+
self.new = NewModel(config, add_pooling_layer=False)
|
| 1339 |
+
self.qa_outputs = nn.Linear(config.hidden_size, config.num_labels)
|
| 1340 |
+
|
| 1341 |
+
# Initialize weights and apply final processing
|
| 1342 |
+
self.post_init()
|
| 1343 |
+
|
| 1344 |
+
def forward(
|
| 1345 |
+
self,
|
| 1346 |
+
input_ids: Optional[torch.Tensor] = None,
|
| 1347 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 1348 |
+
token_type_ids: Optional[torch.Tensor] = None,
|
| 1349 |
+
position_ids: Optional[torch.Tensor] = None,
|
| 1350 |
+
head_mask: Optional[torch.Tensor] = None,
|
| 1351 |
+
inputs_embeds: Optional[torch.Tensor] = None,
|
| 1352 |
+
start_positions: Optional[torch.Tensor] = None,
|
| 1353 |
+
end_positions: Optional[torch.Tensor] = None,
|
| 1354 |
+
output_attentions: Optional[bool] = None,
|
| 1355 |
+
output_hidden_states: Optional[bool] = None,
|
| 1356 |
+
return_dict: Optional[bool] = None,
|
| 1357 |
+
unpad_inputs: Optional[bool] = None,
|
| 1358 |
+
) -> Union[Tuple[torch.Tensor], QuestionAnsweringModelOutput]:
|
| 1359 |
+
r"""
|
| 1360 |
+
start_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
|
| 1361 |
+
Labels for position (index) of the start of the labelled span for computing the token classification loss.
|
| 1362 |
+
Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
|
| 1363 |
+
are not taken into account for computing the loss.
|
| 1364 |
+
end_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
|
| 1365 |
+
Labels for position (index) of the end of the labelled span for computing the token classification loss.
|
| 1366 |
+
Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
|
| 1367 |
+
are not taken into account for computing the loss.
|
| 1368 |
+
"""
|
| 1369 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 1370 |
+
|
| 1371 |
+
outputs = self.new(
|
| 1372 |
+
input_ids,
|
| 1373 |
+
attention_mask=attention_mask,
|
| 1374 |
+
token_type_ids=token_type_ids,
|
| 1375 |
+
position_ids=position_ids,
|
| 1376 |
+
head_mask=head_mask,
|
| 1377 |
+
inputs_embeds=inputs_embeds,
|
| 1378 |
+
output_attentions=output_attentions,
|
| 1379 |
+
output_hidden_states=output_hidden_states,
|
| 1380 |
+
return_dict=return_dict,
|
| 1381 |
+
unpad_inputs=unpad_inputs,
|
| 1382 |
+
)
|
| 1383 |
+
|
| 1384 |
+
sequence_output = outputs[0]
|
| 1385 |
+
|
| 1386 |
+
logits = self.qa_outputs(sequence_output)
|
| 1387 |
+
start_logits, end_logits = logits.split(1, dim=-1)
|
| 1388 |
+
start_logits = start_logits.squeeze(-1).contiguous()
|
| 1389 |
+
end_logits = end_logits.squeeze(-1).contiguous()
|
| 1390 |
+
|
| 1391 |
+
total_loss = None
|
| 1392 |
+
if start_positions is not None and end_positions is not None:
|
| 1393 |
+
# If we are on multi-GPU, split add a dimension
|
| 1394 |
+
if len(start_positions.size()) > 1:
|
| 1395 |
+
start_positions = start_positions.squeeze(-1)
|
| 1396 |
+
if len(end_positions.size()) > 1:
|
| 1397 |
+
end_positions = end_positions.squeeze(-1)
|
| 1398 |
+
# sometimes the start/end positions are outside our model inputs, we ignore these terms
|
| 1399 |
+
ignored_index = start_logits.size(1)
|
| 1400 |
+
start_positions = start_positions.clamp(0, ignored_index)
|
| 1401 |
+
end_positions = end_positions.clamp(0, ignored_index)
|
| 1402 |
+
|
| 1403 |
+
loss_fct = nn.CrossEntropyLoss(ignore_index=ignored_index)
|
| 1404 |
+
start_loss = loss_fct(start_logits, start_positions)
|
| 1405 |
+
end_loss = loss_fct(end_logits, end_positions)
|
| 1406 |
+
total_loss = (start_loss + end_loss) / 2
|
| 1407 |
+
|
| 1408 |
+
if not return_dict:
|
| 1409 |
+
output = (start_logits, end_logits) + outputs[2:]
|
| 1410 |
+
return ((total_loss,) + output) if total_loss is not None else output
|
| 1411 |
+
|
| 1412 |
+
return QuestionAnsweringModelOutput(
|
| 1413 |
+
loss=total_loss,
|
| 1414 |
+
start_logits=start_logits,
|
| 1415 |
+
end_logits=end_logits,
|
| 1416 |
+
hidden_states=outputs.hidden_states,
|
| 1417 |
+
attentions=outputs.attentions,
|
| 1418 |
+
)
|
modules.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"idx": 0,
|
| 4 |
+
"name": "0",
|
| 5 |
+
"path": "",
|
| 6 |
+
"type": "sentence_transformers.models.Transformer"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"idx": 1,
|
| 10 |
+
"name": "1",
|
| 11 |
+
"path": "1_Pooling",
|
| 12 |
+
"type": "sentence_transformers.models.Pooling"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"idx": 2,
|
| 16 |
+
"name": "2",
|
| 17 |
+
"path": "2_Normalize",
|
| 18 |
+
"type": "sentence_transformers.models.Normalize"
|
| 19 |
+
}
|
| 20 |
+
]
|
optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0541b9cb71a5d9764cf6fab34654aef49224a8d7a1bd4a5d87a1abc56904880e
|
| 3 |
+
size 1767119051
|
rng_state.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5952bcab66003f5f91dd100986a0b8444b9c106dcb178659cc5a2360b9b998ce
|
| 3 |
+
size 14645
|
scheduler.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0a8739adb42f0abfbbb7e4c25cf5e09cf981e44b780e76bdf7685bcb38f83592
|
| 3 |
+
size 1465
|
sentence_bert_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"max_seq_length": 8192,
|
| 3 |
+
"do_lower_case": false
|
| 4 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"cls_token": {
|
| 10 |
+
"content": "<s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"eos_token": {
|
| 17 |
+
"content": "</s>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"mask_token": {
|
| 24 |
+
"content": "<mask>",
|
| 25 |
+
"lstrip": true,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"pad_token": {
|
| 31 |
+
"content": "<pad>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
},
|
| 37 |
+
"sep_token": {
|
| 38 |
+
"content": "</s>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false
|
| 43 |
+
},
|
| 44 |
+
"unk_token": {
|
| 45 |
+
"content": "<unk>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": false,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false
|
| 50 |
+
}
|
| 51 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa7a6ad87a7ce8fe196787355f6af7d03aee94d19c54a5eb1392ed18c8ef451a
|
| 3 |
+
size 17082988
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "<s>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "<pad>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"2": {
|
| 20 |
+
"content": "</s>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"3": {
|
| 28 |
+
"content": "<unk>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"250001": {
|
| 36 |
+
"content": "<mask>",
|
| 37 |
+
"lstrip": true,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"bos_token": "<s>",
|
| 45 |
+
"clean_up_tokenization_spaces": true,
|
| 46 |
+
"cls_token": "<s>",
|
| 47 |
+
"eos_token": "</s>",
|
| 48 |
+
"extra_special_tokens": {},
|
| 49 |
+
"mask_token": "<mask>",
|
| 50 |
+
"model_max_length": 8192,
|
| 51 |
+
"pad_token": "<pad>",
|
| 52 |
+
"sep_token": "</s>",
|
| 53 |
+
"tokenizer_class": "XLMRobertaTokenizerFast",
|
| 54 |
+
"unk_token": "<unk>"
|
| 55 |
+
}
|
trainer_state.json
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"best_global_step": null,
|
| 3 |
+
"best_metric": null,
|
| 4 |
+
"best_model_checkpoint": null,
|
| 5 |
+
"epoch": 1.0,
|
| 6 |
+
"eval_steps": 79,
|
| 7 |
+
"global_step": 782,
|
| 8 |
+
"is_hyper_param_search": false,
|
| 9 |
+
"is_local_process_zero": true,
|
| 10 |
+
"is_world_process_zero": true,
|
| 11 |
+
"log_history": [
|
| 12 |
+
{
|
| 13 |
+
"epoch": 0,
|
| 14 |
+
"eval_cosine_accuracy@1": 0.232,
|
| 15 |
+
"eval_cosine_accuracy@10": 0.456,
|
| 16 |
+
"eval_cosine_accuracy@3": 0.3365,
|
| 17 |
+
"eval_cosine_accuracy@5": 0.389,
|
| 18 |
+
"eval_cosine_map@100": 0.14334533833340427,
|
| 19 |
+
"eval_cosine_mrr@10": 0.2988200396825396,
|
| 20 |
+
"eval_cosine_ndcg@10": 0.19590710853524823,
|
| 21 |
+
"eval_cosine_precision@1": 0.232,
|
| 22 |
+
"eval_cosine_precision@10": 0.10355000000000002,
|
| 23 |
+
"eval_cosine_precision@3": 0.177,
|
| 24 |
+
"eval_cosine_precision@5": 0.1452,
|
| 25 |
+
"eval_cosine_recall@1": 0.0548117388039026,
|
| 26 |
+
"eval_cosine_recall@10": 0.18984275866485092,
|
| 27 |
+
"eval_cosine_recall@3": 0.11065666057433865,
|
| 28 |
+
"eval_cosine_recall@5": 0.1464970398055657,
|
| 29 |
+
"eval_loss": 2.950530767440796,
|
| 30 |
+
"eval_runtime": 28.7759,
|
| 31 |
+
"eval_samples_per_second": 69.502,
|
| 32 |
+
"eval_steps_per_second": 1.112,
|
| 33 |
+
"step": 0
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"epoch": 0.10112,
|
| 37 |
+
"grad_norm": 4.060101509094238,
|
| 38 |
+
"learning_rate": 4.936708860759494e-05,
|
| 39 |
+
"loss": 1.7256,
|
| 40 |
+
"step": 79
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"epoch": 0.10112,
|
| 44 |
+
"eval_cosine_accuracy@1": 0.4915,
|
| 45 |
+
"eval_cosine_accuracy@10": 0.709,
|
| 46 |
+
"eval_cosine_accuracy@3": 0.6055,
|
| 47 |
+
"eval_cosine_accuracy@5": 0.65,
|
| 48 |
+
"eval_cosine_map@100": 0.37501954096960194,
|
| 49 |
+
"eval_cosine_mrr@10": 0.5594632936507937,
|
| 50 |
+
"eval_cosine_ndcg@10": 0.4471963096331387,
|
| 51 |
+
"eval_cosine_precision@1": 0.4915,
|
| 52 |
+
"eval_cosine_precision@10": 0.20455,
|
| 53 |
+
"eval_cosine_precision@3": 0.3835,
|
| 54 |
+
"eval_cosine_precision@5": 0.30490000000000006,
|
| 55 |
+
"eval_cosine_recall@1": 0.15563947633799366,
|
| 56 |
+
"eval_cosine_recall@10": 0.4411529898745371,
|
| 57 |
+
"eval_cosine_recall@3": 0.30525816129147315,
|
| 58 |
+
"eval_cosine_recall@5": 0.3661646057217302,
|
| 59 |
+
"eval_loss": 0.869914174079895,
|
| 60 |
+
"eval_runtime": 32.9054,
|
| 61 |
+
"eval_samples_per_second": 60.78,
|
| 62 |
+
"eval_steps_per_second": 0.972,
|
| 63 |
+
"step": 79
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"epoch": 0.20224,
|
| 67 |
+
"grad_norm": 3.455092668533325,
|
| 68 |
+
"learning_rate": 4.4452347083926033e-05,
|
| 69 |
+
"loss": 0.8044,
|
| 70 |
+
"step": 158
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"epoch": 0.20224,
|
| 74 |
+
"eval_cosine_accuracy@1": 0.538,
|
| 75 |
+
"eval_cosine_accuracy@10": 0.7835,
|
| 76 |
+
"eval_cosine_accuracy@3": 0.671,
|
| 77 |
+
"eval_cosine_accuracy@5": 0.72,
|
| 78 |
+
"eval_cosine_map@100": 0.4288531840469143,
|
| 79 |
+
"eval_cosine_mrr@10": 0.6170097222222221,
|
| 80 |
+
"eval_cosine_ndcg@10": 0.5071737492167014,
|
| 81 |
+
"eval_cosine_precision@1": 0.538,
|
| 82 |
+
"eval_cosine_precision@10": 0.22805,
|
| 83 |
+
"eval_cosine_precision@3": 0.419,
|
| 84 |
+
"eval_cosine_precision@5": 0.336,
|
| 85 |
+
"eval_cosine_recall@1": 0.18509011905489597,
|
| 86 |
+
"eval_cosine_recall@10": 0.5088450856238615,
|
| 87 |
+
"eval_cosine_recall@3": 0.35023499358379173,
|
| 88 |
+
"eval_cosine_recall@5": 0.42149330607177377,
|
| 89 |
+
"eval_loss": 0.6144608855247498,
|
| 90 |
+
"eval_runtime": 33.0639,
|
| 91 |
+
"eval_samples_per_second": 60.489,
|
| 92 |
+
"eval_steps_per_second": 0.968,
|
| 93 |
+
"step": 158
|
| 94 |
+
},
|
| 95 |
+
{
|
| 96 |
+
"epoch": 0.30336,
|
| 97 |
+
"grad_norm": 3.299586534500122,
|
| 98 |
+
"learning_rate": 3.883357041251778e-05,
|
| 99 |
+
"loss": 0.6254,
|
| 100 |
+
"step": 237
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"epoch": 0.30336,
|
| 104 |
+
"eval_cosine_accuracy@1": 0.571,
|
| 105 |
+
"eval_cosine_accuracy@10": 0.807,
|
| 106 |
+
"eval_cosine_accuracy@3": 0.697,
|
| 107 |
+
"eval_cosine_accuracy@5": 0.747,
|
| 108 |
+
"eval_cosine_map@100": 0.45768471305297626,
|
| 109 |
+
"eval_cosine_mrr@10": 0.6465369047619048,
|
| 110 |
+
"eval_cosine_ndcg@10": 0.5352649581411899,
|
| 111 |
+
"eval_cosine_precision@1": 0.571,
|
| 112 |
+
"eval_cosine_precision@10": 0.23940000000000003,
|
| 113 |
+
"eval_cosine_precision@3": 0.446,
|
| 114 |
+
"eval_cosine_precision@5": 0.3534000000000001,
|
| 115 |
+
"eval_cosine_recall@1": 0.19728028074863738,
|
| 116 |
+
"eval_cosine_recall@10": 0.5336122046159524,
|
| 117 |
+
"eval_cosine_recall@3": 0.3745295533176793,
|
| 118 |
+
"eval_cosine_recall@5": 0.44429268806860206,
|
| 119 |
+
"eval_loss": 0.5068339705467224,
|
| 120 |
+
"eval_runtime": 32.9503,
|
| 121 |
+
"eval_samples_per_second": 60.697,
|
| 122 |
+
"eval_steps_per_second": 0.971,
|
| 123 |
+
"step": 237
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"epoch": 0.40448,
|
| 127 |
+
"grad_norm": 2.563180685043335,
|
| 128 |
+
"learning_rate": 3.321479374110953e-05,
|
| 129 |
+
"loss": 0.5215,
|
| 130 |
+
"step": 316
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"epoch": 0.40448,
|
| 134 |
+
"eval_cosine_accuracy@1": 0.6075,
|
| 135 |
+
"eval_cosine_accuracy@10": 0.855,
|
| 136 |
+
"eval_cosine_accuracy@3": 0.7495,
|
| 137 |
+
"eval_cosine_accuracy@5": 0.8005,
|
| 138 |
+
"eval_cosine_map@100": 0.4886299583708059,
|
| 139 |
+
"eval_cosine_mrr@10": 0.6879220238095239,
|
| 140 |
+
"eval_cosine_ndcg@10": 0.5725427973832125,
|
| 141 |
+
"eval_cosine_precision@1": 0.6075,
|
| 142 |
+
"eval_cosine_precision@10": 0.25585,
|
| 143 |
+
"eval_cosine_precision@3": 0.4696666666666666,
|
| 144 |
+
"eval_cosine_precision@5": 0.3763000000000001,
|
| 145 |
+
"eval_cosine_recall@1": 0.21129895871002893,
|
| 146 |
+
"eval_cosine_recall@10": 0.5768064108469603,
|
| 147 |
+
"eval_cosine_recall@3": 0.3986053442055735,
|
| 148 |
+
"eval_cosine_recall@5": 0.4793458893809688,
|
| 149 |
+
"eval_loss": 0.4230406582355499,
|
| 150 |
+
"eval_runtime": 32.9072,
|
| 151 |
+
"eval_samples_per_second": 60.777,
|
| 152 |
+
"eval_steps_per_second": 0.972,
|
| 153 |
+
"step": 316
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"epoch": 0.5056,
|
| 157 |
+
"grad_norm": 2.914031744003296,
|
| 158 |
+
"learning_rate": 2.759601706970128e-05,
|
| 159 |
+
"loss": 0.4507,
|
| 160 |
+
"step": 395
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"epoch": 0.5056,
|
| 164 |
+
"eval_cosine_accuracy@1": 0.6285,
|
| 165 |
+
"eval_cosine_accuracy@10": 0.8675,
|
| 166 |
+
"eval_cosine_accuracy@3": 0.753,
|
| 167 |
+
"eval_cosine_accuracy@5": 0.812,
|
| 168 |
+
"eval_cosine_map@100": 0.5064669285677783,
|
| 169 |
+
"eval_cosine_mrr@10": 0.7049886904761903,
|
| 170 |
+
"eval_cosine_ndcg@10": 0.5906093986384608,
|
| 171 |
+
"eval_cosine_precision@1": 0.6285,
|
| 172 |
+
"eval_cosine_precision@10": 0.26185,
|
| 173 |
+
"eval_cosine_precision@3": 0.4774999999999999,
|
| 174 |
+
"eval_cosine_precision@5": 0.38320000000000004,
|
| 175 |
+
"eval_cosine_recall@1": 0.22386914380224288,
|
| 176 |
+
"eval_cosine_recall@10": 0.5924252077258059,
|
| 177 |
+
"eval_cosine_recall@3": 0.4076045673568921,
|
| 178 |
+
"eval_cosine_recall@5": 0.4945358123439019,
|
| 179 |
+
"eval_loss": 0.3786991834640503,
|
| 180 |
+
"eval_runtime": 32.9486,
|
| 181 |
+
"eval_samples_per_second": 60.701,
|
| 182 |
+
"eval_steps_per_second": 0.971,
|
| 183 |
+
"step": 395
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"epoch": 0.60672,
|
| 187 |
+
"grad_norm": 2.8829078674316406,
|
| 188 |
+
"learning_rate": 2.197724039829303e-05,
|
| 189 |
+
"loss": 0.4014,
|
| 190 |
+
"step": 474
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"epoch": 0.60672,
|
| 194 |
+
"eval_cosine_accuracy@1": 0.6365,
|
| 195 |
+
"eval_cosine_accuracy@10": 0.876,
|
| 196 |
+
"eval_cosine_accuracy@3": 0.771,
|
| 197 |
+
"eval_cosine_accuracy@5": 0.8255,
|
| 198 |
+
"eval_cosine_map@100": 0.5197156334384408,
|
| 199 |
+
"eval_cosine_mrr@10": 0.7141259920634916,
|
| 200 |
+
"eval_cosine_ndcg@10": 0.601418022062486,
|
| 201 |
+
"eval_cosine_precision@1": 0.6365,
|
| 202 |
+
"eval_cosine_precision@10": 0.26645,
|
| 203 |
+
"eval_cosine_precision@3": 0.48833333333333334,
|
| 204 |
+
"eval_cosine_precision@5": 0.3937,
|
| 205 |
+
"eval_cosine_recall@1": 0.22605882194620797,
|
| 206 |
+
"eval_cosine_recall@10": 0.6025888884821827,
|
| 207 |
+
"eval_cosine_recall@3": 0.42357208114816375,
|
| 208 |
+
"eval_cosine_recall@5": 0.509917211803928,
|
| 209 |
+
"eval_loss": 0.3428954482078552,
|
| 210 |
+
"eval_runtime": 33.015,
|
| 211 |
+
"eval_samples_per_second": 60.579,
|
| 212 |
+
"eval_steps_per_second": 0.969,
|
| 213 |
+
"step": 474
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"epoch": 0.70784,
|
| 217 |
+
"grad_norm": 2.7049639225006104,
|
| 218 |
+
"learning_rate": 1.6358463726884778e-05,
|
| 219 |
+
"loss": 0.3779,
|
| 220 |
+
"step": 553
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"epoch": 0.70784,
|
| 224 |
+
"eval_cosine_accuracy@1": 0.6455,
|
| 225 |
+
"eval_cosine_accuracy@10": 0.8815,
|
| 226 |
+
"eval_cosine_accuracy@3": 0.784,
|
| 227 |
+
"eval_cosine_accuracy@5": 0.8345,
|
| 228 |
+
"eval_cosine_map@100": 0.5322933983250332,
|
| 229 |
+
"eval_cosine_mrr@10": 0.7239722222222216,
|
| 230 |
+
"eval_cosine_ndcg@10": 0.6129085102767301,
|
| 231 |
+
"eval_cosine_precision@1": 0.6455,
|
| 232 |
+
"eval_cosine_precision@10": 0.27020000000000005,
|
| 233 |
+
"eval_cosine_precision@3": 0.49716666666666665,
|
| 234 |
+
"eval_cosine_precision@5": 0.39830000000000004,
|
| 235 |
+
"eval_cosine_recall@1": 0.2337385415837256,
|
| 236 |
+
"eval_cosine_recall@10": 0.6114790331062327,
|
| 237 |
+
"eval_cosine_recall@3": 0.43581210236649,
|
| 238 |
+
"eval_cosine_recall@5": 0.5201249831864138,
|
| 239 |
+
"eval_loss": 0.32787367701530457,
|
| 240 |
+
"eval_runtime": 33.0268,
|
| 241 |
+
"eval_samples_per_second": 60.557,
|
| 242 |
+
"eval_steps_per_second": 0.969,
|
| 243 |
+
"step": 553
|
| 244 |
+
},
|
| 245 |
+
{
|
| 246 |
+
"epoch": 0.80896,
|
| 247 |
+
"grad_norm": 2.0675265789031982,
|
| 248 |
+
"learning_rate": 1.073968705547653e-05,
|
| 249 |
+
"loss": 0.3463,
|
| 250 |
+
"step": 632
|
| 251 |
+
},
|
| 252 |
+
{
|
| 253 |
+
"epoch": 0.80896,
|
| 254 |
+
"eval_cosine_accuracy@1": 0.656,
|
| 255 |
+
"eval_cosine_accuracy@10": 0.889,
|
| 256 |
+
"eval_cosine_accuracy@3": 0.793,
|
| 257 |
+
"eval_cosine_accuracy@5": 0.839,
|
| 258 |
+
"eval_cosine_map@100": 0.5425920958735082,
|
| 259 |
+
"eval_cosine_mrr@10": 0.7340821428571421,
|
| 260 |
+
"eval_cosine_ndcg@10": 0.6223116530478937,
|
| 261 |
+
"eval_cosine_precision@1": 0.656,
|
| 262 |
+
"eval_cosine_precision@10": 0.27415,
|
| 263 |
+
"eval_cosine_precision@3": 0.504,
|
| 264 |
+
"eval_cosine_precision@5": 0.4019000000000001,
|
| 265 |
+
"eval_cosine_recall@1": 0.23843478790276604,
|
| 266 |
+
"eval_cosine_recall@10": 0.6201721618621493,
|
| 267 |
+
"eval_cosine_recall@3": 0.442197840531875,
|
| 268 |
+
"eval_cosine_recall@5": 0.5237564546607093,
|
| 269 |
+
"eval_loss": 0.30987244844436646,
|
| 270 |
+
"eval_runtime": 33.1417,
|
| 271 |
+
"eval_samples_per_second": 60.347,
|
| 272 |
+
"eval_steps_per_second": 0.966,
|
| 273 |
+
"step": 632
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"epoch": 0.91008,
|
| 277 |
+
"grad_norm": 1.9332996606826782,
|
| 278 |
+
"learning_rate": 5.120910384068279e-06,
|
| 279 |
+
"loss": 0.3202,
|
| 280 |
+
"step": 711
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
"epoch": 0.91008,
|
| 284 |
+
"eval_cosine_accuracy@1": 0.6545,
|
| 285 |
+
"eval_cosine_accuracy@10": 0.89,
|
| 286 |
+
"eval_cosine_accuracy@3": 0.7925,
|
| 287 |
+
"eval_cosine_accuracy@5": 0.841,
|
| 288 |
+
"eval_cosine_map@100": 0.5411107394124216,
|
| 289 |
+
"eval_cosine_mrr@10": 0.7325833333333327,
|
| 290 |
+
"eval_cosine_ndcg@10": 0.6220169640997574,
|
| 291 |
+
"eval_cosine_precision@1": 0.6545,
|
| 292 |
+
"eval_cosine_precision@10": 0.27425,
|
| 293 |
+
"eval_cosine_precision@3": 0.5031666666666667,
|
| 294 |
+
"eval_cosine_precision@5": 0.4011,
|
| 295 |
+
"eval_cosine_recall@1": 0.23852962917260728,
|
| 296 |
+
"eval_cosine_recall@10": 0.6212349911293668,
|
| 297 |
+
"eval_cosine_recall@3": 0.4422107764041644,
|
| 298 |
+
"eval_cosine_recall@5": 0.5245186089315591,
|
| 299 |
+
"eval_loss": 0.29744598269462585,
|
| 300 |
+
"eval_runtime": 33.0411,
|
| 301 |
+
"eval_samples_per_second": 60.531,
|
| 302 |
+
"eval_steps_per_second": 0.968,
|
| 303 |
+
"step": 711
|
| 304 |
+
}
|
| 305 |
+
],
|
| 306 |
+
"logging_steps": 79,
|
| 307 |
+
"max_steps": 782,
|
| 308 |
+
"num_input_tokens_seen": 0,
|
| 309 |
+
"num_train_epochs": 1,
|
| 310 |
+
"save_steps": 79,
|
| 311 |
+
"stateful_callbacks": {
|
| 312 |
+
"TrainerControl": {
|
| 313 |
+
"args": {
|
| 314 |
+
"should_epoch_stop": false,
|
| 315 |
+
"should_evaluate": false,
|
| 316 |
+
"should_log": false,
|
| 317 |
+
"should_save": true,
|
| 318 |
+
"should_training_stop": true
|
| 319 |
+
},
|
| 320 |
+
"attributes": {}
|
| 321 |
+
}
|
| 322 |
+
},
|
| 323 |
+
"total_flos": 0.0,
|
| 324 |
+
"train_batch_size": 64,
|
| 325 |
+
"trial_name": null,
|
| 326 |
+
"trial_params": null
|
| 327 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cdea35d0724c9e06d3f852a4286ce48146ba93db37ca02f0e361541763ae50b7
|
| 3 |
+
size 6097
|