Xenova HF staff commited on
Commit
7bd5808
·
verified ·
1 Parent(s): 2b3854b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -1
README.md CHANGED
@@ -6,7 +6,35 @@ tags: []
6
  # Model Card for Model ID
7
 
8
  <!-- Provide a quick summary of what the model is/does. -->
9
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
 
12
  ## Model Details
 
6
  # Model Card for Model ID
7
 
8
  <!-- Provide a quick summary of what the model is/does. -->
9
+ ## Code to create
10
+ ```python
11
+ import torch
12
+ from transformers import VitPoseConfig, VitPoseForPoseEstimation, VitPoseBackboneConfig, AutoProcessor
13
+
14
+ model_id = "usyd-community/vitpose-plus-small"
15
+
16
+ # Initializing a VitPose configuration
17
+ configuration = VitPoseConfig.from_pretrained(
18
+ model_id,
19
+ backbone_config=VitPoseBackboneConfig(
20
+ hidden_size=16,
21
+ num_experts=2,
22
+ num_attention_heads=2,
23
+ part_features=10,
24
+ ),
25
+ )
26
+
27
+ # Initializing a model (with random weights) from the configuration
28
+ model = VitPoseForPoseEstimation(configuration)
29
+
30
+ torch.manual_seed(0) # Set for reproducibility
31
+ for name, param in model.named_parameters():
32
+ param.data = torch.randn_like(param)
33
+
34
+ # Accessing the model configuration
35
+ configuration = model.config
36
+ processor = AutoProcessor.from_pretrained(model_id)
37
+ ```
38
 
39
 
40
  ## Model Details