Views
No views yet
1
2article = """Two of the OPEC oil cartels 11 members, Nigeria and Venezuela, said today \
3that they would voluntarily cut production in response to declining crude oil prices, which \
4have fallen 20 percent from their peak two months ago.
5The move, which would take less than 200,000 barrels of oil a day off the market, follows days \
6of mixed signals from some OPEC officials, who have voiced increasing concern about the rapid \
7drop in prices. Nigerias oil minister, Edmund Daukoru, who is president of OPEC this year, \
8recently said the price of oil was very low.
9Nigeria and Venezuela, which have generally been price hawks within the group, said their decision \
10to cut production grew out of an informal deal reached at OPECs last meeting, earlier this month, \
11to pare output if prices fell steeply. Some OPEC representatives have grown anxious at the slide in \
12the oil futures markets, where prices for benchmark contracts have fallen from a midsummer high of \
13$77.03 a barrel.
14But traders shrugged off the announcement of the production cuts today. On the New York Mercantile \
15Exchange, the most widely watched contract price light, low-sulfur crude for delivery next month \
16traded this afternoon at $62.30 a barrel, down 0.7 percent.
17Mr. Daukoru has been in contact with other OPEC ministers to discuss prices, which on Monday briefly \
18slipped below $60 a barrel for the first time in six months. But the Organization of the Petroleum \
19Exporting Countries, as the cartel is formally known, denied any shift in policy.
20We are not currently concerned, a delegate from one of OPECs Gulf members said. The prices are \
21currently manageable and fair. We are not overly alarmed by the prices. It is not a cause for alarm. \
22It's the market working.
23It is not unusual for oil prices to fall after Labor Day and the conclusion of the summer travel season. \
24Demand tends to slow in the third quarter, and refiners reduce their output for seasonal maintenance; \
25consumption picks up again with the first winter cold in the Western Hemisphere, and prices sometimes do as well.
26We are not going to push extra oil in the market or force it down our customers throats, we just respond to demand, \
27the delegate from the Gulf said.
28Still, contradictory statements from senior OPEC representatives have sown doubt about the oil cartel's strategy. \
29Whether OPEC countries actually reduce their output or not, the mixed messages have at least succeeded in one way: \
30oil traders have been persuaded that OPEC is willing to step in to defend prices, and have traded on that belief, \
31slowing the recent price decline.
32While apparently fanciful, reports of an imminent output cut reflect two hard facts: stocks are building faster than \
33expected, and several producers have an incredibly low pain threshold when it comes to price drops, Antoine Halff, an \
34energy analyst with Fimat, wrote in a note to clients today. However, more price declines will likely be needed before \
35OPEC producers decide on any coordinated move.
36Venezuela, which pumps about 2.5 million barrels a day, said it would cut its daily output by 50,000 barrels, or about 2 \
37percent, starting Oct. 1. Nigeria said it would trim its exports by 5 percent on the same date, a reduction of about \
38120,000 barrels a day from its current output of about 3.8 million barrels a day.
39They are trying to influence the psychology of the market, said Larry Goldstein, a veteran oil analyst and the president \
40of the Petroleum Industry Research Foundation in New York. Although they are reacting to the reduction in demand, they \
41are trying to convince the market that they are actually anticipating it, by making cuts ahead of the market. But they \
42are simply reacting to it, which is how markets should operate."""
43
44import transformers
45import os
46import torch
47#If you have more than one GPU, you can specify here which one to use
48os.environ["CUDA_VISIBLE_DEVICES"]="5"
49from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
50device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
51print(device)
52
53#appending the task identifier to the beginning of input
54article = "Headline: " + article
55
56model = AutoModelForSeq2SeqLM.from_pretrained("omidvaramin/Ht5-small").to(device)
57tokenizer = AutoTokenizer.from_pretrained("omidvaramin/Ht5-small")
58#encodign article using tokenizer
59encoding = tokenizer(article
60 , max_length=1024
61 , truncation=True
62 ,return_tensors="pt"
63 ,padding='longest')
64
65input_ids = encoding['input_ids']
66attention_masks = encoding['attention_mask']
67
68#transfering the data into GPU
69input_ids = input_ids.to(device)
70attention_masks = attention_masks.to(device)
71
72
73#generate headlines using kbeam technique
74beam_outputs = model.generate(
75 input_ids = input_ids,
76 attention_mask = attention_masks
77 ,do_sample = False
78 ,num_beams = 4
79 ,max_length = 20
80 ,min_length = 1
81 ,num_return_sequences = 1
82 )
83
84result = tokenizer.batch_decode(beam_outputs,
85 skip_special_tokens=True)
86print(result[0])
87>>> [{'OPEC Members Say They Will Cut Oil Production'}]1@ARTICLE{10154027,
2 author={Omidvar, Amin and An, Aijun},
3 journal={IEEE Access},
4 title={Learning to Generate Popular Headlines},
5 year={2023},
6 volume={11},
7 number={},
8 pages={60904-60914},
9 doi={10.1109/ACCESS.2023.3286853}}
10