yuanxiaosc / Entity-Relation-Extraction

Entity and Relation Extraction Based on TensorFlow and BERT. 基于TensorFlow和BERT的管道式实体及关系抽取,2019语言与智能技术竞赛信息抽取任务解决方案。Schema based Knowledge Extraction, SKE 2019
https://yuanxiaosc.github.io/2019/05/17/多关系抽取研究/
1.22k stars 271 forks source link

在特定gpu上运行程序 #42

Closed liuxz-cs closed 4 years ago

liuxz-cs commented 4 years ago

你好,我在运行过程中按照ReadMe中的命令运行时,程序会默认检测当前空闲gpu并且全部占满gpu,我想请问一下如果我想只在某一块gpu或者某几块gpu上运行的话,有什么办法吗

yuanxiaosc commented 4 years ago

通过设置Python环境中可见的GPU数量即可 tensorflow下设置使用某一块GPU(从0开始编号):

import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "1"