GithubHelp home page GithubHelp logo

mivg / sled Goto Github PK

View Code? Open in Web Editor NEW
63.0 63.0 9.0 51 KB

The official repository for Efficient Long-Text Understanding Using Short-Text Models (Ivgi et al., 2022) paper

License: MIT License

Python 100.00%

sled's People

Contributors

mivg avatar mivg1 avatar urialon avatar urisha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sled's Issues

Does SLED work with BERT models

The instructions for using SLED are a bit confusing, it's not clear on how one should use SLED when working with non BART models.

How to use SLED with custom base models that are not on huggingface?

Hi,

Thanks for releasing the code for SLED.

The README suggests editing the config appropriately to use SLED with other base models from hugging face. However, this only works with hugging face models. Is there a way to interface SLED with other models that are not on hugging face?
A description of how to go about that and what code changes (in SLED and in the base model) might be needed would be really helpful.

Thanks!

'MockTensorForConditionalGeneration' object has no attribute 'device'

from sled import SledTokenizer, SledForConditionalGeneration
model = SledForConditionalGeneration.from_pretrained('tau/bart-large-sled')
tokenizer = SledTokenizer.from_pretrained('tau/bart-large-sled')
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
model = model.to(0)
inputs = {k: v.to(0) for k, v in inputs.items()}
model(**inputs)

The above code produces the following error.

Relevant versions and using python 3.10

torch==1.13.1+cu116
torchaudio==0.13.1+cu116
torchmetrics==0.11.3
torchvision==0.14.1+cu11
transformers==4.26.1
py-sled==0.1.7

Traceback (most recent call last):
File "", line 1, in
File "/home/ga2530/miniconda3/envs/bhc/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "", line 2, in _forward
File "/home/ga2530/miniconda3/envs/bhc/lib/python3.10/site-packages/sled/modeling_sled.py", line 756, in _forward
forward_kwargs["encoder_outputs"] = self._run_sliding_window_forward(
File "/home/ga2530/miniconda3/envs/bhc/lib/python3.10/site-packages/sled/modeling_sled.py", line 476, in _run_sliding_window_forward
return self._run_sliding_window_forward_stacked(args_tensor_inds, kwargs_tensor_keys, s, *args,
File "/home/ga2530/miniconda3/envs/bhc/lib/python3.10/site-packages/sled/modeling_sled.py", line 562, in _run_sliding_window_forward_stacked
encoder_outputs2 = self._underlying_model.forward(
File "/home/ga2530/miniconda3/envs/bhc/lib/python3.10/site-packages/transformers/models/bart/modeling_bart.py", line 1393, in forward
lm_logits = lm_logits + self.final_logits_bias.to(lm_logits.device)
AttributeError: 'MockTensorForConditionalGeneration' object has no attribute 'device'

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.