저는 현재 직장에서 개발중인 깊은 학습 응용 프로그램에 Tensorflow를 사용하고 있습니다. 응용 프로그램에 대한 구체적인 내용은 알 수 없지만 코드는 사용자 지정된 Word2Vec과 비슷하지만 각 단어 벡터 표현에 대한 비용은 개별적으로 계산해야합니다. :이 방법Tensorflow 그래프가 너무 커졌습니다.
def cost_function(word_vector, other_word_vectors):
# cost for a single training example needs to be computed
# separately, and it depends on the vector representations
# of some other words, depending on the training instance
return tf.nn.tanh(some_mathematical_computation)
문제는 그래프의 크기가 compute_gradients
작업이 많은 시간을 소요, 너무 많이 날려 경향이 있다는 것입니다. 뿐만 아니라, compute_gradients
에 걸리는 시간은 그래프 크기에 따라 선형 적으로 증가합니다. tf.stop_gradients
어떤 이유로 든 도움이되지 않습니다. 도움이되는 것은 소수의 모든 교육 인스턴스에 대해 새로운 tf.Graph
과 새로운 tf.Session()
을 초기화하는 것입니다 (이를 미니 배치라고 함). 병렬로 여러 개의 계산을 수행하고 (미니 배치 컬렉션이라고 함) 결과를 결합하고 저장합니다. 다음 미니 배치 수집을위한 것입니다.
def learning(mini_batch):
with tf.Graph().as_default() as g:
with tf.Session() as sess:
self.perform_learning_on_batch(mini_batch, sess)
return resultant_model
def collection_learn(mini_batch_collection):
models = run_learning_in_parallel()
return combine_model(models)
def master():
initial_model = something
for mini_batch_collection in dataset:
new_model = collection_learn(mini_batch_collection)
이러한 응용 프로그램에 대해 병렬 학습을 수행하는 더 좋은 방법이 있습니까?
감사의 말 ... 나는 강우의 간단한 구현을 사용하여 종료했습니다. tensorflow로 주변을 둘러 볼 수 없었습니다. 동적 그래프 프레임 워크 (예 : 파이 토치)가 도움이 될 것이라는 아이디어는 있습니까? –
상승 추세 강하는 분산 및 병렬 학습을 위해 기본적으로 텐서 흐름 모델이 사용하는 것입니다. –