Spaces:
Runtime error
Runtime error
Download llava/model/language_model/mpt/custom_embedding.py from LanguageBind/Video-LLaVA: direct link, hf CLI and curl.
- Browser
- Download file 305 Bytes
-
https://huggingface.co/spaces/LanguageBind/Video-LLaVA/resolve/main/llava/model/language_model/mpt/custom_embedding.py
- Command line
-
hf download hf://spaces/LanguageBind/Video-LLaVA/llava/model/language_model/mpt/custom_embedding.py
-
curl -L -o custom_embedding.py https://huggingface.co/spaces/LanguageBind/Video-LLaVA/resolve/main/llava/model/language_model/mpt/custom_embedding.py
305 Bytes
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| from torch import Tensor | |
| class SharedEmbedding(nn.Embedding): | |
| def forward(self, input: Tensor, unembed: bool=False) -> Tensor: | |
| if unembed: | |
| return F.linear(input, self.weight) | |
| return super().forward(input) |