Update guardian-core/granite-4.0-micro/README.md

#21
by mnagired - opened
guardian-core/granite-4.0-micro/README.md CHANGED
@@ -31,19 +31,26 @@ tags:
31
  ### Installation
32
 
33
  ```bash
34
- pip install transformers peft torch
35
  ```
36
 
37
  ### Example 1: Detect function calling hallucination (LoRA with vLLM)
38
 
39
  ```python
40
  import json
 
41
  from vllm import LLM, SamplingParams
42
  from vllm.lora.request import LoRARequest
43
  from transformers import AutoTokenizer
44
 
45
  base_model = "ibm-granite/granite-4.0-micro"
46
- adapter_path = "path/to/granite-guardian-4.0-micro-lora" # local path or HF repo
 
 
 
 
 
 
47
 
48
  # Load tokenizer
49
  tokenizer = AutoTokenizer.from_pretrained(base_model)
 
31
  ### Installation
32
 
33
  ```bash
34
+ pip install transformers peft torch vllm huggingface_hub
35
  ```
36
 
37
  ### Example 1: Detect function calling hallucination (LoRA with vLLM)
38
 
39
  ```python
40
  import json
41
+ from huggingface_hub import snapshot_download
42
  from vllm import LLM, SamplingParams
43
  from vllm.lora.request import LoRARequest
44
  from transformers import AutoTokenizer
45
 
46
  base_model = "ibm-granite/granite-4.0-micro"
47
+
48
+ # Download the adapter from Hugging Face Hub
49
+ adapter_path = snapshot_download(
50
+ "ibm-granite/granitelib-guardian-r1.0",
51
+ allow_patterns="guardian-core/granite-4.0-micro/lora/*",
52
+ )
53
+ adapter_path = f"{adapter_path}/guardian-core/granite-4.0-micro/lora"
54
 
55
  # Load tokenizer
56
  tokenizer = AutoTokenizer.from_pretrained(base_model)