Views
No views yet
1from huggingface_hub import hf_hub_download
2
3hf_hub_download(
4 repo_id="canbingol/exp3_eager_1epoch_lr1e4_500k_vngr_corpus",
5 filename="model.py",
6 repo_type="model",
7 local_dir="./"
8)1import torch
2from transformers import AutoTokenizer
3from model import DecoderCausalLM
4
5model_path = "canbingol/exp3_eager_1epoch_lr1e4_500k_vngr_corpus"
6
7device = "cuda" if torch.cuda.is_available() else "cpu"
8
9model = DecoderCausalLM.from_pretrained(model_path).to(device=device, dtype=torch.bfloat16)
10tokenizer = AutoTokenizer.from_pretrained(model_path)
11
12input_ids = tokenizer.encode("selam ben", return_tensors="pt").to(device)
13
14out_tokens = model.generate(input_ids)
15generated_text = tokenizer.decode(out_tokens.flatten())
16
17print(generated_text)DecoderCausalLM implementation is included in the model files (model.py).