A method and apparatus for training a text-
graph model, a device, and a storage medium, relating to the
artificial intelligence. The method comprises: on the basis of a
training set of graph-text sample pairs, performing iterative training on a model to be trained, to obtain a text-
graph model; in a training process: selecting a graph-text sample pair from the
training set of graph-text sample pairs, the graph-text sample pair comprising a
sample image and a description text, and the
sample image comprising at least two objects; obtaining
mask images corresponding to the at least two objects and associated
object class names, the
mask images being used for distinguishing position regions of the objects in the
sample image; inputting the sample image and the description text to a model to be trained, to obtain an
image prediction noise of the sample image, and inputting at least two
mask images and the associated
object class names to the model to be trained to obtain object prediction noises respectively associated with the at least two mask images; and constructing a
loss function on the basis of the
image prediction noise and the object prediction noises, and by using the
loss function, adjusting a parameter for the model to be trained.