-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
107 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import { SentencePieceProcessor, cleanText } from "./sentencePieceProcessor"; | ||
import { llama_3_1_tokeniser_b64 } from "./llama_3_1_tokeniser_model"; | ||
import { smart_b64 } from "./smart"; | ||
import { clean_30k_b64 } from "./clean_30k"; | ||
|
||
export { SentencePieceProcessor, cleanText } | ||
export default { SentencePieceProcessor, cleanText } | ||
export { SentencePieceProcessor, cleanText, llama_3_1_tokeniser_b64, clean_30k_b64, smart_b64 }; | ||
export default { SentencePieceProcessor, cleanText }; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
function convertMoldel(filePath, output, variableName) { | ||
fs.readFile(filePath, (err, data) => { | ||
if (err) { | ||
console.error('Erreur lors de la lecture du fichier binaire:', err); | ||
return; | ||
} | ||
|
||
// Convertir le contenu en base64 | ||
const base64Content = data.toString('base64'); | ||
|
||
// Créer la chaîne de caractères contenant l'exportation de la constante | ||
const outputContent = `export const ${variableName} = "${base64Content}";`; | ||
|
||
// Chemin vers le fichier de sortie | ||
const outputFilePath = path.join(__dirname, output); | ||
|
||
// Écrire la chaîne dans le fichier de sortie | ||
fs.writeFile(outputFilePath, outputContent, (err) => { | ||
if (err) { | ||
console.error('Erreur lors de l\'écriture du fichier de sortie:', err); | ||
return; | ||
} | ||
console.log('Fichier de sortie généré avec succès:', outputFilePath); | ||
}); | ||
}); | ||
} | ||
|
||
convertMoldel('./test/llama-3.1-tokenizer.model', '../src/llama_3_1_tokeniser_model.ts', 'llama_3_1_tokeniser_b64'); | ||
convertMoldel('./test/30k-clean.model', '../src/clean_30k.ts', 'clean_30k_b64'); | ||
convertMoldel('./test/smart.model', '../src/smart.ts', 'smart_b64'); |