wufan commited on
Commit
ec0123f
1 Parent(s): 7221ed4

Upload 4 files

Browse files
Files changed (4) hide show
  1. app.py +8 -7
  2. cfg_base.yaml +3 -3
  3. cfg_small.yaml +3 -3
  4. cfg_tiny.yaml +3 -3
app.py CHANGED
@@ -13,14 +13,15 @@ from huggingface_hub import snapshot_download
13
  tiny_model_dir = snapshot_download('wanderkid/unimernet_tiny')
14
  small_model_dir = snapshot_download('wanderkid/unimernet_small')
15
  base_model_dir = snapshot_download('wanderkid/unimernet_base')
16
- print("download done!")
17
- print(tiny_model_dir)
18
 
19
- root_path = os.path.abspath(os.getcwd())
20
- os.makedirs(os.path.join(root_path, "models"), exist_ok=True)
21
- shutil.move(tiny_model_dir, os.path.join(root_path, "models", "unimernet_tiny"))
22
- shutil.move(small_model_dir, os.path.join(root_path, "models", "unimernet_small"))
23
- shutil.move(base_model_dir, os.path.join(root_path, "models", "unimernet_base"))
 
 
 
24
  # == download weights ==
25
 
26
  sys.path.insert(0, os.path.join(os.getcwd(), ".."))
 
13
  tiny_model_dir = snapshot_download('wanderkid/unimernet_tiny')
14
  small_model_dir = snapshot_download('wanderkid/unimernet_small')
15
  base_model_dir = snapshot_download('wanderkid/unimernet_base')
 
 
16
 
17
+ os.system(f"sed -i 's/MODEL_DIR/{tiny_model_dir}/g' cfg_tiny.yaml")
18
+ os.system(f"sed -i 's/MODEL_DIR/{small_model_dir}/g' cfg_small.yaml")
19
+ os.system(f"sed -i 's/MODEL_DIR/{base_model_dir}/g' cfg_base.yaml")
20
+ # root_path = os.path.abspath(os.getcwd())
21
+ # os.makedirs(os.path.join(root_path, "models"), exist_ok=True)
22
+ # shutil.move(tiny_model_dir, os.path.join(root_path, "models", "unimernet_tiny"))
23
+ # shutil.move(small_model_dir, os.path.join(root_path, "models", "unimernet_small"))
24
+ # shutil.move(base_model_dir, os.path.join(root_path, "models", "unimernet_base"))
25
  # == download weights ==
26
 
27
  sys.path.insert(0, os.path.join(os.getcwd(), ".."))
cfg_base.yaml CHANGED
@@ -2,13 +2,13 @@ model:
2
  arch: unimernet
3
  model_type: unimernet
4
  model_config:
5
- model_name: ./models/unimernet_base
6
  max_seq_len: 1536
7
 
8
  load_pretrained: True
9
- pretrained: './models/unimernet_base/unimernet_base.pth'
10
  tokenizer_config:
11
- path: ./models/unimernet_base
12
 
13
  datasets:
14
  formula_rec_eval:
 
2
  arch: unimernet
3
  model_type: unimernet
4
  model_config:
5
+ model_name: MODEL_DIR
6
  max_seq_len: 1536
7
 
8
  load_pretrained: True
9
+ pretrained: 'MODEL_DIR/unimernet_base.pth'
10
  tokenizer_config:
11
+ path: MODEL_DIR
12
 
13
  datasets:
14
  formula_rec_eval:
cfg_small.yaml CHANGED
@@ -2,13 +2,13 @@ model:
2
  arch: unimernet
3
  model_type: unimernet
4
  model_config:
5
- model_name: ./models/unimernet_small
6
  max_seq_len: 1536
7
 
8
  load_pretrained: True
9
- pretrained: './models/unimernet_small/unimernet_small.pth'
10
  tokenizer_config:
11
- path: ./models/unimernet_small
12
 
13
  datasets:
14
  formula_rec_eval:
 
2
  arch: unimernet
3
  model_type: unimernet
4
  model_config:
5
+ model_name: MODEL_DIR
6
  max_seq_len: 1536
7
 
8
  load_pretrained: True
9
+ pretrained: 'MODEL_DIR/unimernet_small.pth'
10
  tokenizer_config:
11
+ path: MODEL_DIR
12
 
13
  datasets:
14
  formula_rec_eval:
cfg_tiny.yaml CHANGED
@@ -2,13 +2,13 @@ model:
2
  arch: unimernet
3
  model_type: unimernet
4
  model_config:
5
- model_name: ./models/unimernet_tiny
6
  max_seq_len: 1536
7
 
8
  load_pretrained: True
9
- pretrained: './models/unimernet_tiny/unimernet_tiny.pth'
10
  tokenizer_config:
11
- path: ./models/unimernet_tiny
12
 
13
  datasets:
14
  formula_rec_eval:
 
2
  arch: unimernet
3
  model_type: unimernet
4
  model_config:
5
+ model_name: MODEL_DIR
6
  max_seq_len: 1536
7
 
8
  load_pretrained: True
9
+ pretrained: 'MODEL_DIR/unimernet_tiny.pth'
10
  tokenizer_config:
11
+ path: MODEL_DIR
12
 
13
  datasets:
14
  formula_rec_eval: