File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# pytest: huggingface, requires_heavy_ram, llm
22
3- import torch
4- from transformers import AutoModelForCausalLM , AutoTokenizer
5-
63import mellea .stdlib .functional as mfuncs
74from mellea .backends .adapters .adapter import AdapterType , IntrinsicAdapter
85from mellea .backends .huggingface import LocalHFBackend
129# This is an example for how you would directly use intrinsics. See `mellea/stdlib/intrinsics/rag.py`
1310# for helper functions.
1411
15- # Force CPU usage by creating custom config
16- model_id = "ibm-granite/granite-3.3-8b-instruct"
17- device = torch .device ("cpu" )
18- tokenizer = AutoTokenizer .from_pretrained (model_id )
19- model = AutoModelForCausalLM .from_pretrained (model_id , device_map = "cpu" )
20-
21- custom_config = (tokenizer , model , device )
22- backend = LocalHFBackend (model_id = model_id , custom_config = custom_config )
12+ backend = LocalHFBackend (model_id = "ibm-granite/granite-3.3-8b-instruct" )
2313
2414# Create the Adapter. IntrinsicAdapter's default to ALORAs.
2515req_adapter = IntrinsicAdapter (
You can’t perform that action at this time.
0 commit comments