1
0

almost done with the classification task

This commit is contained in:
mgaughan 2025-07-25 15:37:32 -05:00
parent 862643d5df
commit 9e4c05e347
2 changed files with 77 additions and 65 deletions

View File

@ -1,88 +1,88 @@
setting up the environment by loading in conda environment at Fri Jul 25 14:09:58 CDT 2025
running the bertopic job at Fri Jul 25 14:09:58 CDT 2025
setting up the environment by loading in conda environment at Fri Jul 25 15:31:16 CDT 2025
running the bertopic job at Fri Jul 25 15:31:16 CDT 2025
cuda
NVIDIA A100-SXM4-80GB
_CudaDeviceProperties(name='NVIDIA A100-SXM4-80GB', major=8, minor=0, total_memory=81153MB, multi_processor_count=108, uuid=393ab5c3-2bcb-e4c6-52ad-eb4896a9d4fe, L2_cache_size=40MB)
Loading checkpoint shards: 0%| | 0/12 [00:00<?, ?it/s] Loading checkpoint shards: 8%|▊ | 1/12 [00:00<00:03, 2.99it/s] Loading checkpoint shards: 17%|█▋ | 2/12 [00:00<00:04, 2.06it/s] Loading checkpoint shards: 25%|██▌ | 3/12 [00:01<00:04, 1.99it/s] Loading checkpoint shards: 33%|███▎ | 4/12 [00:02<00:04, 1.90it/s] Loading checkpoint shards: 42%|████▏ | 5/12 [00:02<00:03, 1.88it/s] Loading checkpoint shards: 50%|█████ | 6/12 [00:03<00:03, 1.86it/s] Loading checkpoint shards: 58%|█████▊ | 7/12 [00:03<00:02, 1.76it/s] Loading checkpoint shards: 67%|██████▋ | 8/12 [00:04<00:02, 1.78it/s] Loading checkpoint shards: 75%|███████▌ | 9/12 [00:04<00:01, 1.83it/s] 3, 2.99it/s] 3, 2.99it/s] 3, 2.99it/s] 3, 2.99it/s] Loading checkpoint shards: 17%|█▋ | 2/12 [00:00<00:04, 2.06it/s] it/s]
_CudaDeviceProperties(name='NVIDIA A100-SXM4-80GB', major=8, minor=0, total_memory=81153MB, multi_processor_count=108, uuid=8a2376e5-9aa1-4450-7c89-6e41bdbc6af6, L2_cache_size=40MB)
Loading checkpoint shards: 0%| | 0/12 [00:00<?, ?it/s] Loading checkpoint shards: 8%|▊ | 1/12 [00:00<00:03, 2.99it/s] Loading checkpoint shards: 25%|██▌ | 3/12 [00:01<00:04, 1.99it/s] 3, 2.99it/s] Loading checkpoint shards: 33%|███▎ | 4/12 [00:02<00:04, 1.90it/s] 3, 2.99it/s] Loading checkpoint shards: 42%|████▏ | 5/12 [00:02<00:03, 1.88it/s] 3, 2.99it/s] Loading checkpoint shards: 50%|█████ | 6/12 [00:03<00:03, 1.86it/s] 3, 2.99it/s] Loading checkpoint shards: 58%|█████▊ | 7/12 [00:03<00:02, 1.76it/s] 3, 2.99it/s] Loading checkpoint shards: 67%|██████▋ | 8/12 [00:04<00:02, 1.78it/s] 3, 2.99it/s] Loading checkpoint shards: 75%|███████▌ | 9/12 [00:04<00:01, 1.83it/s] Loading checkpoint shards: 17%|█▋ | 2/12 [00:00<00:04, 2.06it/s] Loading checkpoint shards: 17%|█▋ | 2/12 [00:00<00:04, 2.06it/s] 3, 2.99it/s] Loading checkpoint shards: 17%|█▋ | 2/12 [00:00<00:04, 2.06it/s] Loading checkpoint shards: 17%|█▋ | 2/12 [00:00<00:04, 2.06it/s] Loading checkpoint shards: 92%|█████████▏| 11/12 [00:06<00:00, 1.78it/s] Loading checkpoint shards: 100%|██████████| 12/12 [00:06<00:00, 1.90it/s]
this is the response:::: ----------------------------
task_description
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
TASK PROGRESS
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
TASK PROGRESS
this is the response:::: ----------------------------
task_description
this is the response:::: ----------------------------
task_subcomment
this is the response:::: ----------------------------
task_subcomment
this is the response:::: ----------------------------
task_subcomment
this is the response:::: ----------------------------
task_subcomment
this is the response:::: ----------------------------
task_subcomment
this is the response:::: ----------------------------
task_subcomment
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
ACTION ON ISSUE
this is the response:::: ----------------------------
task_subcomment
SOLUTION DISCUSSION
this is the response:::: ----------------------------
ACTION ON ISSUE
this is the response:::: ----------------------------
task_subcomment
SOLUTION DISCUSSION
this is the response:::: ----------------------------
task_subcomment
SOLUTION DISCUSSION
this is the response:::: ----------------------------
task_subcomment
SOLUTION USAGE
this is the response:::: ----------------------------
task_subcomment
ACTION ON ISSUE
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
ACTION ON ISSUE
this is the response:::: ----------------------------
task_subcomment
SOLUTION USAGE
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
SOLUTION USAGE
this is the response:::: ----------------------------
task_subcomment
TASK PROGRESS
this is the response:::: ----------------------------
task_subcomment
TASK PROGRESS
this is the response:::: ----------------------------
task_subcomment
TASK PROGRESS
this is the response:::: ----------------------------
task_subcomment
TASK PROGRESS
this is the response:::: ----------------------------
task_subcomment
TASK PROGRESS
this is the response:::: ----------------------------
task_subcomment
SOLUTION DISCUSSION
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
INVESTIGATION AND EXPLORATION
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
task_description
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
task_subcomment
ACTION ON ISSUE
this is the response:::: ----------------------------
task_subcomment
BUG REPRODUCTION
this is the response:::: ----------------------------
ACTION ON ISSUE
this is the response:::: ----------------------------
BUG REPRODUCTION
this is the response:::: ----------------------------
BUG REPRODUCTION
this is the response:::: ----------------------------
ACTION ON ISSUE
this is the response:::: ----------------------------
ACTION ON ISSUE
this is the response:::: ----------------------------
TASK PROGRESS
this is the response:::: ----------------------------
TASK PROGRESS

