Allow passing model parameters for PyTorch server
See original GitHub issue/kind feature
Describe the solution you’d like
Currently we can only pass ModelClassName
on Pytorch spec, however most of time ModelClass requires additional parameters such as EmbeddingSize
and Layers
etc.
This is an example
class TorchTextClassifier(nn.Module):
def __init__(self, vocab_size, embedding_dim, seq_length, num_classes,
num_filters, kernel_size, pool_size, dropout_rate):
super(TorchTextClassifier, self).__init__()
self.embeddings = nn.Embedding(num_embeddings=vocab_size, embedding_dim=embedding_dim)
self.conv1 = nn.Conv1d(seq_length, num_filters, kernel_size)
self.max_pool1 = nn.MaxPool1d(pool_size)
self.conv2 = nn.Conv1d(num_filters, num_filters*2, kernel_size)
self.dropout = nn.Dropout(dropout_rate)
self.dense = nn.Linear(num_filters*2, num_classes)
Anything else you would like to add: The proposal is to support passing additional parameters on pytorch spec
default:
predictor:
pytorch:
modelClassName: TorchTextClassifier
modelClassKwargs: {'embedding_size': 128, 'n_layers': 6}
Issue Analytics
- State:
- Created 4 years ago
- Comments:22 (13 by maintainers)
Top Results From Across the Web
Allow passing model parameters for PyTorch server · Issue #546
Currently we can only pass ModelClassName on Pytorch spec, however most of time ModelClass requires additional parameters such as EmbeddingSize ...
Read more >Implementing a Parameter Server Using Distributed RPC ...
This tutorial walks through a simple example of implementing a parameter server using PyTorch's Distributed RPC framework. The parameter server framework is ...
Read more >Optimizing Model Parameters — PyTorch Tutorials 1.13.1+ ...
Hyperparameters are adjustable parameters that let you control the model ... by registering the model's parameters that need to be trained, and passing...
Read more >5. Advanced configuration - PyTorch
If --ts-config parameter is passed to torchserve , TorchServe loads the configuration from the path specified by the parameter.
Read more >Building Models with PyTorch
torch.nn.Module and torch.nn.Parameter. In this video, we'll be discussing some of the tools PyTorch makes available for building deep learning networks.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@yuzisun @WangAllen851018 @nlarusstone
Hi, WangAllen851018 and I are in the same team. Now we have the solution of this issue, and we want to contribute our code to kfserving project. But we don’t know how to do that (We already have the CLA).
@alexcoca currently we are doing
torch.save(model.state_dict(), PATH)
since this is suggested way on pytorch website https://pytorch.org/tutorials/beginner/saving_loading_models.html#saving-loading-model-for-inference. Saving the entire model seems unsafe.