commissarsilver commited on
Commit
9e23412
·
verified ·
1 Parent(s): 4b5daef

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +13 -14
README.md CHANGED
@@ -21,26 +21,25 @@ library_name: peft
21
 
22
  ## Uses
23
 
24
- This model is finetuned from `vidore/colpali-v1.2` using the PEFT library. To use this model, you can use the following code:
25
 
26
  ```python
27
- from transformers import AutoModelForCausalLM, AutoTokenizer
28
- from peft import PeftModel
29
 
30
- ### This will load the basemodel ###
31
- # Load the base model
32
- model_name = "colpali_finetuned"
33
- model = AutoModelForCausalLM.from_pretrained(model_name)
34
 
35
- # Load the tokenizer
36
- tokenizer = AutoTokenizer.from_pretrained(model_name)
 
 
 
 
37
 
 
 
38
 
39
- ### This will load the adapter model ###
40
-
41
- peft_model_path='colpali_finetuned/checkpoint-587'
42
- model = PeftModel.from_pretrained(peft_model_path)
43
  ```
44
 
45
-
46
  - PEFT 0.11.1
 
21
 
22
  ## Uses
23
 
24
+ This model is finetuned from `vidore/colpali-v1.2` using the PEFT library. To use this model, you only need to change the path ColPali is loaded from.
25
 
26
  ```python
27
+ device = get_torch_device("auto")
28
+ print(f"Device used: {device}")
29
 
30
+ # Model name
31
+ model_name = "path/to/fine_tuned_model"
 
 
32
 
33
+ # Load model
34
+ model = ColPali.from_pretrained(
35
+ model_name,
36
+ torch_dtype=torch.bfloat16,
37
+ device_map=device,
38
+ ).eval()
39
 
40
+ # Load processor
41
+ processor = cast(ColPaliProcessor, ColPaliProcessor.from_pretrained(model_name))
42
 
 
 
 
 
43
  ```
44
 
 
45
  - PEFT 0.11.1