Coder Social home page Coder Social logo

liyuanlucasliu / ld-net Goto Github PK

View Code? Open in Web Editor NEW
146.0 10.0 13.0 613 KB

Efficient Contextualized Representation: Language Model Pruning for Sequence Labeling

Home Page: https://arxiv.org/abs/1804.07827

License: Apache License 2.0

Python 98.70% Shell 1.30%
ner language-model sequence-labeling named-entity-recognition contextualized-representation model-compression pytorch

ld-net's People

Contributors

guotong1988 avatar liyuanlucasliu 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  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  avatar  avatar  avatar  avatar  avatar  avatar

ld-net's Issues

FileNotFoundError: [Errno 2] No such file or directory: '/root/.ts_cache/b91f996d8ec980e293ffd169408e9f99b9728f4024744405bef1f2f04ecaedd5/download.cached'

code:
`!pip install lightner

from lightner import decoder_wrapper

model = decoder_wrapper("http://dmserv4.cs.illinois.edu/pner0.th", configs)

model = decoder_wrapper()
model.decode(["Ronaldo", "won", "'t", "score", "more", "than", "30", "goals", "for", "Juve", "."])`

[2023-09-09 22:40:28,224] Loading model from http://dmserv4.cs.illinois.edu/pner0.th (might download from source if not cached).
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (7) Failed to connect to dmserv4.cs.illinois.edu port 80: Connection refused

FileNotFoundError Traceback (most recent call last)
Cell In [6], line 5
3 from lightner import decoder_wrapper
4 # model = decoder_wrapper("http://dmserv4.cs.illinois.edu/pner0.th", configs)
----> 5 model = decoder_wrapper()
6 model.decode(["Ronaldo", "won", "'t", "score", "more", "than", "30", "goals", "for", "Juve", "."])

File /usr/local/lib/python3.9/dist-packages/lightner/commands/decoder.py:174, in decoder_wrapper(model_file_path, configs)
171 pw = wrapper(configs.get("log_path", None))
173 logger.info("Loading model from {} (might download from source if not cached).".format(model_file_path))
--> 174 model_file = wrapper.restore_checkpoint(model_file_path)
176 model_type = model_file['config'].get("model_type", 'char-lstm-crf')
177 logger.info('Preparing the pre-trained {} model.'.format(model_type))

File /usr/local/lib/python3.9/dist-packages/torch_scope/wrapper.py:161, in basic_wrapper.restore_checkpoint(file_path)
146 @staticmethod
147 def restore_checkpoint(file_path):
148 """
149 Restore checkpoint.
150
(...)
159 A dict contains 'model' and 'optimizer' (if saved).
160 """
--> 161 return torch.load(cached_url(file_path), map_location=lambda storage, loc: storage)

File /usr/local/lib/python3.9/dist-packages/torch/serialization.py:699, in load(f, map_location, pickle_module, **pickle_load_args)
696 if 'encoding' not in pickle_load_args.keys():
697 pickle_load_args['encoding'] = 'utf-8'
--> 699 with _open_file_like(f, 'rb') as opened_file:
700 if _is_zipfile(opened_file):
701 # The zipfile reader is going to advance the current file position.
702 # If we want to actually tail call to torch.jit.load, we need to
703 # reset back to the original position.
704 orig_position = opened_file.tell()

File /usr/local/lib/python3.9/dist-packages/torch/serialization.py:230, in _open_file_like(name_or_buffer, mode)
228 def _open_file_like(name_or_buffer, mode):
229 if _is_path(name_or_buffer):
--> 230 return _open_file(name_or_buffer, mode)
231 else:
232 if 'w' in mode:

File /usr/local/lib/python3.9/dist-packages/torch/serialization.py:211, in _open_file.init(self, name, mode)
210 def init(self, name, mode):
--> 211 super(_open_file, self).init(open(name, mode))

FileNotFoundError: [Errno 2] No such file or directory: '/root/.ts_cache/b91f996d8ec980e293ffd169408e9f99b9728f4024744405bef1f2f04ecaedd5/download.cached'

Releasing vanilla LSTM pre-trained LM model?

Hi, thanks for this great work. It is very helpful to release the pre-trained LM in such a clear code (unlike Elmo)

I am wondering if you have any plan to release the pre-trained R-Elmo model in your paper (#6 and #7 in table 1 of the paper)?

Thanks!

MUC-7 Support

Currently, CoreNLP NER supports from 3 classes CoNLL to the MUC-7 classes, depending on the model loaded in the CoreNLP pipeline:

# tags: LOCATION, ORGANIZATION, PERSON
edu/stanford/nlp/models/ner/english.all.3class.distsim.crf.ser.gz
# tags: DATE, LOCATION, MONEY, ORGANIZATION, PERCENT, PERSON, TIME
edu/stanford/nlp/models/ner/english.muc.7class.distsim.crf.ser.gz
# LOCATION, MISC, ORGANIZATION, PERSON
edu/stanford/nlp/models/ner/english.conll.4class.distsim.crf.ser.gz

They can also be combine all together to obtain the 7 classes output CFR predictor.
It would be possible to support the MUC-7 classes?

Thank you.

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.