Update README.md
Browse files
README.md
CHANGED
@@ -9,6 +9,8 @@ model = PeftModel.from_pretrained('lamm-mit/BioinspiredLLM')
|
|
9 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
10 |
```
|
11 |
|
|
|
|
|
12 |
Generate:
|
13 |
```
|
14 |
device='cuda'
|
@@ -38,3 +40,24 @@ def generate_response (text_input="Biological materials offer amazing",
|
|
38 |
)
|
39 |
return tokenizer.batch_decode(outputs[:,inputs.shape[1]:].detach().cpu().numpy(), skip_special_tokens=True)
|
40 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
10 |
```
|
11 |
|
12 |
+
Variants of the model are included, featuring various GGUF versions for use withm llama.cpp, for instance.
|
13 |
+
|
14 |
Generate:
|
15 |
```
|
16 |
device='cuda'
|
|
|
40 |
)
|
41 |
return tokenizer.batch_decode(outputs[:,inputs.shape[1]:].detach().cpu().numpy(), skip_special_tokens=True)
|
42 |
```
|
43 |
+
Generation example:
|
44 |
+
```
|
45 |
+
system_prompt = "You are BioinspiredLLM. You are knowledgeable in biological and bio-inspired materials and provide accurate and qualitative insights about biological materials found in Nature. You are a cautious assistant. You think step by step. You carefully follow instructions."
|
46 |
+
user_message = "What are hierarchical, biological materials?"
|
47 |
+
|
48 |
+
txt = f"<|im_start|>system\n{system_prompt}<|im_end|>\n<|im_start|>user\n{user_message}<|im_end|>\n<|im_start|>assistant"
|
49 |
+
|
50 |
+
# modulate temperature(0.1-1.0) to adjust 'creativity'
|
51 |
+
# modulate max_new_tokens to change length of generated response
|
52 |
+
output_text=generate_response ( text_input=txt,eos_token_id=2,
|
53 |
+
num_return_sequences=1,
|
54 |
+
repetition_penalty=1.1,
|
55 |
+
top_p=0.95,
|
56 |
+
top_k=50,
|
57 |
+
temperature=0.1,
|
58 |
+
max_new_tokens=512,
|
59 |
+
verbatim=False,
|
60 |
+
)
|
61 |
+
|
62 |
+
print(output_text)
|
63 |
+
```
|