littlelittlecloud
split model into small ones
7779efa
raw
history blame
471 Bytes
using TorchSharp;
public class ClipEncoder
{
private readonly torch.jit.ScriptModule _model;
public torch.Device Device {get;}
public ClipEncoder(string modelPath, torch.Device device)
{
_model = TorchSharp.torch.jit.load(modelPath);
Device = device;
_model.to(Device);
_model.eval();
}
public torch.Tensor Forward(torch.Tensor tokenTensor)
{
return (torch.Tensor)_model.forward(tokenTensor);
}
}