Skip to content

πŸ—ΊοΈ Roadmap: Hugging Face Ecosystem Full Compatibility (transformers / accelerate / peft / trl)Β #204

Description

@lvyufeng

Goal

Make candle a drop-in PyTorch replacement for the entire HuggingFace ecosystem. Target:

USE_CANDLE=1 python -c "
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained('gpt2')
model = AutoModelForCausalLM.from_pretrained('gpt2')
print(tokenizer.decode(model.generate(tokenizer('Hello', return_tensors='pt').input_ids, max_new_tokens=20)[0]))
"

Priority follows the HF dependency chain: transformers (core) β†’ accelerate β†’ peft β†’ trl.


Current State

Capability Status Notes
nn.Module (state_dict, load_state_dict, hooks) βœ… Ready Full implementation
nn modules (Linear, Conv, Norm, RNN, Attention, etc.) βœ… Ready Comprehensive coverage
Optimizers & LR Schedulers βœ… Ready Adam, AdamW, SGD, etc. with state_dict
AMP (autocast + GradScaler) βœ… Ready Device-type dispatch
Serialization (save/load) βœ… Ready PyTorch zip checkpoint format
scaled_dot_product_attention ⚠️ Naive composite No Flash/fused attention
DataLoader + Samplers βœ… Ready Multi-worker, pin_memory
Distributed (DDP, FSDP, collectives) βœ… Ready Gloo + HCCL backends
torch.utils.checkpoint βœ… Exists Needs HF integration validation
torch.library / custom_op βœ… Ready 2-arg Library ctor only
compat/transformers test framework βœ… Ready Tier 1-3 model test runner
Meta device / to_empty() ❌ Missing Blocks low_cpu_mem_usage loading
Native safetensors loading ❌ In compat layer only Not in src/candle/
Text generation (GenerationMixin) ❌ Missing No generate(), KV-cache, sampling
torch.compile / _dynamo ⚠️ No-op stub Blocks compiled model paths
Quantization (GPTQ/AWQ/bitsandbytes) ❌ Stub only quantize_per_tensor raises RuntimeError
PEFT (LoRA adapter injection) ❌ Untested Module internals may work
Accelerate integration ❌ Untested Low-level pieces exist

Sub-Issues

Phase 1: Foundation (Target: v0.1.1 β€” June 2026)

Phase 2: HF-Compatible Inference (Target: v0.2.0 β€” September 2026)

Phase 3: Training & Fine-Tuning (Target: v0.3.0 β€” December 2026)


Cross-Roadmap Duplicates

Capability HF vLLM Megatron Notes
Meta device #223 #237 β€” Resolving one closes both
Library() 3-arg #226 #235 β€” Resolving one closes both
_dynamo / compiler stubs #225 #239 β€” Partial overlap; coordinate work
Activation checkpointing #229 β€” #258 HF = basic paths; Megatron adds selective recompute + RNG

Success Criteria

  • v0.1.1: from transformers import AutoModel; model = AutoModel.from_pretrained("bert-base-uncased") works without compat conftest
  • v0.2.0: model.generate() works for GPT-2/LLaMA-class models; tier-1 compat test pass rate β‰₯ 80%
  • v0.3.0: Fine-tuning with accelerate + PEFT LoRA works end-to-end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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