-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Create README.md #8075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Create README.md #8075
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
model_cards/gurkan08/bert-turkish-text-classification/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| --- | ||
| language: tr | ||
| --- | ||
| # Turkish News Text Classification | ||
|
|
||
| Turkish text classification model obtained by fine-tuning the Turkish bert model (dbmdz/bert-base-turkish-cased) | ||
|
|
||
| # Dataset | ||
|
|
||
| Dataset consists of 11 classes were obtained from https://www.trthaber.com/. The model was created using the most distinctive 6 classes. | ||
|
|
||
| Dataset can be accessed at https://github.com/gurkan08/datasets/tree/master/trt_11_category. | ||
|
|
||
| label_dict = { | ||
| 'LABEL_0': 'ekonomi', | ||
| 'LABEL_1': 'spor', | ||
| 'LABEL_2': 'saglik', | ||
| 'LABEL_3': 'kultur_sanat', | ||
| 'LABEL_4': 'bilim_teknoloji', | ||
| 'LABEL_5': 'egitim' | ||
| } | ||
|
|
||
| 70% of the data were used for training and 30% for testing. | ||
|
|
||
| train f1-weighted score = %97 | ||
|
|
||
| test f1-weighted score = %94 | ||
|
|
||
| # Usage | ||
|
|
||
| from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification | ||
|
|
||
| tokenizer = AutoTokenizer.from_pretrained("gurkan08/bert-turkish-text-classification") | ||
| model = AutoModelForSequenceClassification.from_pretrained("gurkan08/bert-turkish-text-classification") | ||
|
|
||
| nlp = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer) | ||
|
|
||
| text = ["Süper Lig'in 6. haftasında Sivasspor ile Çaykur Rizespor karşı karşıya geldi...", | ||
| "Son 24 saatte 69 kişi Kovid-19 nedeniyle yaşamını yitirdi, 1573 kişi iyileşti"] | ||
|
|
||
| out = nlp(text) | ||
|
|
||
| label_dict = { | ||
| 'LABEL_0': 'ekonomi', | ||
| 'LABEL_1': 'spor', | ||
| 'LABEL_2': 'saglik', | ||
| 'LABEL_3': 'kultur_sanat', | ||
| 'LABEL_4': 'bilim_teknoloji', | ||
| 'LABEL_5': 'egitim' | ||
| } | ||
|
|
||
| results = [] | ||
| for result in out: | ||
| result['label'] = label_dict[result['label']] | ||
| results.append(result) | ||
| print(results) | ||
|
|
||
| # > [{'label': 'spor', 'score': 0.9992026090621948}, {'label': 'saglik', 'score': 0.9972177147865295}] | ||
|
|
||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.