View File

@ -19,34 +19,36 @@ tokenizer = AutoTokenizer.from_pretrained("allenai/OLMo-2-1124-13B")
#TODO: text_preprocessing per https://arxiv.org/pdf/1902.07093
priming = "For the GIVEN COMMENT, please categorize it into one of the following [[CATEGORIES]] of information; please categorize by matching the GIVEN COMMENT to the [[CATEGORY]] that mmost describes the GIVEN COMMENT. Below are a list of categories to label the GIVEN COMMENT with. Categories are formatted as '[[CATEGORY]], short description, example of comment that matches the category'."
priming = "For the **GIVEN COMMENT**, please categorize it into one of the defined [[CATEGORIES]]. Each [[CATEGORY]] is described in the TYPOLOGY for reference.Your task is to match the **GIVEN COMMENT** to the **[[CATEGORY]]** that most accurately describes the content of the comment. Only provide the category as your output. Do not provide any text beyond the category name."
#the typology descriptions are taken straight from https://arxiv.org/pdf/1902.07093
typology = """
[[EXPECTED BEHAVIOR]], in which stakeholders discuss, from the users perspective, the expected or ideal situation affected by the issue. This discussion sometimes relies on the personal preferences and opinions from the OSS participants. For example, a participant commented: My suggestion/request in the near term would be to have an option to make the vocabulary read only so that users who want to be able to leave spacy alone to do streaming data processing dont need to worry about changing memory requirements.
TYPOLOGY:
[[MOTIVATION]], in which stakeholders elaborate on why the issue needs to be fixed or a feature needs to be added. To strengthen their arguments, they usually described use cases involving the requested feature and/or cited competitors who implemented the requested feature. For example, in support of redesigning TensorFlow's input pipeline one participant wrote: “Right now, this method starves my GPU all the time, which is a shame because most other [deep learning] frameworks manage to make this much more performantly.”
[[EXPECTED BEHAVIOR]], in which stakeholders discuss, from the users perspective, the expected or ideal situation affected by the issue. For example, a participant commented: My suggestion/request in the near term would be to have an option to make the vocabulary read only so that users who want to be able to leave spacy alone to do streaming data processing dont need to worry about changing memory requirements.
[[MOTIVATION]], in which stakeholders elaborate on why the issue needs to be fixed or a feature needs to be added. For example, in support of redesigning TensorFlow's input pipeline one participant wrote: “Right now, this method starves my GPU all the time, which is a shame because most other [deep learning] frameworks manage to make this much more performantly.”
[[OBSERVED BUG BEHAVIOR]], which only appears in bug reports and focuses on describing the observed behaviour of the bug. For example, one participant commented: I found strange behavior using the pipe() method, then started to describe this behavior.
[[BUG REPRODUCTION]], which also only appears in bug reports and focuses on any report, request, and/or question regarding the reproduction of the bug. For example, one participant commented that a bug was reproducible: Same problem here, working on Windows 10 with German text.
[[INVESTIGATION AND EXPLORATION]], in which OSS stakeholders discuss their exploration of ideas about the problem that was thought to have caused the issue. Sometimes participants provide suggestions on how or what to investigate. For example, This result confirms my hypothesis but also shows that the memory increase really isnt all that significant... But it still points to a potential flaw in the design of the library.
[[INVESTIGATION AND EXPLORATION]], in which OSS stakeholders discuss their exploration of ideas about the problem that was thought to have caused the issue. For example, This result confirms my hypothesis but also shows that the memory increase really isnt all that significant... But it still points to a potential flaw in the design of the library.
[[SOLUTION DISCUSSION]] is framed around the solution space from the developers point of view, in which participants discuss design ideas and implementation details, as well as suggestions, constraints, challenges, and useful references around such topics. For example, I know there are multiple ways of approaching this however I strongly recommend node-gyp for performance.
[[CONTRIBUTION AND COMMITMENT]], in which participants call for contributors and/or voice willingness or unwillingness to contribute to resolving the issue. For example, one potential collaborator said: I will gladly contribute in any way I can, however, this is something I will not be able to do alone. Would be best if a few other people is interested as well...
[[TASK PROGRESS]], in which stakeholders request or report progress of tasks and sub-tasks towards the solution of the issue. Participants sometimes also mention their plan of actions. For example, I made an initial stab at it... - this is just a proof of concept that gets the version string into nodejs. Ill start working on adding the swig interfaces...
[[TASK PROGRESS]], in which stakeholders request or report progress of tasks and sub-tasks towards the solution of the issue. For example, I made an initial stab at it... - this is just a proof of concept that gets the version string into nodejs. Ill start working on adding the swig interfaces...
[[TESTING]], in which participants discuss the testing procedure and results, as well as the system environment, code, data, and feedback involved in testing. For example, Tested on 0.101 and master - the issue seems to be fixed on master not just for the example document, but for the entire corpus...
[[FUTURE PLAN]], in which participants discuss the long-term plan related to the issue; such plans usually involve work/ideas that are not required to close the current issue. For example, For the futures, stay tuned, as were prototyping something in this direction.
[[POTENTIAL NEW ISSUES AND REQUESTS]], in which participants identify and discuss new bugs or needed features while investigating and addressing the current issue. They are out of the scope of the discussion of the current issue but may lead to new issue reports. For example, when discussing a bug in scikit-learn about parallel execution that causes process hanging, one participant said: As a side point, I note there seems to be a lot more joblib parallelisation overhead in master... that wasnt there in 0.14.
[[POTENTIAL NEW ISSUES AND REQUESTS]], in which participants identify and discuss new bugs or needed features while investigating and addressing the current issue. For example, when discussing a bug in scikit-learn about parallel execution that causes process hanging, one participant said: As a side point, I note there seems to be a lot more joblib parallelisation overhead in master... that wasnt there in 0.14.
[[SOLUTION USAGE]] was usually discussed once a full or partial solution of the issue was released and stakeholders asked questions or provided suggestions about how to use the library with the new solution update. For example, Please help me how to continue training the model [with the new release].
[[WORKAROUNDS]] focus on discussions about temporary or alternative solutions that can help overcome the issue until the official fix or enhancement is released. In a discussion regarding memory growth for streamed data, one participant expressed his temporary solution: For now workaround with reloading / collecting nlp object works quite ok in production.
[[WORKAROUNDS]] focus on discussions about temporary or alternative solutions that can help overcome the issue until the official fix or enhancement is released. For example, in a discussion regarding memory growth for streamed data, one participant expressed his temporary solution: For now workaround with reloading / collecting nlp object works quite ok in production.
[[ISSUE CONTENT MANAGEMENT]] focuses on redirecting the discussions and controlling the quality of the comments with respect to the issue. For example, We might want to move this discussion to here: [link to another issue]
@ -55,8 +57,8 @@ typology = """
[[SOCIAL CONVERSATION]], in which participants express emotions such as appreciation, disappointment, annoyance, regret, etc. or engage in small talk. For example, Im so glad that this has received so much thought and attention!
"""
instructions="Only respond with the GIVEN COMMENT's [[CATEGORY]] classification. Do not provide any more information."
#instructions="Only respond with the GIVEN COMMENT's [[CATEGORY]] classification. Do not provide any more information."
instructions="The comment's category is: "
with open("/home/nws8519/git/mw-lifecycle-analysis/p2/quest/072325_biberplus_labels.csv", mode='r', newline='') as file:
reader = csv.reader(file)
@ -72,11 +74,18 @@ with open("/home/nws8519/git/mw-lifecycle-analysis/p2/quest/072325_biberplus_lab
text_dict['task_title'] = row[1]
text_dict['comment_text'] = row[2]
text_dict['comment_type'] = row[12]
#TODO: build out prompt construction; more specificity in data provided
given_data = f"GIVEN COMMENT: \n ' Type -{text_dict['comment_type']} \n Text -{text_dict['comment_text']}'\n"
#TODO: comment_text preprocessing per https://arxiv.org/pdf/1902.07093
# 1. replace code with CODE
# 2. replace quotes with QUOTE
# 3. replace URLs with URL
# 4. if possible, replace @ with SCREEN_NAME
#build out prompt construction; more specificity in data provided
given_data = f"**GIVEN COMMENT: \n ' Type -{text_dict['comment_type']} \n Text -{text_dict['comment_text']}**'\n"
prompt_question="What do you think about this message? What are they saying?"
#prompt = f"{prompt_1}\n\n{example_1}\n\n{example_2}\n\n{example_3}\n\n{example_4}\n\n{given_data}\n"
prompt = f"{priming}\n{typology}\n{instructions}\n\n{given_data}\n\n What is the above comment's [[CATEGORY]]?"
prompt = f"{priming}\n{typology}\n\n{given_data}\n{instructions}"
#handoff to the model
inputs = tokenizer(prompt, return_tensors='pt', return_token_type_ids=False).to(device)
#deterministic sampling and getting the response back
@ -87,12 +96,13 @@ with open("/home/nws8519/git/mw-lifecycle-analysis/p2/quest/072325_biberplus_lab
#getting the resulting codes
#codes_id = response_txt.rfind("CATEGORIES:")
#writing them to the citation_dicti
match = re.search(r"What is the above comment's \[\[CATEGORY\]\]\?\s*(.*)", response_txt)
match = re.search(r"The comment's category is: \s*(.*)", response_txt)
if match:
following_text = match.group(1)
following_text = match.group(1).strip("[]*")
else:
following_text = "NO CATEGORY"
print(following_text)
text_dict['olmo_category'] = following_text
'''
for item in result.strip(";").split(";"):
key_value = item.strip().split('. ')
@ -106,4 +116,6 @@ with open("/home/nws8519/git/mw-lifecycle-analysis/p2/quest/072325_biberplus_lab
break
#CSV everything
df = pd.DataFrame(array_of_categorizations)
#df.to_csv('072525_olmo_messages_categorized.csv', index=False)