Skip to content

[Bug]: Llama3.1 casting torch.bfloat16 to torch.float16 #7561

Closed
@jgreer013

Description

Your current environment

Running on distributed environment using apptainer version of vllm openai container v0.5.4

🐛 Describe the bug

I've downloaded Llama 3.1 8B Instruct from Huggingface and am attempting to host using Ray and vLLM.

Examining the snapshot's config.json, I can confirm that the underlying torch_dtype is bfloat16.

{
  "architectures": [
    "LlamaForCausalLM"
  ],
  "attention_bias": false,
  "attention_dropout": 0.0,
  "bos_token_id": 128000,
  "eos_token_id": [
    128001,
    128008,
    128009
  ],
  "hidden_act": "silu",
  "hidden_size": 8192,
  "initializer_range": 0.02,
  "intermediate_size": 28672,
  "max_position_embeddings": 131072,
  "mlp_bias": false,
  "model_type": "llama",
  "num_attention_heads": 64,
  "num_hidden_layers": 80,
  "num_key_value_heads": 8,
  "pretraining_tp": 1,
  "rms_norm_eps": 1e-05,
  "rope_scaling": {
    "factor": 8.0,
    "low_freq_factor": 1.0,
    "high_freq_factor": 4.0,
    "original_max_position_embeddings": 8192,
    "rope_type": "llama3"
  },
  "rope_theta": 500000.0,
  "tie_word_embeddings": false,
  "torch_dtype": "bfloat16",
  "transformers_version": "4.42.3",
  "use_cache": true,
  "vocab_size": 128256
}

In addition, I'm passing --dtype=bfloat16 to vllm serve.

vllm serve "/root/.cache/huggingface/hub/models--${SNAPSHOT_DIR}/snapshots/$SNAPSHOT" \
        --tensor-parallel-size=4 \
        --pipeline-parallel-size=1 \
        --distributed-executor-backend=ray \
        --dtype=bfloat16

However, for some reason, I'm seeing this log line:
WARNING 08-15 16:32:35 config.py:1454] Casting torch.bfloat16 to torch.float16.

It appears to be from this line I think?

logger.warning("Casting %s to %s.", config_dtype, torch_dtype)

Not sure what's happening here, but I want to ensure we're not unnecessarily casting (running this on A100 40GBs which are correctly recognized and used so it's not a GPU compatibility issue).

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions