MCPcopy Create free account
hub / github.com/NanGePlus/LightRAGTest / initialize_hf_model

Function initialize_hf_model

LightRAG/lightrag/llm.py:222–232  ·  view source on GitHub ↗
(model_name)

Source from the content-addressed store, hash-verified

220
221@lru_cache(maxsize=1)
222def initialize_hf_model(model_name):
223 hf_tokenizer = AutoTokenizer.from_pretrained(
224 model_name, device_map="auto", trust_remote_code=True
225 )
226 hf_model = AutoModelForCausalLM.from_pretrained(
227 model_name, device_map="auto", trust_remote_code=True
228 )
229 if hf_tokenizer.pad_token is None:
230 hf_tokenizer.pad_token = hf_tokenizer.eos_token
231
232 return hf_model, hf_tokenizer
233
234
235async def hf_model_if_cache(

Callers 1

hf_model_if_cacheFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected