Views
No views yet
1import torch
2from huggingface_hub import cached_download
3from transformers import AutoModelForCausalLM
4from peft import LoraConfig, PeftModel, get_peft_model
5
6torch.manual_seed(0)
7model = AutoModelForCausalLM.from_pretrained("hf-internal-testing/tiny-random-BertModel").eval()
8lora_config = LoraConfig(init_lora_weights=False)
9peft_model = get_peft_model(model, lora_config)
10peft_model.push_to_hub("peft-internal-testing/tiny-random-BertModel-lora")
11
12del model, peft_model
13torch.manual_seed(0)
14model = AutoModelForCausalLM.from_pretrained("hf-internal-testing/tiny-random-BertModel").eval()
15torch.manual_seed(1)
16lora_config = LoraConfig(init_lora_weights=False)
17peft_model = get_peft_model(model, lora_config)
18peft_model.push_to_hub("peft-internal-testing/tiny-random-BertModel-lora", revision="v1.2.3")