zihaojing commited on
Commit
5574517
·
verified ·
1 Parent(s): d98cf4b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +38 -13
README.md CHANGED
@@ -18,25 +18,50 @@ The official code repository is available at: https://github.com/selmiss/MuMo
18
 
19
  - **Model Type**: MuMo Pretrained Model
20
  - **Training Data**: Molecular structures and properties
21
- - **Framework**: PyTorch + Transformers
22
 
23
  ## Usage
24
 
 
 
 
 
 
 
 
 
25
  ```python
26
- from transformers import AutoConfig, AutoTokenizer, AutoModel
27
-
28
- # Load model
29
- model_path = "zihaojing/mumo-pretrain"
30
- config = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
31
- tokenizer = AutoTokenizer.from_pretrained(model_path)
32
- model = AutoModel.from_pretrained(model_path, trust_remote_code=True)
33
-
34
- # Example usage
35
- smiles = "CCO" # Ethanol
36
- inputs = tokenizer(smiles, return_tensors="pt")
37
- outputs = model(**inputs)
 
 
 
 
 
 
 
 
 
 
 
38
  ```
39
 
 
 
 
 
 
 
40
  ## Training Details
41
 
42
  - Training script: See the [official GitHub repository](https://github.com/selmiss/MuMo) for details.
 
18
 
19
  - **Model Type**: MuMo Pretrained Model
20
  - **Training Data**: Molecular structures and properties
21
+ - **Framework**: PyTorch + Transformers + Mamba-ssm
22
 
23
  ## Usage
24
 
25
+ ### Loading the Model
26
+
27
+ MuMo uses a custom loading function. Here's how to load the pretrained model:
28
+
29
+ ```shell
30
+ git clone https://github.com/selmiss/MuMo.git
31
+ ```
32
+
33
  ```python
34
+ from transformers import AutoConfig, AutoTokenizer
35
+ from model.load_model import load_model
36
+ from dataclasses import dataclass
37
+
38
+ # Load configuration and tokenizer
39
+ repo = "zihaojing/MuMo-Pretrained"
40
+ config = AutoConfig.from_pretrained(repo, trust_remote_code=True)
41
+ tokenizer = AutoTokenizer.from_pretrained(repo)
42
+
43
+ # Set up model arguments
44
+ @dataclass
45
+ class ModelArgs:
46
+ model_name_or_path: str = repo
47
+ model_class: str = "MuMoFinetune" # or "MuMoPretrain" for pretraining
48
+ cache_dir: str = None
49
+ model_revision: str = "main"
50
+ use_auth_token: bool = False
51
+ task_type: str = None # e.g., "classification" or "regression" for finetuning
52
+
53
+ model_args = ModelArgs()
54
+
55
+ # Load the model
56
+ model = load_model(config, tokenizer=tokenizer, model_args=model_args)
57
  ```
58
 
59
+ **Notes:**
60
+ - Use `model_class="MuMoPretrain"` for pretraining or inference
61
+ - Use `model_class="MuMoFinetune"` for finetuning tasks
62
+ - Set `task_type` to `"classification"` or `"regression"` when using `MuMoFinetune`
63
+ - The model supports loading from both Hugging Face Hub (e.g., `"zihaojing/MuMo-Pretrained"`) and local paths (e.g., `"/path/to/model"`)
64
+
65
  ## Training Details
66
 
67
  - Training script: See the [official GitHub repository](https://github.com/selmiss/MuMo) for details.