ludwig 关于CPU的推理

jw5wzhpr  于 2个月前  发布在  其他
关注(0)|答案(3)|浏览(24)

docs开始,Ludwig为推理生成了一个REST API。默认情况下,这发生在GPU上。然而,是否有任何选项仅使用CPU进行推理?

sczxawaw

sczxawaw1#

更新

在slack上有人指出,最好也提供配置文件:

model_type: llm
# base_model: meta-llama/Llama-2-7b-hf
base_model: meta-llama/Llama-2-13b-hf

model_parameters:
  trust_remote_code: true

backend:
  type: local
  cache_dir: ./ludwig_cache

input_features:
  - name: input
    type: text
    preprocessing:
      max_sequence_length: 326

output_features:
  - name: output
    type: text
    preprocessing:
      max_sequence_length: 64

prompt:
  template: >-
    ### User: {input}

    ### Assistant:

generation:
  temperature: 0.1
  max_new_tokens: 32
  repetition_penalty: 1.0
  # remove_invalid_values: true

adapter:
  type: lora
  dropout: 0.05
  r: 8

quantization:
  bits: 4

preprocessing:
  global_max_sequence_length: 326
  split:
    type: fixed

trainer:
  type: finetune
  epochs: 9
  batch_size: 1
  eval_batch_size: 2
  gradient_accumulation_steps: 16
  learning_rate: 0.0004
  learning_rate_scheduler:
    warmup_fraction: 0.03

文档中显示的serving命令如下: ludwig serve --model_path ./results/experiment_run/model
默认情况下,此命令将在我的GPU设备上提供模型。我的问题很简单,就是如何在CPU上独家提供这个服务。

kmb7vmvb

kmb7vmvb2#

你正在得到什么输出/错误信息?谢谢。

b09cbbtk

b09cbbtk3#

感谢回复。我没有遇到任何错误,只是想知道如何在CPU设备上运行它。所以这只是一个问题。我在Ludwig的相关文档中没有找到这方面的信息。

相关问题