WebashalarForML commited on
Commit
bacf856
1 Parent(s): cd947b9

Upload 4 files

Browse files
Files changed (3) hide show
  1. backup/model.py +6 -6
  2. backup/save_load.py +1 -1
  3. backup/train.py +3 -3
backup/model.py CHANGED
@@ -5,11 +5,11 @@ import re
5
  from typing import Dict, Optional, Union
6
  import torch
7
  import torch.nn.functional as F
8
- from .modules.layers import LstmSeq2SeqEncoder
9
- from .modules.base import InstructBase
10
- from .modules.evaluator import Evaluator, greedy_search
11
- from .modules.span_rep import SpanRepLayer
12
- from .modules.token_rep import TokenRepLayer
13
  from torch import nn
14
  from torch.nn.utils.rnn import pad_sequence
15
  from huggingface_hub import PyTorchModelHubMixin, hf_hub_download
@@ -320,7 +320,7 @@ class GLiNER(InstructBase, PyTorchModelHubMixin):
320
  return model
321
 
322
  # 2. Newer format: Use "pytorch_model.bin" and "gliner_config.json"
323
- from .train import load_config_as_namespace
324
 
325
  model_file = Path(model_id) / "pytorch_model.bin"
326
  if not model_file.exists():
 
5
  from typing import Dict, Optional, Union
6
  import torch
7
  import torch.nn.functional as F
8
+ from modules.layers import LstmSeq2SeqEncoder
9
+ from modules.base import InstructBase
10
+ from modules.evaluator import Evaluator, greedy_search
11
+ from modules.span_rep import SpanRepLayer
12
+ from modules.token_rep import TokenRepLayer
13
  from torch import nn
14
  from torch.nn.utils.rnn import pad_sequence
15
  from huggingface_hub import PyTorchModelHubMixin, hf_hub_download
 
320
  return model
321
 
322
  # 2. Newer format: Use "pytorch_model.bin" and "gliner_config.json"
323
+ from train import load_config_as_namespace
324
 
325
  model_file = Path(model_id) / "pytorch_model.bin"
326
  if not model_file.exists():
backup/save_load.py CHANGED
@@ -1,5 +1,5 @@
1
  import torch
2
- from .model import GLiNER
3
 
4
 
5
  def save_model(current_model, path):
 
1
  import torch
2
+ from model import GLiNER
3
 
4
 
5
  def save_model(current_model, path):
backup/train.py CHANGED
@@ -7,9 +7,9 @@ from tqdm import tqdm
7
  from transformers import get_cosine_schedule_with_warmup
8
 
9
  # from model_nested import NerFilteredSemiCRF
10
- from .model import GLiNER
11
- from .modules.run_evaluation import get_for_all_path, sample_train_data
12
- from .save_load import save_model, load_model
13
  import json
14
 
15
 
 
7
  from transformers import get_cosine_schedule_with_warmup
8
 
9
  # from model_nested import NerFilteredSemiCRF
10
+ from model import GLiNER
11
+ from modules.run_evaluation import get_for_all_path, sample_train_data
12
+ from save_load import save_model, load_model
13
  import json
14
 
15