Skip to content

AttributeError: module 'os' has no attribute 'setsid' #4819

@Coderx7

Description

@Coderx7

Under windows,trying to run the example : Auto-tuning a convolutional network for x86 CPU this error occurs.
the error occurs in the last cell :

def tune_and_evaluate(tuning_opt):
    # extract workloads from relay program
    print("Extract tasks...")
    mod, params, data_shape, out_shape = get_network(model_name, batch_size)
    tasks = autotvm.task.extract_from_program(mod["main"], target=target,
                                              params=params, ops=(relay.op.nn.conv2d,))

    # run tuning tasks
    print("Tuning...")
    tune_kernels(tasks, **tuning_opt)
    tune_graph(mod["main"], data_shape, log_file, graph_opt_sch_file)

    # compile kernels with graph-level best records
    with autotvm.apply_graph_best(graph_opt_sch_file):
        print("Compile...")
        with relay.build_config(opt_level=3):
            graph, lib, params = relay.build_module.build(
                mod, target=target, params=params)

        # upload parameters to device
        ctx = tvm.cpu()
        data_tvm = tvm.nd.array((np.random.uniform(size=data_shape)).astype(dtype))
        module = runtime.create(graph, lib, ctx)
        module.set_input(input_name, data_tvm)
        module.set_input(**params)

        # evaluate
        print("Evaluate inference time cost...")
        ftimer = module.module.time_evaluator("run", ctx, number=100, repeat=3)
        prof_res = np.array(ftimer().results) * 1000  # convert to millisecond
        print("Mean inference time (std dev): %.2f ms (%.2f ms)" %
              (np.mean(prof_res), np.std(prof_res)))

# We do not run the tuning in our webpage server since it takes too long.
# Uncomment the following line to run it by yourself.

# tune_and_evaluate(tuning_option)

Error :

Extract tasks...
ANTLR runtime and generated code versions disagree: 4.8!=4.7.2
ANTLR runtime and generated code versions disagree: 4.8!=4.7.2
Tuning...
[Task  1/12]  Current/Best:    0.00/   0.00 GFLOPS | Progress: (0/252) | 0.00 sTraceback (most recent call last):

  File "d:\Codes\tvm_testbed\tune_relay_x86.py", line 225, in <module>
    tune_and_evaluate(tuning_option)

  File "d:\Codes\tvm_testbed\tune_relay_x86.py", line 198, in tune_and_evaluate
    tune_kernels(tasks, **tuning_opt)

  File "d:\Codes\tvm_testbed\tune_relay_x86.py", line 170, in tune_kernels
    autotvm.callback.log_to_file(log_filename)])

  File "C:\Users\User\Anaconda3\lib\site-packages\tvm-0.7.dev0-py3.7-win-amd64.egg\tvm\autotvm\tuner\tuner.py", line 108, in tune
    measure_batch = create_measure_batch(self.task, measure_option)

  File "C:\Users\User\Anaconda3\lib\site-packages\tvm-0.7.dev0-py3.7-win-amd64.egg\tvm\autotvm\measure\measure.py", line 252, in create_measure_batch
    attach_objects = runner.set_task(task)

  File "C:\Users\User\Anaconda3\lib\site-packages\tvm-0.7.dev0-py3.7-win-amd64.egg\tvm\autotvm\measure\measure_methods.py", line 337, in set_task
    tracker_addr=(tracker.host, tracker.port))

  File "C:\Users\User\Anaconda3\lib\site-packages\tvm-0.7.dev0-py3.7-win-amd64.egg\tvm\rpc\server.py", line 369, in __init__
    self.proc = subprocess.Popen(cmd, preexec_fn=os.setsid)

AttributeError: module 'os' has no attribute 'setsid'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions