ในตัวอย่างนี้ เราใช้หม้อแปลง Jina, PyTorch และ Hugging Face เพื่อสร้างระบบตอบคำถามทางการเงินที่ใช้ BERT ที่พร้อมสำหรับการผลิต เราปรับแนวทางการจัดลำดับข้อความใหม่โดยการดึงคำตอบของผู้สมัคร 50 อันดับแรก จากนั้นจึงจัดอันดับคำตอบของผู้สมัครใหม่โดยใช้ FinBERT-QA ซึ่งเป็นโมเดลที่อิงจาก BERT ที่ได้รับการปรับแต่งอย่างละเอียดบนชุดข้อมูล FiQA ซึ่งได้ผลลัพธ์ที่ล้ำสมัย
- โปรดดูบทช่วยสอนนี้เพื่อดูคำแนะนำทีละขั้นตอนและคำอธิบายโดยละเอียด
ด้วยแรงบันดาลใจจากความต้องการที่เกิดขึ้นในอุตสาหกรรมการเงินสำหรับการวิเคราะห์ข้อมูลที่ไม่มีโครงสร้างและข้อมูลที่มีโครงสร้างโดยอัตโนมัติในวงกว้าง ระบบ QA สามารถมอบข้อได้เปรียบทางการแข่งขันและผลกำไรให้กับบริษัทต่างๆ โดยการอำนวยความสะดวกในการตัดสินใจของที่ปรึกษาทางการเงิน เป้าหมายของระบบของเราคือการค้นหารายการข้อความคำตอบที่เกี่ยวข้องสำหรับคำถาม นี่คือตัวอย่างคำถามและคำตอบตามความจริงจากชุดข้อมูล FiQA:
https://github.com/yuanbit/jina-financial-qa-search.git
เราจะใช้ jina-financial-qa-search/
เป็นไดเร็กทอรีการทำงานของเรา
pip install -r requirements.txt
bash get_data.sh
เราต้องการจัดทำดัชนีชุดย่อยของข้อความคำตอบจากชุดข้อมูล FiQA, dataset/test_answers.csv
:
398960 From http://financial-dictionary.thefreedictionary.com/Business+Fundamentals The facts that affect a company's underlying value. Examples of business fundamentals include debt, cash flow, supply of and demand for the company's products, and so forth. For instance, if a company does not have a sufficient supply of products, it will fail. Likewise, demand for the product must remain at a certain level in order for it to be successful. Strong business fundamentals are considered essential for long-term success and stability. See also: Value Investing, Fundamental Analysis. For a stock the basic fundamentals are the second column of numbers you see on the google finance summary page, P/E ratio, div/yeild, EPS, shares, beta. For the company itself it's generally the stuff on the 'financials' link (e.g. things in the quarterly and annual report, debt, liabilities, assets, earnings, profit etc.
19183 If your sole proprietorship losses exceed all other sources of taxable income, then you have what's called a Net Operating Loss (NOL). You will have the option to "carry back" and amend a return you filed in the last 2 years where you owed tax, or you can "carry forward" the losses and decrease your taxes in a future year, up to 20 years in the future. For more information see the IRS links for NOL. Note: it's important to make sure you file the NOL correctly so I'd advise speaking with an accountant. (Especially if the loss is greater than the cost of the accountant...)
327002 To be deductible, a business expense must be both ordinary and necessary. An ordinary expense is one that is common and accepted in your trade or business. A necessary expense is one that is helpful and appropriate for your trade or business. An expense does not have to be indispensable to be considered necessary. (IRS, Deducting Business Expenses) It seems to me you'd have a hard time convincing an auditor that this is the case. Since business don't commonly own cars for the sole purpose of housing $25 computers, you'd have trouble with the "ordinary" test. And since there are lots of other ways to house a computer other than a car, "necessary" seems problematic also.
คุณสามารถเปลี่ยนเส้นทางเป็น answer_collection.tsv
เพื่อจัดทำดัชนีด้วยชุดข้อมูลแบบเต็มได้
python app.py index
ในตอนท้ายคุณจะเห็นสิ่งต่อไปนี้:
✅ done in ⏱ 1 minute and 54 seconds ? 7.7/s
gateway@18904[S]:terminated
doc_indexer@18903[I]:recv ControlRequest from ctl▸doc_indexer▸⚐
doc_indexer@18903[I]:Terminating loop requested by terminate signal RequestLoopEnd()
doc_indexer@18903[I]:#sent: 56 #recv: 56 sent_size: 1.7 MB recv_size: 1.7 MB
doc_indexer@18903[I]:request loop ended, tearing down ...
doc_indexer@18903[I]:indexer size: 865 physical size: 3.1 MB
doc_indexer@18903[S]:artifacts of this executor (vecidx) is persisted to ./workspace/doc_compound_indexer-0/vecidx.bin
doc_indexer@18903[I]:indexer size: 865 physical size: 3.2 MB
doc_indexer@18903[S]:artifacts of this executor (docidx) is persisted to ./workspace/doc_compound_indexer-0/docidx.bin
เราจำเป็นต้องสร้าง Executor แบบกำหนดเองเพื่อจัดอันดับคำตอบของผู้สมัคร 50 อันดับแรกใหม่ เราสามารถทำได้ด้วย Jina Hub API ตรวจสอบให้แน่ใจว่าได้ติดตั้งส่วนขยาย Jina Hub แล้ว:
pip install "jina[hub]"
เราสามารถสร้าง Ranker แบบกำหนดเอง FinBertQARanker
ได้โดยการรัน:
jina hub build FinBertQARanker/ --pull --test-uses --timeout-ready 60000
ขณะนี้เราสามารถใช้เครื่องมือค้นหา QA ทางการเงินของเราได้โดยเรียกใช้:
python app.py search
Ranker อาจใช้เวลาในการคำนวณคะแนนความเกี่ยวข้องเนื่องจากใช้โมเดลแบบ BERT คุณสามารถลองใช้รายการคำถามนี้จากชุดข้อมูล FiQA:
• What does it mean that stocks are “memoryless”?
• What would a stock be worth if dividends did not exist?
• What are the risks of Dividend-yielding stocks?
• Why do financial institutions charge so much to convert currency?
• Is there a candlestick pattern that guarantees any kind of future profit?
• 15 year mortgage vs 30 year paid off in 15
• Why is it rational to pay out a dividend?
• Why do companies have a fiscal year different from the calendar year?
• What should I look at before investing in a start-up?
• Where do large corporations store their massive amounts of cash?
#JinaSearch
ลิขสิทธิ์ (c) 2021 เพื่อนของจิน่า สงวนลิขสิทธิ์.