Skip to content

Conversation

@yhliang2018
Copy link
Contributor

make /official as a Python module to unify import of utils

@robieta
Copy link
Contributor

robieta commented Mar 10, 2018

Fundamentally I think the fact that this is a branch off of logging utils rather than master is going to cause awful merge conflict issues down the line. Basically you have a "delete utils" commit after the canonical util creation commit. I put together some git to forcibly update the branch to a single commit in a branch from master. I'm sure that that a proper git wizard could do better (if a git wizard wants to chime in, feel free), but I think this will suffice for not confusing git down the line.

git checkout master
git pull --rebase

# make sure the branch is up to date save for our changes
git checkout feat/official-module
git pull --rebase origin master

# this branch is not intended to be pushed.
git checkout master  # (Forgot this the first time.)
git branch package_local
git checkout package_local

# pull the files of interest into our dummy branch
git checkout feat/official-module -- official/
git commit -m "Alter imports to act like a package."

# make sure things look good.
git log
git diff master package_local

# this should fail
git push --dry-run --set-upstream origin feat/official-module

# this should succeed.
git push --dry-run --set-upstream origin package_local

# When you're ready, actually pull the trigger.
git push -f --set-upstream origin feat/official-module

Copy link
Contributor

@karmel karmel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks-- a few minor changes from my end, though it looks like py3 tests are failing whereas py2 is not? Any clues what is happening there?


Run the models.

The *Official Models* is made as a Python module. To run the models directly, you must change your work directory to the top-level ***/models*** folder (the parent directory of ***/official***), and set the Python path by issuing the following command: ``` export PYTHONPATH="$PYTHONPATH:$(pwd)" ```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it's true that this will work, I think it's a little atypical to request that people actually cd in first. I think it might be preferable to instruct people that they have to add the top-level models folder to their python path, and illustrate like so:

export PYTHONPATH="$PYTHONPATH:/path/to/models"

Also, nit: in Github markdown, you should be able to use one backtick ( ` ) instead of three ( ``` ) for in-line code snippets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comments, Karmel!

For py3 test, I have submitted a CL to set up the python path, like what we did for py2. It should pass py3 tests once the CL is approved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robieta Thank you for the detailed comments! Karmel also mentioned the same issue to me. Will update the branch as a single commit.

@qlzh727
Copy link
Member

qlzh727 commented Mar 12, 2018

What I feel confused is that when I look at all file changed, it only shows the file from commit be8c1ba. Did u change/modify to some branch that overwrites your previous change?

Copy link
Contributor

@karmel karmel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor text changes, but other than that, LGTM.

Run the models.

The *Official Models* is made as a Python module. To run the models directly, you need to add the top-level ***/models*** folder to the python path by command: ` export PYTHONPATH="$PYTHONPATH:/path/to/models" `

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more nits that I started to type out, then realized it was easier just to show the end result:

## Running the models

The *Official Models* are made available as a Python module. To run the models and associated scripts, add the top-level ***/models*** folder to the Python path with the command: `export PYTHONPATH="$PYTHONPATH:/path/to/models"`

To make Official Models easier to use, we are planning to create a pip installable Official Models package. This is being tracked in [#917](https://github.com/tensorflow/models/issues/917).

Copy link
Contributor

@robieta robieta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all seems quite reasonable.

@yhliang2018 yhliang2018 merged commit 6e3e5c3 into master Mar 12, 2018
@yhliang2018 yhliang2018 deleted the feat/official-module branch March 12, 2018 21:05
@guxiaopihai
Copy link

运行mnist.py 出错,报The first layer in a Sequential model must get an input_shape argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants