deepset-ai / FARM

:house_with_garden: Fast & easy transfer learning for NLP. Harvesting language models for the industry. Focus on Question Answering.
https://farm.deepset.ai
Apache License 2.0
1.74k stars 247 forks source link

Demo: how to create example-ready passage and Q for NER #370

Closed savasy closed 4 years ago

savasy commented 4 years ago

Question When I deploy my trained model in docker, I want to delete built-in models and put my model instead. I can load my QA model using saving the models under saved_model folder and fixing the docker-compose.yml. But I do not know how to put example passage and example Question in it.

Additional context Add any other context or screenshots about the question (optional).

Timoeller commented 4 years ago

Hey @savasy thanks for using FARM and also our docker setup. To answer your question we need some more context.

Normally the docker-compose up command should create a webbased GUI similar to https://demos.deepset.ai/ where you can paste in questions and texts. There you can also link your custom QA model as I assume you did. You can access that GUI by typing http://localhost:3000 in your browser. Maybe you could paste any error messages coming up when running the docker compose? I suspect that your custom QA model cannot be loaded correctly... e.g. did you train it with FARM?

savasy commented 4 years ago

Hi @Timoeller, using "deepset/farm-inference-api:latest" image and following YML config solved my problems

version: '3'
services:
  inference-api:
    image: "deepset/farm-inference-api:latest"
    ports:
      - "5000:5000"
    volumes:
        - ../../Desktop/farming/saved_models:/home/user/saved_models
  inference-ui:
    image: "deepset/farm-inference-ui:latest"
    ports:
      - "3000:80"

I can see my model However, the last problem is that how Can I put example passage and example question in Turkish Language rather than English. Thank you

Timoeller commented 4 years ago

I do not understand what you mean. Do you have the webbrowser open at http://localhost:3000 and can there see your model?

Did you train a multilingual QA model with English QA labels? This should work with Turkish text and questions, albeit at a much lower performance. Or do you mean you cannot input the special Turkish characters into the GUI? I tested special Turkish characters on https://demos.deepset.ai/ - there it works.

savasy commented 4 years ago

Sorry for confusion @Timoeller , I trained my model in Turkish language. For demo, e.g. in Question Answering Tab in demo https://demos.deepset.ai , I need to replace e.g. "Quarterly Financial Result" with Turkish lang example

Timoeller commented 4 years ago

Ah ok, sorry, totally lost : ) but thanks for clarifying.

We currently do not have a "clean" solution for changing these default texts but there might be a hacky one: you could search inside the docker in /var/www/localhost/demo-ui/build/static/js/main.994fb1c5.chunk.js for the strings (e.g. "Quarterly Financial Result") and replace them with the text you want.

Here is the text of all English examples so you can more easily find it:

"qa": [
    {
      "id": 0,
      "name": "Quarterly Financial Results",
      "passage": "Due to seasonal factors, revenue declined by 4 percent to €1,970 million in the first quarter of the 2019 fiscal year, compared to €1,047 million in the fourth quarter of the preceding fiscal year. Revenue was down slightly in the Automotive (ATV) and Industrial Power Control (IPC) Segments. Compared to the Group average, the decline was somewhat more pronounced in the Power Management & Multimarket (PMM) segment and noticeably more pronounced in the Digital Security Solutions (DSS) segment. The gross margin remained largely stable quarter-to-quarter, falling from 39.8 percent to 39.5 percent. Included therein are acquisition-related deprecation and amortization as well as other expenses totaling €16 million, mainly relating to the international Rectifier acquisition. The adjusted gross margin also remained virtually unchanged, coming in at 40.4 percent in the first quarter compared with 40.6 percent in the final quarter of the 2018 fiscal year. The segment result for the first quarter of the current fiscal year amounted to €359 million, down from €400 million one quarter earlier. The Segment Result margin decreased from 19.5 percent to 18.2 percent.",
      "question": "How did the gross margin develop?"
    },
    {
      "id": 1,
      "name": "Company description",
      "passage": "Airbus SE - from 2000 to 2014 known as the European Aeronautic Defence and Space Company (EADS), is a European aerospace corporation, registered in the Netherlands and trading shares in France, Germany and Spain. It designs, manufactures and sells civil and military aerospace products worldwide and manufactures in the European Union and various other countries. The company has three divisions: Commercial Aircraft, Defence and Space, and Helicopters, the third being the largest in its industry in terms of revenues and turbine helicopter deliveries.[7]The company's main civil aeroplane business is based in Blagnac, France, a suburb of Toulouse, with production and manufacturing facilities mostly in the European Union (France, Germany, Spain, United Kingdom) but also in China and the United States. Final assembly production is based at Toulouse, France; Hamburg, Germany; Seville, Spain; Tianjin, China, and Mobile, Alabama, United States.[8] The company produces and markets the first commercially viable digital fly-by-wire airliner, the Airbus A320,[9][10] and the world's largest passenger airliner, the A380. The 10,000th aircraft, an A350, was delivered to Singapore Airlines on 14 October 2016. The global Airbus fleet have performed more than 110 million flights, totaling over 215 billion kilometres and carrying 12 billion passengers.[11]Airbus's corporate headquarters is located in Leiden, Netherlands, and the main office is located in Toulouse, France.[12] The company is led by CEO Thomas Enders and is a component of the Euro Stoxx 50 stock market index.",
      "question": "Where is Toulouse?"
    },
    {
      "id": 2,
      "name": "Earnings Call",
      "passage": "Thank you, Alexander, and good morning, everyone. Infineon has closed its 2018 fiscal year with a strong September quarter. Our revenues crossed the EUR 2 billion mark and were EUR 2,047,000,000, up 5% quarter-over-quarter. But at constant U.S. dollar exchange rate, we would have grown by 4%. Year-over-year, currency adjusted growth was 12%, an acceleration compared to the June quarter. The segment result for Q4 was EUR 400 million, corresponding to a segment result margin of 19.5%, which was slightly ahead of our guidance even when taking the tailwind from the U.S. dollar appreciation into account. For the full 2018 fiscal year, group revenues came in at EUR 7,599,000,000, an 8% increase over the previous year. Assuming a constant U.S. dollar exchange rate, our annual growth rate would have been 12%, significantly in excess of our original expectation of 9%. The segment result for 2018 was EUR 1,353,000,000, equivalent to a 17.8% segment result margin. With this, we have increased revenues and profitability for the fifth year in a row and concluded a very successful year. We want our investors to participate in this development and will, therefore, propose a further 8% dividend increase to EUR 0.27 per share the next shareholders' meeting.",
      "question": "How much did group revenues increase?"
    }
  ]
savasy commented 4 years ago

it is a very kind of you @Timoeller

Timoeller commented 4 years ago

Thanks for closing the issue. Were you able to change the text to Turkish in the end?

savasy commented 4 years ago

Not yet @Timoeller , I will do it soon, thanks a lot