mhla commited on
Commit
9b54ac6
·
verified ·
1 Parent(s): d0821ec

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +89 -3
README.md CHANGED
@@ -1,3 +1,89 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - meta-llama/Llama-3.3-70B-Instruct
5
+ - unsloth/Meta-Llama-3.1-8B-Instruct
6
+ tags:
7
+ - biology
8
+ - chemistry
9
+ ---
10
+
11
+ # Pro-1-preview
12
+
13
+ Pro-1 is a reasoning model trained using GRPO towards a physics based reward function for protein stability.
14
+
15
+ It takes in a protein sequence + text description of the protein + effects of previous engineering attempts, reasons over the information given, and proposes modifications to improve the stability of the given sequence.
16
+
17
+
18
+ ## LORA checkpoints
19
+ | Model | Checkpoint |
20
+ |------------|-------------|
21
+ | 8b base GRPO | [best-checkpoint](https://huggingface.co/mhla/pro-1/tree/main/best-checkpoint) |
22
+ | 8b creative reward | [creativity-lm-grpo-mega-run-full](https://huggingface.co/mhla/pro-1/tree/main/creativity-lm-grpo-mega-run-full) |
23
+ | 8b creative + specificity reward (default) | [all-lm-grpo-mega-run](https://huggingface.co/mhla/pro-1/tree/main/all-lm-grpo-mega-run-full) |
24
+ | 70b SFT only | [llama_70b_4bit_sft_lora_model](https://huggingface.co/mhla/pro-1/tree/main/llama_70b_4bit_sft_lora_model) |
25
+
26
+
27
+ ## Example Usage
28
+
29
+ ```python
30
+ from unsloth import FastLanguageModel
31
+ from transformers import TextIteratorStreamer
32
+ import threading
33
+
34
+ def run_protein_engineering_example():
35
+ # Load the model and tokenizer
36
+ model, tokenizer = FastLanguageModel.from_pretrained(
37
+ model_name="unsloth/meta-Llama-3.1-8B-Instruct",
38
+ max_seq_length=32768,
39
+ load_in_4bit=True,
40
+ fast_inference=True,
41
+ max_lora_rank=32,
42
+ gpu_memory_utilization=0.6,
43
+ )
44
+
45
+ # Load the protein engineering adapter weights
46
+ model.load_adapter("your-username/protein-engineering-llama-3.1")
47
+ FastLanguageModel.for_inference(model)
48
+
49
+ protein_sequence = "MSHHWGYGKHNGPEHWHKDFPIAKGERQSPVDIDTHTAKYDPSLKPLSVSYDQATSLRILNNGHAFNVEFDDSQDKAVLKGGPLDGTY"
50
+
51
+ prompt = f"""
52
+
53
+ ...{STRUCTURED PROMPT SEE https://github.com/michaelhla/pro-1 FOR CORRECT USAGE}...
54
+
55
+ """
56
+
57
+ # Initialize the streamer for text generation
58
+ streamer = TextIteratorStreamer(tokenizer, skip_special_tokens=True)
59
+
60
+ # Set up generation parameters
61
+ generation_kwargs = dict(
62
+ input_ids=tokenizer(prompt, return_tensors="pt").input_ids.to(model.device),
63
+ streamer=streamer,
64
+ max_new_tokens=4096,
65
+ temperature=0.9,
66
+ top_p=0.95,
67
+ do_sample=True
68
+ )
69
+
70
+ # Create a thread to run the generation
71
+ thread = threading.Thread(target=model.generate, kwargs=generation_kwargs)
72
+ thread.start()
73
+
74
+ # Print the response as it streams
75
+ print("Model response (streaming):")
76
+ for new_text in streamer:
77
+ print(new_text, end="", flush=True)
78
+
79
+ thread.join() # Ensure generation is complete
80
+
81
+ if __name__ == "__main__":
82
+ run_protein_engineering_example()
83
+
84
+ ```
85
+
86
+
87
+ Note: While the model was specifically trained on enzymes, it should work for any protein sequence. Curious to hear if this is true!
88
+
89
+ Disclaimer: This is a preview version and as a result the model can be very dumb. Always double check sure your modified sequences have the correct mutations applied. Assume all references from the model are hallucinated.