Skip to content

Continuous Training / Model tuning / Initialize with pre-trained Model #166

@mhmgad

Description

@mhmgad

I want to continue/resume training a pre-trained model using new triples. We may assume that there are no new entities or relations but new instants.

What is the best way to load the pre-trained model?

Or is it possible to implement something like? where continue_training=True is a flag to skip initialization?

import numpy as np
from ampligraph.latent_features import ComplEx

model = ComplEx(batches_count=1, seed=555, epochs=20, k=10)
X = np.array([['a', 'y', 'b'],
              ['b', 'y', 'a'],
              ['a', 'y', 'c'],
              ['c', 'y', 'a'],
              ['a', 'y', 'd'],
              ['c', 'y', 'd'],
              ['b', 'y', 'c'],
              ['f', 'y', 'e']])
model.fit(X)
print(model.get_embeddings(['f','e'], embedding_type='entity'))

X2 = np.array([['a', 'y', 'b'],
              ['c', 'y', 'd'],
              ['b', 'y', 'c'],
              ['f', 'y', 'm'],
              ['f', 'y', 'n'],
              ['f', 'y', 'a'],
              ['f', 'y', 'c'],
               ['f', 'z', 'c']])
model.fit(X2, continue_training=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions