MCPcopy Create free account
hub / github.com/boyiwei/alignment-attribution-code / get_llm

Function get_llm

rewind_ft_model.py:27–37  ·  view source on GitHub ↗
(model_name, cache_dir="llm_weights")

Source from the content-addressed store, hash-verified

25}
26
27def get_llm(model_name, cache_dir="llm_weights"):
28 model = AutoModelForCausalLM.from_pretrained(
29 modeltype2path[model_name],
30 torch_dtype=torch.bfloat16,
31 cache_dir=cache_dir,
32 low_cpu_mem_usage=True,
33 device_map="auto"
34 )
35
36 model.seqlen = model.config.max_position_embeddings
37 return model
38
39def main():
40 parser = argparse.ArgumentParser()

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected