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

Error during training using docker #1971

Closed
emailweixu opened this issue May 3, 2017 · 3 comments
Closed

Error during training using docker #1971

emailweixu opened this issue May 3, 2017 · 3 comments
Assignees

Comments

@emailweixu
Copy link
Collaborator

emailweixu commented May 3, 2017

The docker image I used is paddlepaddle/paddle:0.10.0rc3-gpu
The code is:

cost = make_model()
parameters = paddle.parameters.create(cost)
optimizer = paddle.optimizer.Momentum(momentum=0)
trainer = paddle.trainer.SGD(cost=cost,
                             parameters=parameters,
                             update_equation=optimizer)
if __name__ == "main":
    paddle.init(use_gpu=False, trainer_count=1)
    trainer.train(
        reader=paddle.batch(
            paddle.reader.shuffle(
                uci_housing.train(), buf_size=500),
            batch_size=2),
        feeding=feeding,
        event_handler=event_handler,
        num_passes=30)

I got the following error:

F0502 23:48:59.986923 117 ClassRegistrar.h:65] Check failed: mapGet(type, creatorMap_, &creator) Unknown class type: poly
*** Check failure stack trace: ***
Aborted (core dumped)

@liuyuuan
Copy link
Contributor

liuyuuan commented May 4, 2017

I encountered the same error under the swig_paddle api, the reason was that I built the model before calling paddle.init(), so please try to call paddle.init() first, before calling make_model() and parameters.create().

@typhoonzero
Copy link
Contributor

@comeonfox is correct. I the code in PaddlePaddle/book is:

import paddle.v2 as paddle
import paddle.v2.dataset.uci_housing as uci_housing


def main():
    # init
    paddle.init(use_gpu=False, trainer_count=1)

    # network config
    x = paddle.layer.data(name='x', type=paddle.data_type.dense_vector(13))
    y_predict = paddle.layer.fc(input=x, size=1, act=paddle.activation.Linear())
    y = paddle.layer.data(name='y', type=paddle.data_type.dense_vector(1))
    cost = paddle.layer.mse_cost(input=y_predict, label=y)

    # create parameters
    parameters = paddle.parameters.create(cost)

    # create optimizer
    optimizer = paddle.optimizer.Momentum(momentum=0)

    trainer = paddle.trainer.SGD(
        cost=cost, parameters=parameters, update_equation=optimizer)

    feeding = {'x': 0, 'y': 1}

    # event_handler to print training and testing info
    def event_handler(event):
        if isinstance(event, paddle.event.EndIteration):
            if event.batch_id % 100 == 0:
                print "Pass %d, Batch %d, Cost %f" % (
                    event.pass_id, event.batch_id, event.cost)

        if isinstance(event, paddle.event.EndPass):
            result = trainer.test(
                reader=paddle.batch(uci_housing.test(), batch_size=2),
                feeding=feeding)
            print "Test %d, Cost %f" % (event.pass_id, result.cost)

    # training
    trainer.train(
        reader=paddle.batch(
            paddle.reader.shuffle(uci_housing.train(), buf_size=500),
            batch_size=2),
        feeding=feeding,
        event_handler=event_handler,
        num_passes=30)


if __name__ == '__main__':
    main()

@emailweixu
Copy link
Collaborator Author

We should give a better error message for this kind of error. Otherwise it's very hard for user to figure out.

heavengate pushed a commit to heavengate/Paddle that referenced this issue Aug 16, 2021
Old: PaddleDection
New: PaddleDetection
Although the title of the original article is wrong.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants