Git Product home page Git Product logo

Comments (10)

kshama-msft avatar kshama-msft commented on July 18, 2024 1

Thank you for reaching out with your question. Can you please specify an urgency and the scenario where you are using ORT for training. It will also be helpful if you can provide the list of ops that your scenario needs. Missing gradient support for certain ops is a known gap and the gradient builder will be implemented on a per-demand basis. If we understand your urgency, it will help us prioritize this work for implementation.

from onnxruntime.

kshama-msft avatar kshama-msft commented on July 18, 2024 1

Thank you for your response. Can you try exporting your model through torch.onnx.export and use that model as your starting point for training artifact generation? This exported model should have all ONNX ops and should temporarily unblock you as we work on gradient builder for the missing ops.

from onnxruntime.

Positronx avatar Positronx commented on July 18, 2024

Hi @kshama-msft,
Scenario : I want to finetune a quantized ONNX-genai model using ORTTraining so I'll need the gradient implementation of some specific nodes.

Urgency : as soon as possible

Here are the list of nodes that need a gradient implementation :
op_type : GroupQueryAttention, module : com.microsoft v1
op_type : SkipSimplifiedLayerNormalization, module : com.microsoft v1
op_type : SkipLayerNormalization, module : com.microsoft v1
op_type : MatMulNBits, module : com.microsoft v1 (I assume only 4 bit quantization is supported as of today)
op_type : MultiHeadAttention, module : com.microsoft v1 (If it isn't deprecated and replaced by GroupQueryAttention)

from onnxruntime.

skottmckay avatar skottmckay commented on July 18, 2024

IIUC, typically a model would be trained at full precision (32-bit float values) and quantized after for more efficient inferencing. Why do you want/need to train the quantized model, and is there some evidence that doing so would be effective.

from onnxruntime.

Positronx avatar Positronx commented on July 18, 2024

Hi @skottmckay,
That's true for small models, but it's practically impossible to train large models on a single GPU using half presion (16-bit float values), let alone full precision since there isn't enough RAM to load all the model weights.
Edit : I don't recall that ONNXRuntime implemented a hybrid execution (CPU+GPU), because this will make it possible to train larger models.

from onnxruntime.

skottmckay avatar skottmckay commented on July 18, 2024

AFAICS none of the training ops support quantized data types, so adding gradient implementations for the contrib ops would not be enough.

e.g.

REGISTER_GRADIENT_KERNEL_TYPED(float, float, float)
REGISTER_GRADIENT_KERNEL_TYPED(double, double, double)
REGISTER_GRADIENT_KERNEL_TYPED(MLFloat16, float, MLFloat16)
REGISTER_GRADIENT_KERNEL_TYPED(float, float, MLFloat16)
REGISTER_GRADIENT_KERNEL_TYPED(MLFloat16, float, float)
REGISTER_GRADIENT_KERNEL_TYPED(BFloat16, float, BFloat16)

We're currently looking at making phi-3 work with the on-device training infrastructure so that just the last layer/s of the model could be trained with a much smaller memory requirement. But that would be with fp32 data using CPU.

from onnxruntime.

jingyanwangms avatar jingyanwangms commented on July 18, 2024

@Positronx can you try instructions here to use ORTModule. https://github.com/microsoft/onnxruntime/blob/main/docs/ORTModule_Training_Guidelines.md
You just need to wrap the model with ORTModule.
I think at least GroupQueryAttention is not implemented in training. Make sure you use one of the supported types: float32/float16/bf16.

from onnxruntime.

Positronx avatar Positronx commented on July 18, 2024

@skottmckay, I see. Why wouldn't it possible to train phi-3 with fp16 using GPU?

from onnxruntime.

skottmckay avatar skottmckay commented on July 18, 2024

fp16 is fine if you have GPU.

if you're shipping a product to general users you can't assume there's a GPU though (and even if there is there are different libraries required for CUDA vs AMD vs integrated) - which is why we're looking at CPU based usage.

from onnxruntime.

github-actions avatar github-actions commented on July 18, 2024

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

from onnxruntime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.