Views
No views yet
find_longest_common_sequence_length(ground_truth_tokens, generated_tokens) / len(ground_truth_tokens)1from peft import PeftModel, PeftConfig
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4peft_model_id = "TymofiiNasobko/MamayLM-function-calling"
5peftconfig = PeftConfig.from_pretrained(peft_model_id)
6model = AutoModelForCausalLM.from_pretrained(
7 peftconfig.base_model_name_or_path,
8 attn_implementation="eager",
9 device_map=device,
10)
11tokenizer = AutoTokenizer.from_pretrained(peft_model_id)
12model.resize_token_embeddings(len(tokenizer))
13model = PeftModel.from_pretrained(model, peft_model_id)
14model = model.to(compute_dtype)
15model = model.eval()1@misc{vonwerra2022trl,
2 title = {{TRL: Transformer Reinforcement Learning}},
3 author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
4 year = 2020,
5 journal = {GitHub repository},
6 publisher = {GitHub},
7 howpublished = {\url{https://github.com/huggingface/trl}}
8}