zemlyansky / modelzoo

TensorFlow.js models
https://www.npmjs.com/package/modelzoo
0 stars 0 forks source link

Strict mode shows 35 errors in 8 files (any + tfjs) #2

Open zemlyansky opened 7 months ago

zemlyansky commented 7 months ago

When compiling with "strict": true tsc throws:

Found 35 errors in 8 files.                                                                    

Errors  Files                                                                                                                                                                                  
     1  node_modules/@tensorflow/tfjs-layers/dist/engine/training.d.ts:144                                                                                                                     
     8  node_modules/@tensorflow/tfjs-layers/dist/keras_format/topology_config.d.ts:17         
     4  node_modules/@tensorflow/tfjs-layers/dist/keras_format/training_config.d.ts:31         
     1  node_modules/@tensorflow/tfjs-layers/dist/keras_format/types.d.ts:90                                                                                                                   
     1  node_modules/@tensorflow/tfjs-layers/dist/layers/core.d.ts:99                          
     4  node_modules/modelzoo/src/layers.ts:79                                                                                                                                                 
    11  node_modules/modelzoo/src/models/clip.ts:6                                             
     5  node_modules/modelzoo/src/utils.ts:3

In the modelzoo code it's mostly something something has an 'any' type which in theory easy to fix. tfjs should be ignored?

zemlyansky commented 7 months ago

All modelzoo errors:

node_modules/modelzoo/src/layers.ts:79:23 - error TS7031: Binding element 'xShape' implicitly has an 'any' type.                                                                                                                               

79   computeOutputShape([xShape, tokensShape]) {                                                                                                                                               
                         ~~~~~~                                                                                                                                                                

node_modules/modelzoo/src/layers.ts:79:31 - error TS7031: Binding element 'tokensShape' implicitly has an 'any' type.                                                                                                                          

79   computeOutputShape([xShape, tokensShape]) {                                                                                                                                                                                                                                  
                                 ~~~~~~~~~~~                                                                                                                                                   

node_modules/modelzoo/src/layers.ts:83:8 - error TS7006: Parameter 'inputs' implicitly has an 'any' type.                                                                                                                                      

83   call(inputs, kwargs) {                                                                                                                                                                    
          ~~~~~~                                                                                                                                                                               

node_modules/modelzoo/src/layers.ts:83:16 - error TS7006: Parameter 'kwargs' implicitly has an 'any' type.                                                                                                                                     

83   call(inputs, kwargs) {                                                                                                                                                                    
                  ~~~~~~                                                                                                                                                                       

node_modules/modelzoo/src/models/clip.ts:6:24 - error TS7006: Parameter 'inputTensor' implicitly has an 'any' type.                                                                                                                                                               

6 function resizeBicubic(inputTensor, [newHeight, newWidth]) {                                                                           
                         ~~~~~~~~~~~                                                                                                                                                           

node_modules/modelzoo/src/models/clip.ts:6:38 - error TS7031: Binding element 'newHeight' implicitly has an 'any' type.                                                                                                                        

6 function resizeBicubic(inputTensor, [newHeight, newWidth]) {                                                                                                 
                                       ~~~~~~~~~                                                                                                                                               

node_modules/modelzoo/src/models/clip.ts:6:49 - error TS7031: Binding element 'newWidth' implicitly has an 'any' type.                                                                                                                         

6 function resizeBicubic(inputTensor, [newHeight, newWidth]) {                                                                                                                                                                                                                                                                 
                                                  ~~~~~~~~                                                                                                                                     

node_modules/modelzoo/src/models/clip.ts:29:27 - error TS7006: Parameter 'pixels' implicitly has an 'any' type.                                                                                                                                

29 function cubicInterpolate(pixels, x, y, width, height, channel) {                                                   
                             ~~~~~~                                                                                                                                                                                                                                                                                                                                                            

node_modules/modelzoo/src/models/clip.ts:29:35 - error TS7006: Parameter 'x' implicitly has an 'any' type.                                                                                                                                     

29 function cubicInterpolate(pixels, x, y, width, height, channel) {                                                                                           
                                     ~                                                                                                                         

node_modules/modelzoo/src/models/clip.ts:29:38 - error TS7006: Parameter 'y' implicitly has an 'any' type.                                                                                                                                     

29 function cubicInterpolate(pixels, x, y, width, height, channel) {                                                                                           
                                        ~                                      

node_modules/modelzoo/src/models/clip.ts:29:41 - error TS7006: Parameter 'width' implicitly has an 'any' type.                                                  

29 function cubicInterpolate(pixels, x, y, width, height, channel) {                           
                                           ~~~~~                                               

node_modules/modelzoo/src/models/clip.ts:29:48 - error TS7006: Parameter 'height' implicitly has an 'any' type.                                                                                                                                

29 function cubicInterpolate(pixels, x, y, width, height, channel) {                                                   
                                                  ~~~~~~                                       

node_modules/modelzoo/src/models/clip.ts:29:56 - error TS7006: Parameter 'channel' implicitly has an 'any' type.                                                                                                                               

29 function cubicInterpolate(pixels, x, y, width, height, channel) {                           
                                                          ~~~~~~~                              

node_modules/modelzoo/src/models/clip.ts:50:32 - error TS7006: Parameter 'values' implicitly has an 'any' type.                                                                                                                                                                                                                                                                                                                                                                                

50 function cubicInterpolateArray(values, x) {                                                                                                                 
                                  ~~~~~~                                                       

node_modules/modelzoo/src/models/clip.ts:50:40 - error TS7006: Parameter 'x' implicitly has an 'any' type.                                                                                                                                                                                                                     

50 function cubicInterpolateArray(values, x) {                                                                         
                                          ~                                                                                                                    

node_modules/modelzoo/src/utils.ts:3:37 - error TS7006: Parameter 'config' implicitly has an 'any' type.                                                                                                                                                                                                                       

3 export function convertMinGPTConfig(config) {                                                                                                                                                                                                
                                      ~~~~~~                                                                                                                   

node_modules/modelzoo/src/utils.ts:18:7 - error TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{}'.                                                                                                                                                                

18       newConfig[mapping[key]] = config[key];                                                                                                                
         ~~~~~~~~~~~~~~~~~~~~~~~                                                                                       

node_modules/modelzoo/src/utils.ts:18:17 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ n_embd: string; n_head: string; n_layer: string; block_size: string; vocab_size: string; attn_pdrop: string; resid_pdrop: string; embd_pdrop: string; model_type: string; }'.                                                                                                                                                                                                                                                                                                                 
  No index signature with a parameter of type 'string' was found on type '{ n_embd: string; n_head: string; n_layer: string; block_size: string; vocab_size: string; attn_pdrop: string; resid_pdrop: string; embd_pdrop: string; model_type: string; }'.                                                                      

18       newConfig[mapping[key]] = config[key];                                                                        
                   ~~~~~~~~~~~~                                                                                        

node_modules/modelzoo/src/utils.ts:20:7 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.                                                                                                                                                             
  No index signature with a parameter of type 'string' was found on type '{}'.                                         

20       newConfig[key] = config[key];                                                                                                                         
         ~~~~~~~~~~~~~~                                                                                                

node_modules/modelzoo/src/utils.ts:26:38 - error TS7006: Parameter 'weights' implicitly has an 'any' type.                                                                                                                                                                                                                     

26 export function convertMinGPTWeights(weights) {