dgarrett-synaptics commited on
Commit
315f47f
·
verified ·
1 Parent(s): ddbc12e

Delete model_compiler.py

Browse files
Files changed (1) hide show
  1. model_compiler.py +0 -61
model_compiler.py DELETED
@@ -1,61 +0,0 @@
1
- import spaces
2
- #import sys
3
- import os
4
- import subprocess
5
- #from datasets import load_dataset
6
- #from huggingface_hub import snapshot_download
7
-
8
- class model_compiler:
9
-
10
- def __init__(self):
11
-
12
- success, result = self.run_cmd('vela --version')
13
- print(f'Run vela --version, found {success}:{result}')
14
-
15
- @spaces.GPU
16
- def dummy(self):
17
- return False
18
-
19
- def run_cmd(self, cmd):
20
-
21
- cmd_list = cmd.split(' ')
22
-
23
- try:
24
- result = subprocess.run(cmd_list, capture_output=True, text=True, check=True)
25
- except Exception as e:
26
- print(f'ERROR in command {e}')
27
- return False, 'ERROR'
28
- #print(f'run_cmd({cmd})')
29
- #print(result)
30
-
31
- return True, result.stdout.strip()
32
-
33
- # Setup the backend processing
34
- ## self.temp_dir = tempfile.TemporaryDirectory()
35
- # print(f'Creating {self.temp_dir.name}')
36
-
37
- def compile_model(self):
38
-
39
- # list files in dataset
40
- # files = os.listdir()
41
- # print('local_files before:')
42
- # for file in files:
43
- # print(f' {file}')
44
-
45
- # print('CWD:', os.getcwd())
46
- #cmd = 'python3 -m "import os"'
47
-
48
- # success, result = self.run_cmd('which python')
49
- #result = subprocess.run(cmd, capture_output=True, text=True, check=True)
50
- success, result = self.run_cmd('/usr/local/bin/python infer_code_gen.py -t ./hello_world.tflite')
51
- print(result)
52
-
53
- files = os.listdir()
54
- print('local_files after:')
55
- for file in files:
56
- print(f' {file}')
57
-
58
- return "Successfully compiled model"
59
-
60
-
61
-