Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

CASPAR Myelin guide, can't import FlowBuilder #186

Closed
jackxpeng opened this issue May 16, 2018 · 4 comments
Closed

CASPAR Myelin guide, can't import FlowBuilder #186

jackxpeng opened this issue May 16, 2018 · 4 comments

Comments

@jackxpeng
Copy link

jackxpeng commented May 16, 2018

I'm following the Myelin guide for CASPAR at https://github.com/google/sling/blob/caspar/doc/guide/myelin.md but can't import FlowBuilder.

I can do "from builder import Builder" instead. Should the doc be updated or am I doing something wrong? Thanks.

@ringgaard
Copy link
Contributor

Looks like we forgot we forgot to update the Myelin documentation when submitting #184 where we switched to the new version of the flow builder which is used by the pytorch-based trainer. Thanks for reporting this.

I have updated the documentation in #185 and also added an __init__.py file to the myelin package. The FlowBuilder class has been renamed to Builder so the Flow and Builder can now be imported from the sling.myelin package:

from sling.myelin import Flow
from sling.myelin import Builder

@jackxpeng
Copy link
Author

Somehow the imports don't work for me. Do you mean the python.myelin package? I tried that and got an error about PhraseTable.

sling$ python -c "from sling.myelin import Flow"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named myelin
sling$ python -c "from python.myelin import Flow"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "python/__init__.py", line 12, in <module>
    PhraseTable=api.PhraseTable
AttributeError: 'module' object has no attribute 'PhraseTable'

@ringgaard
Copy link
Contributor

ringgaard commented May 17, 2018

Could this be because you are missing the symbolic link described in the installation guide?

git checkout caspar
bazel build -c opt sling/pyapi:pysling.so
sudo ln -s $(realpath python) /usr/lib/python2.7/dist-packages/sling

Alternatively, you can just install the v2.0 (caspar) wheel:

sudo pip install http://www.jbox.dk/sling/sling-2.0.0-cp27-none-linux_x86_64.whl

@jackxpeng
Copy link
Author

You are right, Michael. I missed that step. Thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants