Views
No views yet
openai-community/gpt2 and patches it at runtime. Because this uses trust_remote_code, HF Inference API/Serverless is not supported; run in your own environment or notebook.1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch as th
3
4repo = "jackal79/gpt2-ibce-lowrank-192"
5rev = "a71015d1333757bedaaa2437333cd44415076218" # pinned revision
6
7tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True, revision=rev)
8mdl = AutoModelForCausalLM.from_pretrained(
9 repo, trust_remote_code=True, revision=rev, dtype=th.float16
10).cuda().eval()
11
12x = tok("Hello from IBCE low-rank!", return_tensors="pt").to("cuda")
13y = mdl.generate(**x, max_new_tokens=64, do_sample=False)
14print(tok.decode(y[0], skip_special_tokens=True))
15
16## Licensing
17This repository is released under an **Evaluation License** for non-production, non-hosted use.
18Commercial production or hosted use requires a separate license.
19Contact **jack@thestardrive.com**.
20
21The full license text is in [`LICENSE.txt`](https://huggingface.co/jackal79/gpt2-ibce-lowrank-192/blob/main/LICENSE.txt).
22