-
Notifications
You must be signed in to change notification settings - Fork 1
Global Cache per smiles per model #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@sfluegel05, Please review the PR
(gnn3) G:\github-aditya0by0\Chebifier\backend>flask run
Loading ChEBI graph from Hugging Face...
Using file `chebi_graph.pkl` from: C:\Users\HP\.cache\huggingface\hub\datasets--chebai--chebifier\snapshots\0e25de22a94f2b9c37b7e69965adb42431ee59e0\chebi_graph.pkl
Initialised Electra model ELECTRA (CHEBI50-v241) (device: cpu)
Initialised GNN model GraphConvNet (CHEBI50-v241) (device: cpu)
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
127.0.0.1 - - [02/Aug/2025 20:55:47] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2025 20:55:49] "GET /static/css/main.e7c2b5e6.css HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2025 20:55:54] "GET /static/js/main.4e6b9364.js HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2025 20:55:56] "GET /api/hierarchy HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2025 20:55:56] "GET /manifest.json HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2025 20:55:57] "GET /favicon.ico HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2025 20:55:57] "GET /logo192.png HTTP/1.1" 200 -
ELECTRA (CHEBI50-v241): 1it [00:04, 4.40s/it]
Model GraphConvNet (CHEBI50-v241) failed to parse a SMILES string at position 0: CC(=O)OC1=CC=CC=C1C(=O)O
Model GraphConvNet (CHEBI50-v241) failed to parse a SMILES string at position 1: C1=CC=C(C=C1)C(=O)O
Sorting predictions from 2 models...
Sorting predictions for ELECTRA (CHEBI50-v241): 100%|█████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 13.44it/s]
Sorting predictions for GraphConvNet (CHEBI50-v241): 100%|████████████████████████████████████████████████████████████████| 2/2 [00:00<?, ?it/s]
Calculated model weightings. The average weights are:
ELECTRA (CHEBI50-v241): 1.692
GraphConvNet (CHEBI50-v241): 1.709
Preds change (step 1): 5034.52734375
Preds change (step 3): -65.22756958007812
Prediction smoothing took 3.96 seconds
127.0.0.1 - - [02/Aug/2025 20:56:41] "POST /api/classify HTTP/1.1" 200 -
[Cache Hit] Prediction for smiles: CC(=O)OC1=CC=CC=C1C(=O)O and model: ELECTRA (CHEBI50-v241) are retrieved from cache.
[Cache Hit] Prediction for smiles: C1=CC=C(C=C1)C(=O)O and model: ELECTRA (CHEBI50-v241) are retrieved from cache.
ELECTRA (CHEBI50-v241): 1it [00:00, 4.16it/s]
Model GraphConvNet (CHEBI50-v241) failed to parse a SMILES string at position 0: CC(=O)OC1=CC=CC=C1C(=O)O
Model GraphConvNet (CHEBI50-v241) failed to parse a SMILES string at position 1: C1=CC=C(C=C1)C(=O)O
Model GraphConvNet (CHEBI50-v241) failed to parse a SMILES string at position 2: CC(=O)Oc1ccccc1C(O)=O
Sorting predictions from 2 models...
Sorting predictions for ELECTRA (CHEBI50-v241): 100%|█████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 25.93it/s]
Sorting predictions for GraphConvNet (CHEBI50-v241): 100%|████████████████████████████████████████████████████████████████| 3/3 [00:00<?, ?it/s]
Calculated model weightings. The average weights are:
ELECTRA (CHEBI50-v241): 1.692
GraphConvNet (CHEBI50-v241): 1.709
Preds change (step 1): 7547.70947265625
Preds change (step 3): -98.42237854003906
Prediction smoothing took 4.07 seconds
127.0.0.1 - - [02/Aug/2025 20:58:14] "POST /api/classify HTTP/1.1" 200 - |
Also, the cache's maxsize is 100 (as per previous default value). Please change the max_size if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. I tested it with the chebifier frontend and it was able to cache smiles individually. I added the predict_smiles_list function for chemlog extra
Closes ChEB-AI/Chebifier#9