GithubHelp home page GithubHelp logo

Comments (8)

ongiaf avatar ongiaf commented on June 3, 2024

The full onnx model can be download from here:

  1. https://get.ecmwf.int/repository/test-data/ai-models/fuxi/short.onnx
  2. ONNX External Data: https://get.ecmwf.int/repository/test-data/ai-models/fuxi/short

from onnx2torch.

dsuhoi avatar dsuhoi commented on June 3, 2024

@ongiaf Do you have any success decoding FuXi (I've been fine-tuning this model for a long time)? I recommend paying attention to this solution

from onnx2torch.

ongiaf avatar ongiaf commented on June 3, 2024

Thanks, it's excellent work.
And with some dirty work, Fuxi can successfully run on PyTorch with Onnx2Torch. In Onnx2Torch, problems are mainly about LayerNormalization and Clip.

from onnx2torch.

dsuhoi avatar dsuhoi commented on June 3, 2024

@ongiaf Did you manage to run FuXi with the current weights for the fine-tuning process (I am currently thinking about how to complete the work on the model on a 1-hour grid and thought about freezing some layers except the U-transformer.) ?

from onnx2torch.

juanqiu1 avatar juanqiu1 commented on June 3, 2024

Thanks, it's excellent work. And with some dirty work, Fuxi can successfully run on PyTorch with Onnx2Torch. In Onnx2Torch, problems are mainly about LayerNormalization and Clip.

Thank you for posting your changes about Clip. Could you also suggest how to fix LayerNormalization? Looks like the converted model has issue with torch.layer_norm call.

from onnx2torch.

dsuhoi avatar dsuhoi commented on June 3, 2024

@juanqiu1 In order for this to work with FuXi, you will need to change the onnx2torch/node_converters/layer_norm.py parameter to [1536]:

@add_converter(operation_type='LayerNormalization', version=17)
def _(node: OnnxNode, graph: OnnxGraph) -> OperationConverterResult:
    node_attributes = node.attributes

    axis = node_attributes.get('axis', AXIS_DEFAULT_VALUE)
    epsilon = node_attributes.get('epsilon', EPSILON_DEFAULT_VALUE)

    if all(value_name in graph.initializers for value_name in node.input_values[1:]):
        input_value_info = graph.value_info[node.input_values[0]]
        input_shape = get_shape_from_value_info(input_value_info)
        torch_module = nn.LayerNorm(
            normalized_shape=(1536), # input_shape[axis:], (this block!)
            eps=epsilon,
            elementwise_affine=True,
        )

from onnx2torch.

juanqiu1 avatar juanqiu1 commented on June 3, 2024

@dsuhoi Thank you for hinting, there are a couple of other easy fixes (typing, etc).
Did you manage to run FuXi with the current weights for the fine-tuning process
Do you have any progress on that? After conversion, I loaded model into pytorch but even on A100 with FSDP enabled via accelerate. I still get CUDA out-of-memory error.

from onnx2torch.

dsuhoi avatar dsuhoi commented on June 3, 2024

@juanqiu1 Yes, I managed to start the learning process by highlighting the named_parameters() part within the last dozen UTransformer (this was enough for fine-tunning).

I used Nvidia A100 (40GB).

from onnx2torch.

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.