"src/git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "4c729bf3c668ad88b2a8ecc9dd77680962e3a41a"
Unverified Commit 129f0604 authored by Sam Shleifer's avatar Sam Shleifer Committed by GitHub
Browse files

Delete untested, broken Model2LSTM (#2968)

parent 0e84559d
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
import logging import logging
import os import os
import torch
from torch import nn from torch import nn
from .modeling_auto import AutoModel, AutoModelWithLMHead from .modeling_auto import AutoModel, AutoModelWithLMHead
...@@ -294,21 +293,3 @@ class Model2Model(PreTrainedEncoderDecoder): ...@@ -294,21 +293,3 @@ class Model2Model(PreTrainedEncoderDecoder):
) )
return model return model
class Model2LSTM(PreTrainedEncoderDecoder):
@classmethod
def from_pretrained(cls, *args, **kwargs):
if kwargs.get("decoder_model", None) is None:
# We will create a randomly initilized LSTM model as decoder
if "decoder_config" not in kwargs:
raise ValueError(
"To load an LSTM in Encoder-Decoder model, please supply either: "
" - a torch.nn.LSTM model as `decoder_model` parameter (`decoder_model=lstm_model`), or"
" - a dictionary of configuration parameters that will be used to initialize a"
" torch.nn.LSTM model as `decoder_config` keyword argument. "
" E.g. `decoder_config={'input_size': 768, 'hidden_size': 768, 'num_layers': 2}`"
)
kwargs["decoder_model"] = torch.nn.LSTM(kwargs.pop("decoder_config"))
model = super().from_pretrained(*args, **kwargs)
return model
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment