Nikitapyscript commited on
Commit
0d64705
·
verified ·
1 Parent(s): 49437da

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +6 -2
README.md CHANGED
@@ -25,10 +25,14 @@ pipeline_tag: image-segmentation
25
  ## Использование
26
 
27
  ```python
 
28
  import torch
29
  from monai.networks.nets import UNet
30
  from huggingface_hub import hf_hub_download
31
 
 
 
 
32
  # Загрузка модели
33
  model = UNet(
34
  spatial_dims=3,
@@ -40,9 +44,9 @@ model = UNet(
40
  dropout=0.2
41
  )
42
 
43
- # Загрузка весов
44
  model_path = hf_hub_download(repo_id="Nikitapyscript/MRISegment_model", filename="best_metric_model.pth")
45
- model.load_state_dict(torch.load(model_path, map_location='cpu'))
46
  model.eval()
47
  ```
48
 
 
25
  ## Использование
26
 
27
  ```python
28
+ import os
29
  import torch
30
  from monai.networks.nets import UNet
31
  from huggingface_hub import hf_hub_download
32
 
33
+ # Отключение предупреждения о symlinks на Windows
34
+ os.environ['HF_HUB_DISABLE_SYMLINKS_WARNING'] = '1'
35
+
36
  # Загрузка модели
37
  model = UNet(
38
  spatial_dims=3,
 
44
  dropout=0.2
45
  )
46
 
47
+ # Загрузка весов безопасно (исправляет FutureWarning)
48
  model_path = hf_hub_download(repo_id="Nikitapyscript/MRISegment_model", filename="best_metric_model.pth")
49
+ model.load_state_dict(torch.load(model_path, map_location='cpu', weights_only=True))
50
  model.eval()
51
  ```
52