Views
No views yet
allenai/scibert_scivocab_uncased, max length 512
Optional features:1from huggingface_hub import hf_hub_download
2from safetensors.torch import load_file
3from transformers import AutoTokenizer
4import importlib.util, sys
5
6repo_id = "JasonYan777/scibert-multimodal-novelty"
7tok = AutoTokenizer.from_pretrained(repo_id)
8ckpt = hf_hub_download(repo_id, "model.safetensors")
9code = hf_hub_download(repo_id, "modeling_multimodal_scibert.py")
10
11spec = importlib.util.spec_from_file_location("modeling_multimodal_scibert", code)
12mod = importlib.util.module_from_spec(spec)
13sys.modules["modeling_multimodal_scibert"] = mod
14spec.loader.exec_module(mod)
15Model = mod.MultiModalSciBERT
16
17model = Model(
18 scibert_model="allenai/scibert_scivocab_uncased",
19 use_classification_emb=True,
20 use_proximity_emb=True,
21 use_similarity_features=True,
22)
23state = load_file(ckpt)
24model.load_state_dict(state)
25model.eval()