Update README.md
Browse files
README.md
CHANGED
@@ -3,15 +3,14 @@ library_name: transformers
|
|
3 |
tags: []
|
4 |
---
|
5 |
|
6 |
-
Inference
|
7 |
|
8 |
```
|
9 |
-
model_name='lamm-mit/
|
10 |
-
|
11 |
model = AutoModelForCausalLM.from_pretrained(
|
12 |
model_name,
|
13 |
trust_remote_code=True,
|
14 |
-
#load_in_8bit=True,
|
15 |
device_map="auto",
|
16 |
torch_dtype =torch.bfloat16,
|
17 |
attn_implementation="flash_attention_2"
|
@@ -21,7 +20,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
21 |
|
22 |
```
|
23 |
|
24 |
-
Function to interact with the model
|
25 |
|
26 |
```
|
27 |
|
@@ -66,7 +65,7 @@ def generate_response (text_input="Biology offers amazing",system_prompt='You ar
|
|
66 |
|
67 |
return tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True), messages
|
68 |
```
|
69 |
-
|
70 |
```
|
71 |
res,_= generate_response (text_input = "What is collagen?", system_prompt = 'You are a materials scientist. ',
|
72 |
num_return_sequences=1,
|
|
|
3 |
tags: []
|
4 |
---
|
5 |
|
6 |
+
## Inference example
|
7 |
|
8 |
```
|
9 |
+
model_name='lamm-mit/BioinspiredLlama-3-1-8B-128k'
|
10 |
+
|
11 |
model = AutoModelForCausalLM.from_pretrained(
|
12 |
model_name,
|
13 |
trust_remote_code=True,
|
|
|
14 |
device_map="auto",
|
15 |
torch_dtype =torch.bfloat16,
|
16 |
attn_implementation="flash_attention_2"
|
|
|
20 |
|
21 |
```
|
22 |
|
23 |
+
#### Function to interact with the model
|
24 |
|
25 |
```
|
26 |
|
|
|
65 |
|
66 |
return tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True), messages
|
67 |
```
|
68 |
+
Usage:
|
69 |
```
|
70 |
res,_= generate_response (text_input = "What is collagen?", system_prompt = 'You are a materials scientist. ',
|
71 |
num_return_sequences=1,
|