Views
No views yet
cu-llm-merged) on HuggingFace Inference Endpoints.| File | Purpose |
|---|---|
handler.py | EndpointHandler — builds the training prompt, runs generation, returns the answer |
requirements.txt | Runtime deps installed by the Endpoint builder |
cu-llm-merged off Drive):1from huggingface_hub import login
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4login(token=HF_TOKEN)
5p = "/content/drive/MyDrive/cu-llm-merged"
6AutoModelForCausalLM.from_pretrained(p).push_to_hub("rdmurugan007/cu-llm", private=True)
7AutoTokenizer.from_pretrained(p).push_to_hub("rdmurugan007/cu-llm", private=True)handler.py and requirements.txt
to the root of rdmurugan007/cu-llm:1from huggingface_hub import upload_file
2upload_file(path_or_fileobj="handler.py", path_in_repo="handler.py", repo_id="rdmurugan007/cu-llm")
3upload_file(path_or_fileobj="requirements.txt", path_in_repo="requirements.txt", repo_id="rdmurugan007/cu-llm")rdmurugan007/cu-llm.handler.py)LOAD_IN_4BIT=False in handler.py)1curl https://<your-endpoint>.endpoints.huggingface.cloud \
2 -H "Authorization: Bearer $HF_TOKEN" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "inputs": "What is a CUSO and how do credit unions use them?",
6 "parameters": {"max_new_tokens": 300, "temperature": 0.0}
7 }'{"answer": "A CUSO (Credit Union Service Organization) is ...", "raw": "..."}/api/cu-chat
route:1const res = await fetch(process.env.CU_LLM_ENDPOINT_URL!, {
2 method: "POST",
3 headers: {
4 Authorization: `Bearer ${process.env.HF_TOKEN}`,
5 "Content-Type": "application/json",
6 },
7 body: JSON.stringify({ inputs: question, parameters: { max_new_tokens: 300 } }),
8});
9const { answer } = await res.json();