اذهب إلى المحتوى
  • 0

لماذا يوجد 3 ملفات بعد حفظ النموذج في تنسرفلو Tensorflow؟

عامر ابراهيم

السؤال

لدي الكود التالي:

# Create some variables.
v1 = tf.Variable(..., name="v1")
v2 = tf.Variable(..., name="v2")
...
# Add an op to initialize the variables.
init_op = tf.global_variables_initializer()
# Add ops to save and restore all the variables.
saver = tf.train.Saver()
# Later, launch the model, initialize the variables, do some work, save the
# variables to disk.
with tf.Session() as sess:
  sess.run(init_op)
  # Do some work with the model.
  ..
  # Save the variables to disk.
  save_path = saver.save(sess, "/tmp/model.ckpt")
  print("Model saved in file: %s" % save_path)

لكن بعد حفظه وجدت 3 ملفات:

model.ckpt.data-00000-of-00001
model.ckpt.index
model.ckpt.meta

ولا يمكنني استعادة النموذج عن طريق استعادة ملف model.ckpt ، حيث لا يوجد مثل هذا الملف. هذا هو الكود الخاص بي:

with tf.Session() as sess:
  # Restore variables from disk.
  saver.restore(sess, "/tmp/model.ckpt")

لذا لماذا توجد 3 ملفات؟

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 1

في الرابط التالي يوجد شرح لسبب وجود 3 ملفات (في الإصدارات المختلفة):

أما بالنسبة لاستعادة النموذج فيمكنك القيام بذلك كالتالي:

with tf.Session() as sess:
    saver = tf.train.import_meta_graph('/tmp/model.ckpt.meta')
    saver.restore(sess, "/tmp/model.ckpt")

بدلاً من ذلك ، يمكنك القيام بالتالي:

# أعد إنشاء نفس المتغيرات بالضبط
v1 = tf.Variable(..., name="v1")
v2 = tf.Variable(..., name="v2")
...

# checkpoint الآن قم بتحميل ال
with tf.Session() as sess:
    saver = tf.train.Saver()
    saver.restore(sess, "/tmp/model.ckpt")
رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...