LaZeAsh commited on
Commit
f876cf6
1 Parent(s): 1c0a926

Update README.md

Browse files

Add inference code sample

Files changed (1) hide show
  1. README.md +18 -1
README.md CHANGED
@@ -24,9 +24,26 @@ based on the information in their previous medical records, current symptoms, ag
24
 
25
  ## Intended uses & limitations ⁉️
26
 
27
- Sample code snippet:
28
  ```py
 
 
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  ```
31
 
32
  Uses: To use Artificial Intelligence technology to diagnose patient based off of multiple parameters ranging from their age to their
 
24
 
25
  ## Intended uses & limitations ⁉️
26
 
27
+ Code inference sample:
28
  ```py
29
+ from peft import PeftModel, PeftConfig
30
+ from transformers import AutoModelForCausalLM, AutoTokenizer
31
 
32
+ config = PeftConfig.from_pretrained("LaZeAsh/gemma-2b-lahacks")
33
+ model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it")
34
+ model = PeftModel.from_pretrained(model, "LaZeAsh/gemma-2b-lahacks")
35
+
36
+ tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it")
37
+
38
+ prompt = "I feel cold I most likely have a "
39
+
40
+ input_ids = tokenizer.encode(prompt, return_tensors = 'pt')
41
+
42
+ output = model.generate(input_ids, max_length=50, num_return_sequences=1)
43
+
44
+ generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
45
+
46
+ print(generated_text)
47
  ```
48
 
49
  Uses: To use Artificial Intelligence technology to diagnose patient based off of multiple parameters ranging from their age to their