Downloads · 30 days
119
1% of all-time downloads
aisingapore/coherence-momentum
coherence-momentum is a text generation model from aisingapore. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
You can test the model at coherence modeling.<br / If you want to find out more information, please contact us at [email protected].
Downloads · 30 days
119
1% of all-time downloads
All-time downloads
9.9K
Public
Repo size
1.9 GB
Likes
11
Public
Click a slice to open those files.
.bin934 MB · 100%
From the Hugging Face model README
You can test the model at coherence modeling.<br /> If you want to find out more information, please contact us at [email protected].
Model Name: Coherence-Momentum
SGnlp is an initiative by AI Singapore's NLP Hub. They aim to bridge the gap between research and industry, promote translational research, and encourage adoption of NLP techniques in the industry. <br><br> Various NLP models, other than aspect sentiment analysis are available in the python package. You can try them out at SGNLP-Demo | SGNLP-Github.
pip install sgnlp
For more full code (such as Coherence-Momentum), please refer to this github. <br> Alternatively, you can also try out the demo for Coherence-Momentum.
Example of Coherence Momentum modelling:
from sgnlp.models.coherence_momentum import CoherenceMomentumModel, CoherenceMomentumConfig, \
CoherenceMomentumPreprocessor
# Load Model
config = CoherenceMomentumConfig.from_pretrained(
"https://storage.googleapis.com/sgnlp-models/models/coherence_momentum/config.json"
)
model = CoherenceMomentumModel.from_pretrained(
"https://storage.googleapis.com/sgnlp-models/models/coherence_momentum/pytorch_model.bin",
config=config
)
preprocessor = CoherenceMomentumPreprocessor(config.model_size, config.max_len)
# Example text inputs
text1 = "Companies listed below reported quarterly profit substantially different from the average of analysts ' " \
"estimates . The companies are followed by at least three analysts , and had a minimum five-cent change in " \
"actual earnings per share . Estimated and actual results involving losses are omitted . The percent " \
"difference compares actual profit with the 30-day estimate where at least three analysts have issues " \
"forecasts in the past 30 days . Otherwise , actual profit is compared with the 300-day estimate . " \
"Source : Zacks Investment Research"
text2 = "The companies are followed by at least three analysts , and had a minimum five-cent change in actual " \
"earnings per share . The percent difference compares actual profit with the 30-day estimate where at least " \
"three analysts have issues forecasts in the past 30 days . Otherwise , actual profit is compared with the " \
"300-day estimate . Source : Zacks Investment Research. Companies listed below reported quarterly profit " \
"substantially different from the average of analysts ' estimates . Estimated and actual results involving " \
"losses are omitted ."
text1_tensor = preprocessor([text1])
text2_tensor = preprocessor([text2])
text1_score = model.get_main_score(text1_tensor["tokenized_texts"]).item()
text2_score = model.get_main_score(text2_tensor["tokenized_texts"]).item()
print(text1_score, text2_score)
The training datasets can be retrieved from Permuted dataset derived from Linguistic Data Consortium's (LDC) Wall Street Journal (WSJ) dataset. Please contact the authors to get the dataset if you have a valid LDC license.