YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)
Simple Translation Model from French to English
import os
import json
from modeling import Transformer
from huggingface_hub import hf_hub_download
hf_model_path = hf_hub_download(
repo_id="bkhmsi/epfl-cs552-translation-fr-en",
filename="pytorch_model.bin"
)
state_dict = torch.load(hf_model_path, map_location="cpu")
config = {
"src_vocab_size": 32000,
"tgt_vocab_size": 32000,
"num_heads": 8,
"num_layers": 8,
"hidden_dim": 1024,
"intermediate_size": 2048
}
model = Transformer(**config)
model.load_state_dict(state_dict)
model.to(device)
model.eval()
hf_tokenizer_path = hf_hub_download(
repo_id="bkhmsi/epfl-cs552-translation-fr-en",
filename="tokenizer.json",
)
tokenizer = PreTrainedTokenizerFast(
tokenizer_file=hf_tokenizer_path,
bos_token="<s>",
eos_token="</s>",
unk_token="<unk>",
pad_token="<pad>",
)
- Downloads last month
- 24
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support