Skip to content

Conversation

aditya0by0
Copy link
Member

@aditya0by0 aditya0by0 requested a review from sfluegel05 August 1, 2025 18:34
@aditya0by0 aditya0by0 self-assigned this Aug 1, 2025
@aditya0by0 aditya0by0 added enhancement New feature or request priority: high labels Aug 1, 2025
@aditya0by0
Copy link
Member Author

aditya0by0 commented Aug 2, 2025

@sfluegel05, Please review the PR

[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.


(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 -

@aditya0by0 aditya0by0 marked this pull request as ready for review August 2, 2025 19:02
@aditya0by0
Copy link
Member Author

Also, the cache's maxsize is 100 (as per previous default value). Please change the max_size if needed.

Copy link
Contributor

@sfluegel05 sfluegel05 left a 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

@aditya0by0 aditya0by0 requested a review from sfluegel05 August 11, 2025 10:27
@sfluegel05 sfluegel05 merged commit 0c9e492 into dev Aug 11, 2025
2 checks passed
@sfluegel05 sfluegel05 deleted the feature/result-cache branch August 11, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There is no result cache on the server side

2 participants