Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get package from local instead of URL #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions argfile_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

def run(runner, argfile):
flags = subprocess.check_output(['python', argfile])
for flag in flags.split('\n'):
for flag in flags.decode('utf-8').split('\n'):
subprocess.call(['python', runner, flag])


def main(unused_argv):
fire.Fire(run)

if __name__ == '__main__':
main()
main(0)
8 changes: 4 additions & 4 deletions foundations/save_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def save_network(filename, weights_dict):
tf.gfile.MakeDirs(filename)

for k, v in weights_dict.items():
with tf.gfile.FastGFile(os.path.join(filename, k + '.npy'), 'w') as fp:
with tf.gfile.GFile(os.path.join(filename, k + '.npy'), 'wb') as fp:
np.save(fp, v)


Expand Down Expand Up @@ -82,7 +82,7 @@ def restore_network(filename):

for basename in tf.gfile.ListDirectory(filename):
name = basename.split('.')[0]
with tf.gfile.FastGFile(os.path.join(filename, basename)) as fp:
with tf.gfile.GFile(os.path.join(filename, basename), 'rb') as fp:
weights_dict[name] = np.load(fp)

return weights_dict
Expand Down Expand Up @@ -150,7 +150,7 @@ def read_log(directory, name='test', tail=0):
'accuracy': [],
}

with tf.gfile.GFile(paths.log(directory, name)) as fp:
with tf.gfile.GFile(paths.log(directory, name), 'r') as fp:
reader = csv.reader(fp)
for row in reader:
output['iteration'].append(float(row[1]))
Expand All @@ -177,7 +177,7 @@ def write_log(data, directory, name='test'):
to be stored.
name: What to call the data file itself.
"""
with tf.gfile.GFile(paths.log(directory, name), 'w') as fp:
with tf.gfile.GFile(paths.log(directory, name), 'wb') as fp:
for loss, it, acc in zip(data['loss'], data['iteration'], data['accuracy']):
fp.write(','.join(
('iteration',
Expand Down
2 changes: 1 addition & 1 deletion mnist_fc/download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def main(unused_argv):
fire.Fire(download)

if __name__ == '__main__':
main()
main(0)
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@
]

VERSION = '1'
URL = 'https://github.com/brain-research/lottery-ticket'

setup(
name='lottery-ticket',
name='lottery_ticket',
version=VERSION,
description=SHORT_DESCRIPTION,
url=URL,

author='Jonathan Frankle',
author_email='[email protected]',
Expand Down Expand Up @@ -65,7 +63,11 @@

keywords='lottery ticket hypothesis',

packages=['lottery-ticket'],
packages=['lottery_ticket', 'lottery_ticket.foundations', 'lottery_ticket.datasets', 'lottery_ticket.mnist_fc'],
package_dir={'lottery_ticket': '.',
'lottery_ticket.foundations': './foundations',
'lottery_ticket.datasets': './datasets',
'lottery_ticket.mnist_fc': './mnist_fc'},

install_requires=DEPENDENCIES,
)