Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,28 +16,19 @@ FOOD_EXAMPLES = "./demo/food_for_demo.json"
|
|
16 |
MODEL_PATH = "./InternVL_Food/lr35_ep10"
|
17 |
OUTPUT_PATH = "./outputs"
|
18 |
|
19 |
-
|
20 |
seed = 42
|
21 |
|
22 |
random.seed(seed)
|
23 |
np.random.seed(seed)
|
24 |
torch.manual_seed(seed)
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
torch.backends.cudnn.deterministic = True
|
29 |
|
30 |
|
31 |
def main():
|
32 |
setup_seeds()
|
33 |
-
|
34 |
-
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
35 |
-
print(f"Using device: {device}")
|
36 |
-
|
37 |
-
# Load the ConversationalAgent with device specified as 'cpu'
|
38 |
-
agent = ConversationalAgent(model_path=MODEL_PATH,
|
39 |
-
outputs_dir=OUTPUT_PATH,
|
40 |
-
device=device) # Add device argument here
|
41 |
# logging
|
42 |
init_logger(OUTPUT_PATH)
|
43 |
# food examples
|
|
|
16 |
MODEL_PATH = "./InternVL_Food/lr35_ep10"
|
17 |
OUTPUT_PATH = "./outputs"
|
18 |
|
19 |
+
ef setup_seeds():
|
20 |
seed = 42
|
21 |
|
22 |
random.seed(seed)
|
23 |
np.random.seed(seed)
|
24 |
torch.manual_seed(seed)
|
25 |
|
26 |
+
cudnn.benchmark = False
|
27 |
+
cudnn.deterministic = True
|
|
|
28 |
|
29 |
|
30 |
def main():
|
31 |
setup_seeds()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
# logging
|
33 |
init_logger(OUTPUT_PATH)
|
34 |
# food examples
|