Beispiel #1
0
 def magic_connect_info(self, arg_s):
     """Print information for connecting other clients to this kernel
     
     It will print the contents of this session's connection file, as well as
     shortcuts for local clients.
     
     In the simplest case, when called from the most recently launched kernel,
     secondary clients can be connected, simply with:
     
     $> ipython <app> --existing
     
     """
     try:
         connection_file = get_connection_file()
         info = get_connection_info(unpack=False)
     except Exception as e:
         error("Could not get connection info: %r" % e)
         return
         
     print (info + '\n')
     print ("Paste the above JSON into a file, and connect with:\n"
         "    $> ipython <app> --existing <file>\n"
         "or, if you are local, you can connect with just:\n"
         "    $> ipython <app> --existing %s\n"
         "or even just:\n"
         "    $> ipython <app> --existing\n"
         "if this is the most recent IPython session you have started."
         % os.path.basename(connection_file)
     )
Beispiel #2
0
 def kernel_and_frontend_match(self, connection_file):
     # Determine kernel version
     ci = get_connection_info(connection_file, unpack=True,
                              profile='default')
     if u('control_port') in ci:
         kernel_ver = '>=1.0'
     else:
         kernel_ver = '<1.0'
     # is_module_installed checks if frontend version agrees with the
     # kernel one
     return programs.is_module_installed('IPython', version=kernel_ver)
Beispiel #3
0
 def kernel_and_frontend_match(self, connection_file):
     # Determine kernel version
     ci = get_connection_info(connection_file,
                              unpack=True,
                              profile='default')
     if u('control_port') in ci:
         kernel_ver = '>=1.0'
     else:
         kernel_ver = '<1.0'
     # is_module_installed checks if frontend version agrees with the
     # kernel one
     return programs.is_module_installed('IPython', version=kernel_ver)
Beispiel #4
0
 def magic_connect_info(self, arg_s):
     """Print information for connecting other clients to this kernel
     
     It will print the contents of this session's connection file, as well as
     shortcuts for local clients.
     
     In the simplest case, when called from the most recently launched kernel,
     secondary clients can be connected, simply with:
     
     $> ipython <app> --existing
     
     """
     
     from IPython.core.application import BaseIPythonApplication as BaseIPApp
     
     if BaseIPApp.initialized():
         app = BaseIPApp.instance()
         security_dir = app.profile_dir.security_dir
         profile = app.profile
     else:
         profile = 'default'
         security_dir = ''
     
     try:
         connection_file = get_connection_file()
         info = get_connection_info(unpack=False)
     except Exception as e:
         error("Could not get connection info: %r" % e)
         return
     
     # add profile flag for non-default profile
     profile_flag = "--profile %s" % profile if profile != 'default' else ""
     
     # if it's in the security dir, truncate to basename
     if security_dir == os.path.dirname(connection_file):
         connection_file = os.path.basename(connection_file)
     
     
     print (info + '\n')
     print ("Paste the above JSON into a file, and connect with:\n"
         "    $> ipython <app> --existing <file>\n"
         "or, if you are local, you can connect with just:\n"
         "    $> ipython <app> --existing {0} {1}\n"
         "or even just:\n"
         "    $> ipython <app> --existing {1}\n"
         "if this is the most recent IPython session you have started.".format(
         connection_file, profile_flag
         )
     )
Beispiel #5
0
 def magic_connect_info(self, arg_s):
     """Print information for connecting other clients to this kernel
     
     It will print the contents of this session's connection file, as well as
     shortcuts for local clients.
     
     In the simplest case, when called from the most recently launched kernel,
     secondary clients can be connected, simply with:
     
     $> ipython <app> --existing
     
     """
     
     from IPython.core.application import BaseIPythonApplication as BaseIPApp
     
     if BaseIPApp.initialized():
         app = BaseIPApp.instance()
         security_dir = app.profile_dir.security_dir
         profile = app.profile
     else:
         profile = 'default'
         security_dir = ''
     
     try:
         connection_file = get_connection_file()
         info = get_connection_info(unpack=False)
     except Exception as e:
         error("Could not get connection info: %r" % e)
         return
     
     # add profile flag for non-default profile
     profile_flag = "--profile %s" % profile if profile != 'default' else ""
     
     # if it's in the security dir, truncate to basename
     if security_dir == os.path.dirname(connection_file):
         connection_file = os.path.basename(connection_file)
     
     
     print (info + '\n')
     print ("Paste the above JSON into a file, and connect with:\n"
         "    $> ipython <app> --existing <file>\n"
         "or, if you are local, you can connect with just:\n"
         "    $> ipython <app> --existing {0} {1}\n"
         "or even just:\n"
         "    $> ipython <app> --existing {1}\n"
         "if this is the most recent IPython session you have started.".format(
         connection_file, profile_flag
         )
     )
Beispiel #6
0
    epochs=5, shuffle = True, verbose = 1, validation_data = validation_generator)

with tf.device("/device:GPU:0"):
    history_vanilla = inception_transfer_vanilla.fit_generator(
    train_generator,
    epochs=5, shuffle = True, verbose = 1, validation_data = validation_generator)

import matplotlib.pyplot as plt
# summarize history for accuracy
plt.plot(history_pretrained.history['val_acc'])
plt.plot(history_vanilla.history['val_acc'])
plt.title('model accuracy')
plt.ylabel('accuracy')
plt.xlabel('epoch')
plt.legend(['Pretrained', 'Vanilla'], loc='upper left')
plt.show()
# summarize history for loss
plt.plot(history_pretrained.history['val_loss'])
plt.plot(history_vanilla.history['val_loss'])
plt.title('model loss')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['Pretrained', 'Vanilla'], loc='upper left')
plt.show()

from IPython.lib import kernel
print(dir(kernel))
print(kernel.get_connection_info())
print(kernel.get_connection_file())