Browse Source

Fix multi-node big-bench with tensorflow

Sengxian 2 years ago
parent
commit
1cd0c10f22
2 changed files with 6 additions and 1 deletions
  1. 5 0
      evaluate_bigbench.py
  2. 1 1
      evaluation/bigbench.py

+ 5 - 0
evaluate_bigbench.py

@@ -18,6 +18,11 @@ import json
 import torch
 import importlib
 import dataclasses
+import tensorflow as tf
+
+gpus = tf.config.list_physical_devices("GPU")
+local_rank = int(os.environ["LOCAL_RANK"]) % 8
+tf.config.set_visible_devices(gpus[local_rank], "GPU")
 
 from typing import *
 

+ 1 - 1
evaluation/bigbench.py

@@ -27,7 +27,7 @@ class ModelForBigBench(Model):
 
         config = GenerationTaskConfig(
             name="big-bench",
-            type=TaskType.MULTICHOICE,
+            type=TaskType.GENERATION,
             max_gen_length=max_length or 128,
             path="",
             micro_batch_size=micro_batch_size,