Skip to content
Browse files

experiment - add distributed version of doMonophoneSystem (and add ne…

…w module experiment_runner_distribute to run it)

Ignore-this: b9b6a106949532cc7dc95ced1c6dadbb

darcs-hash:20121014185343-3a4db-1b3b7851d90a09e509f3e2fc18ace14abaa47fb8
  • Loading branch information...
1 parent 1cc4866 commit 3bbe976da3bebe9c3c0aca8c10a20eb5c46fbd60 @MattShannon committed
Showing with 104 additions and 0 deletions.
  1. +2 −0 boring.darcs
  2. +47 −0 expt_hts_demo/experiment.py
  3. +55 −0 expt_hts_demo/experiment_runner_distribute.py
View
2 boring.darcs
@@ -7,5 +7,7 @@
^expt_hts_demo/[^/]*\.log$
+^expt_hts_demo/repo($|/)
+
\.pyc$
View
47 expt_hts_demo/experiment.py
@@ -23,6 +23,8 @@
from armspeech.util.util import getElem, ElemGetter, AttrGetter
from armspeech.util import persist
from armspeech.util.timing import timed, printTime
+from armspeech.bisque import distribute
+from armspeech.bisque.distribute import liftLocal, lift
from codedep import codeDeps
import phoneset_cmu
@@ -239,6 +241,10 @@ def createBlcBasedLf0Acc(lf0Depth, lgTag = None):
)
@codeDeps()
+def getCorpusAccumulate(corpus):
+ return corpus.accumulate
+
+@codeDeps()
def tupleMap1(((label, subLabel), acInput)):
return subLabel, (label, acInput)
@@ -533,6 +539,47 @@ def doMonophoneSystem(synthOutDir, figOutDir):
return results1, results2, results4
@codeDeps()
+def getMonoString():
+ return 'mono'
+
+@codeDeps()
+def getMono2MixString():
+ return 'mono.2mix'
+
+@codeDeps()
+def getMono4MixString():
+ return 'mono.4mix'
+
+@codeDeps(AttrGetter, evaluateVarious, getBmiForCorpus, getCorpusWithSubLabels,
+ getMono2MixString, getMono4MixString, getMonoString, lift, liftLocal, mixup,
+ trainMonophoneDist
+)
+def doMonophoneSystemJobSet(synthOutDirArt, figOutDirArt):
+ corpusArt = liftLocal(getCorpusWithSubLabels)()
+ bmiArt = liftLocal(getBmiForCorpus)(corpusArt)
+ accumulateArt = liftLocal(getCorpusAccumulate)(corpusArt)
+
+ distArt = lift(trainMonophoneDist)(bmiArt, corpusArt)
+ results1Art = lift(evaluateVarious)(
+ distArt, bmiArt, corpusArt, synthOutDirArt, figOutDirArt,
+ exptTag = liftLocal(getMonoString)()
+ )
+
+ distArt = lift(mixup)(distArt, accumulateArt)
+ results2Art = lift(evaluateVarious)(
+ distArt, bmiArt, corpusArt, synthOutDirArt, figOutDirArt,
+ exptTag = liftLocal(getMono2MixString)()
+ )
+
+ distArt = lift(mixup)(distArt, accumulateArt)
+ results4Art = lift(evaluateVarious)(
+ distArt, bmiArt, corpusArt, synthOutDirArt, figOutDirArt,
+ exptTag = liftLocal(getMono4MixString)()
+ )
+
+ return results1Art, results2Art, results4Art
+
+@codeDeps()
def convertTimingInfo(input):
(phone, subLabel, extra), acousticContext = input
return subLabel, (phone, (extra, acousticContext))
View
55 expt_hts_demo/experiment_runner_distribute.py
@@ -0,0 +1,55 @@
+#!/usr/bin/python -u
+
+"""Command-line tool to run example experiments on a grid or similar."""
+
+# Copyright 2011, 2012 Matt Shannon
+
+# This file is part of armspeech.
+# See `License` for details of license and warranty.
+
+
+from __future__ import division
+
+from expt_hts_demo import experiment
+from armspeech.bisque import distribute
+import armspeech.bisque.queuer as qr
+from armspeech.bisque import sge_queuer
+
+import os
+import sys
+import time
+
+def main(rawArgs):
+ buildRepo = qr.BuildRepo(base = os.path.join('expt_hts_demo', 'repo'))
+
+ #queuer = qr.LocalQueuer(buildRepo = buildRepo)
+ queuer = sge_queuer.MockSgeQueuer(buildRepo = buildRepo)
+
+ outDir = os.path.join('expt_hts_demo', 'out.d')
+ synthOutDir = os.path.join(outDir, 'synth')
+ figOutDir = os.path.join(outDir, 'fig')
+ if not os.path.exists(synthOutDir):
+ raise RuntimeError('dir %s should already exist' % synthOutDir)
+ if not os.path.exists(figOutDir):
+ raise RuntimeError('dir %s should already exist' % figOutDir)
+ synthOutDirArt = distribute.FixedDirArtifact(synthOutDir)
+ figOutDirArt = distribute.FixedDirArtifact(figOutDir)
+
+ finalArtifacts = experiment.doMonophoneSystemJobSet(synthOutDirArt,
+ figOutDirArt)
+
+ live = queuer.generateArtifacts(finalArtifacts, verbosity = 1)
+
+ finalLiveJobs = [ live[job.secHash()] for art in finalArtifacts
+ for job in art.parents()
+ if job.secHash() in live ]
+
+ while not all([ liveJob.hasEnded() for liveJob in finalLiveJobs ]):
+ time.sleep(0.1)
+
+ print 'final values:'
+ for art in finalArtifacts:
+ print '\tart (%s) -> %s' % (art.secHash(), art.loadValue(buildRepo))
+
+if __name__ == '__main__':
+ main(sys.argv)

0 comments on commit 3bbe976

Please sign in to comment.
Something went wrong with that request. Please try again.