Skip to content
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

Accurate method to determine the model size #302

Open
mustansarsaeed opened this issue Feb 17, 2021 · 1 comment
Open

Accurate method to determine the model size #302

mustansarsaeed opened this issue Feb 17, 2021 · 1 comment
Labels
Type: Question ❔ Question about implementation or some technical aspect

Comments

@mustansarsaeed
Copy link

Hi, I am using syft 0.2.x. I want to determine the size of the model. What is the correct way to determine the size? I have two options:

Option: 1

val modelFile = File(modelFileLocation)
modelFile.length()

Option 2

SyftState.loadSyftState(modelFile)
size of syftstate

In terms of model size and number of parameters, SyftState should be used or modelFile.length()?

Thanks.

@mustansarsaeed mustansarsaeed added the Type: Question ❔ Question about implementation or some technical aspect label Feb 17, 2021
@vkkhare
Copy link
Member

vkkhare commented May 9, 2021

@mustansarsaeed number of parameters can be calculated from model

val num_params = model.getParamArray().reduce{ sum, tensor ->
    sum + tensor.shape().reduce{ m,e -> m*e }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question ❔ Question about implementation or some technical aspect
Projects
None yet
Development

No branches or pull requests

2 participants