Downloads · 30 days
8
22% of all-time downloads
yb1n/0409_deep_hw
0409_deep_hw is a feature extraction model from yb1n. Use it when you need embeddings to search or compare text. It is set up for transformers.
PyTorch로 구현한 Transformer Encoder입니다. PositionWiseFeedForward, EncoderBlock, TransformerEncoder 모듈과 PretrainedConfig를 상속한 CustomConfig를 포함합니다.
Downloads · 30 days
8
22% of all-time downloads
All-time downloads
36
Public
Repo size
54.8 MB
Likes
0
Public
Click a slice to open those files.
.ipynb174 KB · 94%
From the Hugging Face model README
PyTorch로 구현한 Transformer Encoder입니다. PositionWiseFeedForward, EncoderBlock, TransformerEncoder 모듈과 PretrainedConfig를 상속한 CustomConfig를 포함합니다.
configuration_custom.py: CustomConfigmodeling_custom.py: PositionWiseFeedForward, EncoderBlock, TransformerEncoderconfig.json: 직렬화된 모델 설정(configuration)import torch
from configuration_custom import CustomConfig
from modeling_custom import TransformerEncoder
config = CustomConfig.from_pretrained(".")
model = TransformerEncoder(config)
input_ids = torch.randint(0, config.vocab_size, (2, 16))
pad_mask = torch.ones(2, 16, dtype=torch.long)
outputs = model(input_ids, pad_mask)
print(outputs.shape)