(args)
| 90 | return model, tokenizer |
| 91 | |
| 92 | def create_model_tokenizer_cr(args): |
| 93 | |
| 94 | model = AutoModelForCausalLM.from_pretrained( |
| 95 | args.model, |
| 96 | device_map="auto", |
| 97 | torch_dtype = torch.bfloat16) |
| 98 | |
| 99 | if "llama" in args.model: |
| 100 | |
| 101 | if "Llama-3" in args.model: |
| 102 | tokenizer = AutoTokenizer.from_pretrained( |
| 103 | args.model, |
| 104 | use_fast=True, |
| 105 | model_max_length=args.max_seq_length, |
| 106 | padding="max_length", |
| 107 | ) |
| 108 | else: |
| 109 | tokenizer = LlamaTokenizer.from_pretrained( |
| 110 | args.model, |
| 111 | use_fast=True, |
| 112 | model_max_length=args.max_seq_length, |
| 113 | padding="max_length", |
| 114 | ) |
| 115 | |
| 116 | else: |
| 117 | |
| 118 | tokenizer = AutoTokenizer.from_pretrained( |
| 119 | args.model, |
| 120 | use_fast=True, |
| 121 | model_max_length=args.max_seq_length, |
| 122 | padding="max_length", |
| 123 | ) |
| 124 | |
| 125 | tokenizer.pad_token_id = (0) |
| 126 | tokenizer.padding_side = "left" |
| 127 | |
| 128 | |
| 129 | return model, tokenizer |
| 130 | |
| 131 | |
| 132 | def create_peft_model_it(model, args): |
nothing calls this directly
no outgoing calls
no test coverage detected