Spaces:
Running
Running
Download scripts/validate-code-generation.js from othmanekabal/tdgbench-studio: direct link, hf CLI and curl.
- Browser
- Download file 1.64 kB
-
https://huggingface.co/spaces/othmanekabal/tdgbench-studio/resolve/main/scripts/validate-code-generation.js
- Command line
-
hf download hf://spaces/othmanekabal/tdgbench-studio/scripts/validate-code-generation.js
-
curl -L -o validate-code-generation.js https://huggingface.co/spaces/othmanekabal/tdgbench-studio/resolve/main/scripts/validate-code-generation.js
1.64 kB
| const fs = require('fs'); | |
| const vm = require('vm'); | |
| const context = { | |
| GRAPH_MODELS: ['GCN','GAT','RGCN','TransEGCN_conv','TransEGCN_attn','RotatEGCN_conv','RotatEGCN_attn'] | |
| }; | |
| vm.createContext(context); | |
| vm.runInContext(fs.readFileSync('assets/js/pages/evaluate-graph.js','utf8'),context); | |
| function state(overrides){ | |
| return Object.assign({ | |
| dataset:'biomed',name:'KGGen',path:'kggen.json',verify:true,mode:'all', | |
| quickModel:'GCN',models:new Set(['GCN','GAT']),emb:'random',results:'tdgbench_results' | |
| },overrides||{}); | |
| } | |
| let code=context.genC1(state()); | |
| if(!code.includes('bench.check_new_graph(')||!code.includes('coverage.to_dict()')||!code.includes('assert coverage.is_complete'))throw new Error('La vérification du graphe est absente.'); | |
| if(code.includes(' models=')||code.includes(' model='))throw new Error('All models ne doit pas énumérer les modèles.'); | |
| if(!code.includes('result.best_results().to_string(index=False)'))throw new Error('L’affichage des meilleurs résultats est absent.'); | |
| code=context.genC1(state({verify:false})); | |
| if(code.includes('check_new_graph'))throw new Error('La vérification ne doit pas apparaître quand la case est décochée.'); | |
| code=context.genC1(state({mode:'custom'})); | |
| if(!code.includes('models=["GCN", "GAT"]'))throw new Error('La sélection personnalisée des modèles est incorrecte.'); | |
| code=context.genC1(state({mode:'quick',quickModel:'RGCN'})); | |
| if(!code.includes('model="RGCN"')||!code.includes('bench.evaluate('))throw new Error('Le quick test est incorrect.'); | |
| console.log('Génération de code valide : vérification, all models, sélection et quick test.'); | |