Giter VIP home page Giter VIP logo

Comments (4)

jfrery avatar jfrery commented on July 29, 2024

Hi @dopc,

Could you share the error you are getting?

Some parts from the transformer architecture might be missing (e.g. softmax). They will be supported soon.

For now you can check the use case available on LLMs. It's using GPT2: https://github.com/zama-ai/concrete-ml/tree/main/use_case_examples/llm.

from concrete-ml.

dopc avatar dopc commented on July 29, 2024

Hey @jfrery, thanks for your quick reply.

Good to see GPT2 model works! I will look at it.

Here is my error trace:

  File "/opt/conda/lib/python3.10/site-packages/concrete/ml/torch/compile.py", line 303, in compile_torch_model
    return _compile_torch_or_onnx_model(
  File "/opt/conda/lib/python3.10/site-packages/concrete/ml/torch/compile.py", line 195, in _compile_torch_or_onnx_model
    quantized_module = build_quantized_module(
  File "/opt/conda/lib/python3.10/site-packages/concrete/ml/torch/compile.py", line 117, in build_quantized_module
    numpy_model = NumpyModule(model, dummy_input_for_tracing)
  File "/opt/conda/lib/python3.10/site-packages/concrete/ml/torch/numpy_module.py", line 45, in __init__
    self.numpy_forward, self._onnx_model = get_equivalent_numpy_forward_from_torch(
  File "/opt/conda/lib/python3.10/site-packages/concrete/ml/onnx/convert.py", line 145, in get_equivalent_numpy_forward_from_torch
    torch.onnx.export(
  File "/opt/conda/lib/python3.10/site-packages/torch/onnx/utils.py", line 504, in export
    _export(
  File "/opt/conda/lib/python3.10/site-packages/torch/onnx/utils.py", line 1529, in _export
    graph, params_dict, torch_out = _model_to_graph(
  File "/opt/conda/lib/python3.10/site-packages/torch/onnx/utils.py", line 1111, in _model_to_graph
    graph, params, torch_out, module = _create_jit_graph(model, args)
  File "/opt/conda/lib/python3.10/site-packages/torch/onnx/utils.py", line 987, in _create_jit_graph
    graph, torch_out = _trace_and_get_graph_from_model(model, args)
  File "/opt/conda/lib/python3.10/site-packages/torch/onnx/utils.py", line 891, in _trace_and_get_graph_from_model
    trace_graph, torch_out, inputs_states = torch.jit._get_trace_graph(
  File "/opt/conda/lib/python3.10/site-packages/torch/jit/_trace.py", line 1184, in _get_trace_graph
    outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torch/jit/_trace.py", line 127, in forward
    graph, out = torch._C._create_graph_by_tracing(
  File "/opt/conda/lib/python3.10/site-packages/torch/jit/_trace.py", line 118, in wrapper
    outs.append(self.inner(*trace_inputs))
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1182, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/transformers/models/distilbert/modeling_distilbert.py", line 1225, in forward
    outputs = self.distilbert(
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1182, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/transformers/models/distilbert/modeling_distilbert.py", line 806, in forward
    embeddings = self.embeddings(input_ids, inputs_embeds)  # (bs, seq_length, dim)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1182, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/transformers/models/distilbert/modeling_distilbert.py", line 129, in forward
    input_embeds = self.word_embeddings(input_ids)  # (bs, max_seq_length, dim)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1182, in _slow_forward
    result = self.forward(*input, **kwargs)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/sparse.py", line 160, in forward
    return F.embedding(
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/functional.py", line 2210, in embedding
    return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected tensor for argument #1 'indices' to have one of the following scalar types: Long, Int; but got torch.FloatTensor instead (while checking arguments for embedding)

from concrete-ml.

jfrery avatar jfrery commented on July 29, 2024

Hey my bad I missed your answer. Concrete ML doesn't support embedding layer. We will support that very soon.

If you don't mind, we can convert your issue to a Feature request to make sure we have the embedding supported asap.

from concrete-ml.

dopc avatar dopc commented on July 29, 2024

Thanks for the answer and for converting the issue to a feature request.
Looking forward to the support.

from concrete-ml.

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.